Add gating on tests

This commit is contained in:
Than Ngo 2019-03-20 16:58:07 +01:00
parent 5a59f5b638
commit 5722dda487
7 changed files with 103 additions and 0 deletions

View File

@ -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 <than@redhat.com>" > $(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)

View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/opal-prd/smoke-functionality
Description: Smoke, Sanity and function tests
Author: Than Ngo <than@redhat.com>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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

13
tests/tests.yml Normal file
View File

@ -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