From d2df63bf525a921617fb851829233619c3994cb4 Mon Sep 17 00:00:00 2001 From: Milan Lysonek Date: Nov 11 2020 11:47:16 +0000 Subject: Sanity/cmdline: add cmdline test --- diff --git a/Sanity/cmdline/main.fmf b/Sanity/cmdline/main.fmf new file mode 100644 index 0000000..b5b443d --- /dev/null +++ b/Sanity/cmdline/main.fmf @@ -0,0 +1,27 @@ +summary: Performs check of command line arguments +contact: Matus Marhefka +component: +- scap-workbench +test: ./runtest.sh +require: +- library(distribution/Cleanup) +framework: beakerlib +recommend: +- scap-workbench +- xorg-x11-server-Xvfb +duration: 5m +enabled: true +tag: +- CI-Tier-1 +- NoRHEL4 +- NoRHEL5 +- NoRHEL6 +- TIPpass_Security +- Tier1 +- Tier1security +tier: '1' +relevancy: | + distro = rhel-4, rhel-5, rhel-6: False +extra-summary: /CoreOS/scap-workbench/Sanity/cmdline +extra-task: /CoreOS/scap-workbench/Sanity/cmdline +extra-nitrate: TC#0552020 diff --git a/Sanity/cmdline/runtest.sh b/Sanity/cmdline/runtest.sh new file mode 100755 index 0000000..4bcd3fb --- /dev/null +++ b/Sanity/cmdline/runtest.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/scap-workbench/Sanity/cmdline +# Description: Performs check of command line arguments +# Author: Marek Haicman +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# update +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="scap-workbench" + +rlJournalStart + rlPhaseStartSetup + rlImport --all || rlDie "Failed to import libraries" + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + CleanupRegister "rlRun 'rm -r $TmpDir' 0 'Removing tmp directory'" + rlRun "pushd $TmpDir" + CleanupRegister "rlRun 'popd'" + VERSION_STRING=$(rpm -q --queryformat '%{VERSION}' scap-workbench) + rlPhaseEnd + + rlPhaseStartTest "Test version" + rlRun "rlWatchdog \"xvfb-run scap-workbench --version > output\" 20" + rlAssertGrep "SCAP Workbench $VERSION_STRING" output || cat output + if rlIsRHEL ">=8" || rlIsFedora; then + VERSION_SHORT_OPTION="-v" + else + VERSION_SHORT_OPTION="-V" + fi + rlRun "rlWatchdog \"xvfb-run scap-workbench ${VERSION_SHORT_OPTION} > output\" 20" + + rlAssertGrep "SCAP Workbench $VERSION_STRING" output || cat output + rlPhaseEnd + + rlPhaseStartTest "Test help" + rlRun "rlWatchdog \"xvfb-run scap-workbench --help > output\" 20" + rlAssertGrep "Usage: \(\./\)\?scap-workbench" output || cat output + rlRun "rlWatchdog \"xvfb-run scap-workbench -h > output\" 20" + rlAssertGrep "Usage: \(\./\)\?scap-workbench" output || cat output + rlPhaseEnd + + rlPhaseStartCleanup + CleanupDo + rlPhaseEnd +rlJournalPrintText +rlJournalEnd