diff --git a/plans/all.fmf b/plans/all.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/all.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/basic-sanity-test/Makefile b/tests/basic-sanity-test/Makefile new file mode 100644 index 0000000..eeaed00 --- /dev/null +++ b/tests/basic-sanity-test/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/gawk/Sanity/basic-sanity-test +# Description: basic sanity test +# Author: Radka Brychtova +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2022 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/gawk/Sanity/basic-sanity-test +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Radka Brychtova " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: basic sanity test" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: gawk" >> $(METADATA) + @echo "Requires: gawk" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHEL6 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/basic-sanity-test/PURPOSE b/tests/basic-sanity-test/PURPOSE new file mode 100644 index 0000000..33a7027 --- /dev/null +++ b/tests/basic-sanity-test/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/gawk/Sanity/basic-sanity-test +Description: basic sanity test +Author: Radka Brychtova diff --git a/tests/basic-sanity-test/main.fmf b/tests/basic-sanity-test/main.fmf new file mode 100644 index 0000000..e928302 --- /dev/null +++ b/tests/basic-sanity-test/main.fmf @@ -0,0 +1,15 @@ +summary: basic sanity test +description: '' +contact: Radka Brychtova +component: + - gawk +test: ./runtest.sh +framework: beakerlib +recommend: + - gawk +duration: 5m +enabled: true +tag: + - CI-Tier-1 + - Tier1 +tier: '1' diff --git a/tests/basic-sanity-test/runtest.sh b/tests/basic-sanity-test/runtest.sh new file mode 100755 index 0000000..e5af7de --- /dev/null +++ b/tests/basic-sanity-test/runtest.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/gawk/Sanity/basic-sanity-test +# Description: basic sanity test +# Author: Radka Brychtova +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2022 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="gawk" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun "cut -f 1 -d ':' /etc/passwd > output_passwd" 0 "Get firt column from passwd" + rlLog "gawk command gawk -F: '{ print $1 }' /etc/passwd" + gawk -F: '{ print $1 }' /etc/passwd | tee output_gawk + rlAssertNotDiffer output_gawk output_passwd + rlLog "-----" + rlRun "echo -e '1\n2\n30\n452\n' > file1" + rlLog "gawk command gawk '{ sum += $1 }; END { print sum }'" + gawk '{ sum += $1 }; END { print sum }' file1 |tee output1_gawk + rlAssertGrep '485' output1_gawk + rlLog "-----" + rlLog "gawk command gawk '/root:x/ {print}' /etc/passwd" + gawk '/root:x/ {print}' /etc/passwd |tee output2_gawk + rlRun "grep 'root:x' /etc/passwd |tee output_root" + rlAssertNotDiffer output_root output2_gawk + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd