diff --git a/tests/smoke-functionality/Makefile b/tests/smoke-functionality/Makefile new file mode 100644 index 0000000..958ef8c --- /dev/null +++ b/tests/smoke-functionality/Makefile @@ -0,0 +1,43 @@ +TOPLEVEL_NAMESPACE=/CoreOS +PACKAGE_NAME=opal-prd +RELATIVE_PATH=smoke-functionality + +export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) +export TESTVERSION=1.0 + +BUILT_FILES= +FILES=$(METADATA) runtest.sh Makefile + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + +# You may need to add other taregts e.g. to build executables from source code +# Add them here: + + +# Include Common Makefile +include /usr/share/rhts/lib/rhts-make.include + +# Generate the testinfo.desc here: +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Than Ngo " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: Basic sanity and function tests">> $(METADATA) + @echo "Type: Sanity and function" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) # add any other packages for which your test ought to run here + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) # add any other requirements for the script to run here + @echo "Requires: opal-prd" >> $(METADATA) + @echo "Requires: opal-utils" >> $(METADATA) + @echo "License: ASL 2.0" >> $(METADATA) diff --git a/tests/smoke-functionality/PURPOSE b/tests/smoke-functionality/PURPOSE new file mode 100644 index 0000000..bc65079 --- /dev/null +++ b/tests/smoke-functionality/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/opal-prd/smoke-functionality +Description: Smoke, Sanity and function tests +Author: Than Ngo diff --git a/tests/smoke-functionality/blank.bin b/tests/smoke-functionality/blank.bin new file mode 100644 index 0000000..c6cc6b8 Binary files /dev/null and b/tests/smoke-functionality/blank.bin differ diff --git a/tests/smoke-functionality/data-p9.bin b/tests/smoke-functionality/data-p9.bin new file mode 100644 index 0000000..f214165 Binary files /dev/null and b/tests/smoke-functionality/data-p9.bin differ diff --git a/tests/smoke-functionality/data1.bin b/tests/smoke-functionality/data1.bin new file mode 100644 index 0000000..aa5bf14 Binary files /dev/null and b/tests/smoke-functionality/data1.bin differ diff --git a/tests/smoke-functionality/runtest.sh b/tests/smoke-functionality/runtest.sh new file mode 100755 index 0000000..c365a69 --- /dev/null +++ b/tests/smoke-functionality/runtest.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# customize this where needed +PACKAGE="opal-prd opal-utils" +SERVICE="opal-prd" + +# source the test script helpers +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + for p in $PACKAGE ; do + rlAssertRpm $p + done + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "cp * $TmpDir" 0 "Copying test files" + rlRun "pushd $TmpDir" + rlPhaseEnd + rlPhaseStartTest "Smoke, sanity and function tests" + for i in getscom putscom opal-prd pflash; do + rlRun "/usr/sbin/$i -h" 0 "It ought show the usage" + done + for i in getscom putscom; do + rlRun "/usr/sbin/$i -v" 0 "It ought show the version" + done + rlAssertExists "/usr/lib/systemd/system/opal-prd.service" + # opal-prd only runs on bare-metal (powernv) machines + if [ -d /sys/firmware/devicetree/base/ibm,opal/diagnostics ] ; then + rlServiceStart $SERVICE + rlRun "systemctl status -l $SERVICE" + rlServiceStop $SERVICE + fi + rlRun "/usr/sbin/opal-gard -p -e -8 -f data1.bin list" 0 + rlRun "/usr/sbin/opal-gard -p -e -8 -f data1.bin show 1" 0 + rlRun "/usr/sbin/opal-gard -p -e -f data-p9.bin --p9 show 1" 0 + rlRun "/usr/sbin/opal-gard -p -e -f blank.bin create $TmpDir/doesnt_exist0" "1-255" "It ought to be failed" + rlPhaseEnd + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -fr $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..574643b --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,13 @@ +--- +# Tests that run in classic context +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + tests: + - smoke-functionality + required_packages: + - findutils # beakerlib needs find command + - opal-prd + - opal-utils