Initial commit for downstream tests using standard test interface

This commit is contained in:
Rachel Sibley 2017-09-26 15:38:33 -04:00
parent 57e494a406
commit 640527e993
5 changed files with 148 additions and 0 deletions

0
tests/README.rst Normal file
View File

63
tests/sys/Makefile Normal file
View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/python/sys
# Description: Sanity test for the sys module
# Author: Petr Splichal <psplicha@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/python/sys
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)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Petr Splichal <psplicha@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Sanity test for the sys module" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: python" >> $(METADATA)
@echo "Requires: python" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

8
tests/sys/PURPOSE Normal file
View File

@ -0,0 +1,8 @@
PURPOSE of /CoreOS/python/sys
Description: Sanity test for the sys module
Author: Petr Splichal <psplicha@redhat.com>
Basic sanity test for the sys module. For now included just coverage for
(sys.platform == "linux2") also on machines running Linux 3 kernels
for python2.7 and python3.2. Starting with python3.3, sys.platform will be just
"linux". See http://bugs.python.org/issue12326

63
tests/sys/runtest.sh Executable file
View File

@ -0,0 +1,63 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/python/sys
# Description: Sanity test for the sys module
# Author: Petr Splichal <psplicha@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
# Packages to be tested
PACKAGES="${PACKAGES:-python2}"
# Other required packages
REQUIRES=${REQUIRES:-}
# Binary name parametrized
PYTHON="${PYTHON:-python2}"
# print("linux2" if sys.version_info < (3, 3) else "linux") for python2.4 on RHEL5
PLATFORM_CMD='import sys; print(sys.version_info < (3, 3) and "linux2" or "linux")'
rlJournalStart
rlPhaseStartSetup
rlAssertRpm --all
rlAssertBinaryOrigin $PYTHON
rlRun "TMP=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TMP"
rlPhaseEnd
rlPhaseStartTest
rlRun -l "$PYTHON -V" 0 "Query version of the binary"
PLATFORM_STR=$($PYTHON -c "$PLATFORM_CMD")
rlRun "$PYTHON -c 'import sys; print(sys.platform)' | tee output" \
0 "Inspecting the value of sys.platform"
rlAssertGrep $PLATFORM_STR "output"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TMP" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

14
tests/tests.yml Normal file
View File

@ -0,0 +1,14 @@
---
# This first play always runs on the local staging system
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- atomic
- container
tests:
- sys
required_packages:
- python
- which