This is an automated email from the git hooks/post-receive script. jforbes pushed a commit to branch master in repository kernel-tests. commit f0a42c3710acf79d236a1693334849016dbd1d48 Author: Justin M. Forbes <jforbes@xxxxxxxxxx> Date: Fri May 25 12:48:54 2012 -0500 initial commit for fedorahosted tree --- default/defaultpass/runtest.sh | 5 ++ destructive/destructivepass/runtest.sh | 5 ++ documentation.txt | 79 ++++++++++++++++++++++++++++ minimal/minimalfail/runtest.sh | 5 ++ minimal/minimalpass/runtest.sh | 5 ++ minimal/minimalskip/runtest.sh | 5 ++ runtests.sh | 96 ++++++++++++++++++++++++++++++++++ stress/stresspass/runtest.sh | 5 ++ 8 files changed, 205 insertions(+) diff --git a/default/defaultpass/runtest.sh b/default/defaultpass/runtest.sh new file mode 100755 index 0000000..b44a7a7 --- /dev/null +++ b/default/defaultpass/runtest.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "sample test from the default directory, should always pass" + +exit 0 diff --git a/destructive/destructivepass/runtest.sh b/destructive/destructivepass/runtest.sh new file mode 100755 index 0000000..53a6967 --- /dev/null +++ b/destructive/destructivepass/runtest.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "sample test from the destructive directory, should always pass" + +exit 0 diff --git a/documentation.txt b/documentation.txt new file mode 100644 index 0000000..d731eaf --- /dev/null +++ b/documentation.txt @@ -0,0 +1,79 @@ +=== Running Tests === + +In the simplest of terms, simply run the runtests.sh script with no arguments. +This will run the default tests, which include all tests in the minimal and +default directories. Right now the only supported arg is -t <testset> which +will specify a different test set to run. Valid test sets are: + +minimal - only runs tests in the minimal directory +default - runs tests in both minimal and default +stress - runs tests in minimal, default, and stress +destructive - runs tests in minimal, default, and destructive + +If you choose destructive it will ask if you are sure. If you say no, it will +run default instead. More descriptive output should be in the logfile, in the +logs directory. + +=== Writing Tests === + +While a test can actually be any sort of executable, it is expected that +these tests will follow certain basic criteria. This helps to ensure that +the test suite is easy to interpret. The output is controlled by the +master script, and output is in the form of pass, fail, or skipped. All +other output is redirected to the log file. + +Return Codes: +0 - A successful test completion +3 - Test skipped +Anything else is interpreted as fail and the user is asked to check the log +for more details. + +Clean up: +Each test should clean up after itself. Residue from a test should never +impact any other test. If you are creating something, destroy it when you +finish. + +Directory Structure: +Each test should be contained in a unique directory within the appropriate +top level. The directory must contain an executable 'runtest.sh' which will +drive the specific test. There is no guarantee on the order of execution. +Each test should be fully independent, and have no dependency on other tests. +The top level directories are reflective of how the master test suite is called. +Each option is a super-set of the options before it. At this time we have: + +minimal: This directory should include small, fast, and important tests +which would should be run on every system. + +default: This directory will include most tests which are not destructive, +or particularly long to run. When a user runs with no flags, all tests in +both default and minimal will be run. + +stress: This directory will include longer running and more resource intensive +tests which a user might not want to run in the common case due to time or +resource constraints. + +destructive: This directory contains tests which have a higher probability of +causing harm to a system even in the pass case. This would include things +like potential for data loss. + +Test Execution: +Each test is executed by the control script by calling runtest.sh. stdout +and stderr are both redirected to the log. Any user running with default +flags should see nothing but the name of the directory and pass/fail/skip. +The runtest.sh should manage the full test run. This includes compiling +any necessary source, checking for any specific dependencies, and skipping +if they are not met. + +Potential for harm: +It is expected that these test will be run on real systems. Any tests +which have increased risk of data loss or ill effects should be specified +destructive, and placed in the destructive directory. Users wishing to run +the full destructive test run are prompted loudly before it continues. The +last thing we want to do is make ordinary users afraid to run the test +suite. + +Utility: +As a large number of tests are written as simple shell scripts, and many of +these tests need to perform a series of the same functions, a "library" has +been created to allow for reuse. source the testutil file as needed. Any +functions added to testutil should be clearly commented with purpose and use. diff --git a/minimal/minimalfail/runtest.sh b/minimal/minimalfail/runtest.sh new file mode 100755 index 0000000..45312b3 --- /dev/null +++ b/minimal/minimalfail/runtest.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "sample test from the minimal directory, should always pass" + +exit 32 diff --git a/minimal/minimalpass/runtest.sh b/minimal/minimalpass/runtest.sh new file mode 100755 index 0000000..20905d4 --- /dev/null +++ b/minimal/minimalpass/runtest.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "sample test from the minimal directory, should always pass" + +exit 0 diff --git a/minimal/minimalskip/runtest.sh b/minimal/minimalskip/runtest.sh new file mode 100755 index 0000000..bc139dc --- /dev/null +++ b/minimal/minimalskip/runtest.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "sample test from the minimal directory, should always skip" + +exit 3 diff --git a/runtests.sh b/runtests.sh new file mode 100755 index 0000000..5a86dec --- /dev/null +++ b/runtests.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +date=$(date +%s) +topdir=$(pwd) +logfile=$topdir/logs/kernel-test-$date.log +verbose=n +testset=default + +kver=$(uname -r) +release=$(cat /etc/redhat-release) + + +args=y + +while [ $args = y ] +do + case "$1" in + -v) + #TO DO: Implement verbose behavior + verbose=y + shift 1 + ;; + -t) + testset=$2 + shift 2 + ;; + *) + args=n + esac +done + +case $testset in +minimal) + dirlist="minimal" + ;; +default) + dirlist="minimal default" + ;; +stress) + dirlist="minimal default stress" + ;; +destructive) + echo "You have specified the destructive test set" + echo "This test may cause damage to your system" + echo "Are you sure that you wish to continue?" + read continue + if [ $continue == 'y' ] ; then + dirlist="minimal default destructive" + else + dirlist="minimal default" + testset=default + fi + ;; +*) + echo "supported test sets are minimal default stress or destructive" + exit 1 +esac + + +#Basic logfile headers +echo "Date: $(date)" > $logfile +echo "Test set: $testset" >> $logfile +echo "Kernel: $kver" >> $logfile +echo "Release: $release" >> $logfile +echo "============================================================" >>$logfile + + + +#Start running tests +echo "Test suite called with $testset" + +for dir in $dirlist +do + for test in $(find ./$dir/ -name runtest.sh) + do + testdir=$(dirname $test) + pushd $testdir &>/dev/null + #TO DO: purpose file test name format + testname=$testdir + echo "Starting test $testname" >> $logfile + ./runtest.sh &>>$logfile + complete=$? + case $complete in + 0) + result=PASS + ;; + 3) + result=SKIP + ;; + *) + result=FAIL + esac + printf "%-65s%-8s\n" "$testname" "$result" + popd &>/dev/null + done +done diff --git a/stress/stresspass/runtest.sh b/stress/stresspass/runtest.sh new file mode 100755 index 0000000..1bebc72 --- /dev/null +++ b/stress/stresspass/runtest.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "sample test from the stress directory, should always pass" + +exit 0 -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ kernel mailing list kernel@xxxxxxxxxxxxxxxxxxxxxxx https://lists.fedoraproject.org/admin/lists/kernel@xxxxxxxxxxxxxxxxxxxxxxx