From 8fa9578c38e2d0b1108a5938826355f2fee98ae1 Mon Sep 17 00:00:00 2001 From: Ondrej Mejzlik Date: Thu, 29 Jun 2023 11:42:28 +0200 Subject: [PATCH] Adding new test --- .../basic-sanity-test-for-paperconf/main.fmf | 26 ++++++ .../basic-sanity-test-for-paperconf/nopaper | 0 Sanity/basic-sanity-test-for-paperconf/paper | 1 + .../runtest.sh | 86 +++++++++++++++++++ .../basic-sanity-test-for-paperconf/wrpaper | 1 + 5 files changed, 114 insertions(+) create mode 100644 Sanity/basic-sanity-test-for-paperconf/main.fmf create mode 100644 Sanity/basic-sanity-test-for-paperconf/nopaper create mode 100644 Sanity/basic-sanity-test-for-paperconf/paper create mode 100755 Sanity/basic-sanity-test-for-paperconf/runtest.sh create mode 100644 Sanity/basic-sanity-test-for-paperconf/wrpaper diff --git a/Sanity/basic-sanity-test-for-paperconf/main.fmf b/Sanity/basic-sanity-test-for-paperconf/main.fmf new file mode 100644 index 0000000..a5eafaa --- /dev/null +++ b/Sanity/basic-sanity-test-for-paperconf/main.fmf @@ -0,0 +1,26 @@ +summary: basic sanity test for paperconf +description: '' +contact: Ondrej Mejzlik +component: + - libpaper +test: ./runtest.sh +framework: beakerlib +recommend: + - libpaper +duration: 5m +enabled: true +tag: + - NoRHEL4 + - NoRHEL5 + - TIPfail_infra + - TIPpass + - Tier1 +tier: '1' +adjust: + - enabled: false + when: distro == rhel-4, rhel-5 + continue: false +extra-nitrate: TC#0602521 +extra-summary: /CoreOS/libpaper/Sanity/basic-sanity-test-for-paperconf +extra-task: /CoreOS/libpaper/Sanity/basic-sanity-test-for-paperconf +id: 9396c71b-0476-4f60-a531-1b234ce44273 diff --git a/Sanity/basic-sanity-test-for-paperconf/nopaper b/Sanity/basic-sanity-test-for-paperconf/nopaper new file mode 100644 index 0000000..e69de29 diff --git a/Sanity/basic-sanity-test-for-paperconf/paper b/Sanity/basic-sanity-test-for-paperconf/paper new file mode 100644 index 0000000..88ba23d --- /dev/null +++ b/Sanity/basic-sanity-test-for-paperconf/paper @@ -0,0 +1 @@ +a4 diff --git a/Sanity/basic-sanity-test-for-paperconf/runtest.sh b/Sanity/basic-sanity-test-for-paperconf/runtest.sh new file mode 100755 index 0000000..cf0abf3 --- /dev/null +++ b/Sanity/basic-sanity-test-for-paperconf/runtest.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/libpaper/Sanity/basic-sanity-test-for-paperconf +# Description: basic sanity test for paperconf +# Author: kzilkova +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="libpaper" +TESTDIR="$(pwd)" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + SIZEBCKUP=$PAPERSIZE + CONFBCKUP=$PAPERCONF + rlRun "rlFileBackup --missing-ok /etc/papersize" 0 "backup papersize" + rlPhaseEnd + + rlPhaseStartTest + #test basic functionality of paperconf command + rlRun "paperconf | grep 'letter'" 0 "Correct default value" + rlRun "paperconf -p a4 -wm | grep '210 mm'" 0 "check a4 width in mm" + rlRun "paperconf -p a4 -sc | grep '21 cm 29.7 cm'" 0 "check a4 height and width in cm" + rlRun "paperconf -p a2 -N | grep 'A2'" 0 "check if a in a2 is capitalized" + rlRun "paperconf -p note -N | grep 'Note'" 0 "check if N in note is capitalized" + rlRun "paperconf -d | grep 'letter'" 0 "check if default paper is letter" + rlRun "paperconf -p as -z | grep 'as'" 0 "check if -z prints wrong paper" + rlRun "paperconf -p a3 | grep 'a3'" 0 "check if there is paper a3" + rlRun "paperconf -p a5 | grep 'a5'" 0 "check if there is paper a5" + rlRun "paperconf -p a4 -hi | grep '11.6929'" 0 "check a4 height in inches" + rlRun "paperconf -p a4 -n | grep 'a4'" 0 "check if n print name" + + #changing PAPERSIZE variable + rlRun "PAPERSIZE=a4 paperconf | grep 'a4'" 0 "value from papersize" + rlRun "PAPERSIZE=as paperconf |& grep 'unknown paper'" 0 "value from papersize with non-existent PAPARSIZE value inserted" + + #changing PAPERCONF variable + rlRun "PAPERCONF=$TESTDIR/paper paperconf | grep 'a4'" 0 "value from paperconf" + rlRun "PAPERCONF=$TESTDIR/wrpaper paperconf |& grep 'unknown paper'" 0 "value from paperconf, wrong paper" + rlRun "PAPERCONF=$TESTDIR/nopaper paperconf | grep 'letter'" 0 "empty file, print letter" + + #changing paper size value through /etc/papersize file + rlRun "echo a5 >/etc/papersize" 0 "filling papersize with a5 paper" + rlRun "paperconf | grep 'a5'" 0 "value from papersize" + + rlRun "echo as > /etc/papersize" 0 "filling papersize with nonsence" + rlRun "paperconf |& grep 'unknown paper'" 0 "value from papersize, nonsence" + + rlRun "> /etc/papersize" 0 "remove content of /etc/papersize file" + rlRun "paperconf | grep 'letter'" 0 "value from papersize should now defaults to 'letter'" + rlPhaseEnd + + rlPhaseStartCleanup + PAPERSIZE=$SIZEBCKUP + PAPERCONF=$CONFBCKUP + rlRun "rlFileRestore" 0 " restoring papersize" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Sanity/basic-sanity-test-for-paperconf/wrpaper b/Sanity/basic-sanity-test-for-paperconf/wrpaper new file mode 100644 index 0000000..2e705c1 --- /dev/null +++ b/Sanity/basic-sanity-test-for-paperconf/wrpaper @@ -0,0 +1 @@ +skksjd