From 73251c52758d4881acfbb47d9b401e04af0663ea Mon Sep 17 00:00:00 2001 From: Rachel Sibley Date: Sep 26 2017 18:43:27 +0000 Subject: Initial commit for downstream tests using standard test interface --- diff --git a/tests/sys/Makefile b/tests/sys/Makefile new file mode 100644 index 0000000..848171d --- /dev/null +++ b/tests/sys/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/python/sys +# Description: Sanity test for the sys module +# Author: Petr Splichal +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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 " > $(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) diff --git a/tests/sys/PURPOSE b/tests/sys/PURPOSE new file mode 100644 index 0000000..e47649d --- /dev/null +++ b/tests/sys/PURPOSE @@ -0,0 +1,8 @@ +PURPOSE of /CoreOS/python/sys +Description: Sanity test for the sys module +Author: Petr Splichal + +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 diff --git a/tests/sys/runtest.sh b/tests/sys/runtest.sh new file mode 100755 index 0000000..51ff516 --- /dev/null +++ b/tests/sys/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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:-python3}" +# Other required packages +REQUIRES=${REQUIRES:-} +# Binary name parametrized +PYTHON="${PYTHON:-python3}" + +# 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 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..a5716a2 --- /dev/null +++ b/tests/tests.yml @@ -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