Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:openSUSE:QA:Tumbleweed
systemd-v237-testsuite
run-tests.sh
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File run-tests.sh of Package systemd-v237-testsuite
#!/bin/sh function cleanup { for id in 1 2 3; do [[ $(getent passwd systemdtestsuiteuser$id) ]] && userdel systemdtestsuiteuser$id [[ $(getent group systemdtestsuitegroup$id) ]] && groupdel systemdtestsuitegroup$id done for user in systemd-journal-upload systemd-journal-remote; do [[ $(getent passwd $user) ]] && userdel $user done for group in systemd-journal-upload systemd-journal-remote mail adm; do [[ $(getent group $group) ]] && groupdel $group done } function testsuiteprepare { VERSION=$(rpm -q systemd | sed -n 's/systemd-\([[:digit:]]*\).*/\1/p') echo "Preparing tests for version $VERSION" echo -e "\nChecking required packages\n" case "$VERSION" in 234|237) ARCH=$(uname -m) case $ARCH in x86_64|i*86) QEMU_PKG=qemu-x86 ;; ppc64*) QEMU_PKG="qemu-ppc qemu-vgabios" ;; s390x) QEMU_PKG=qemu-s390 ;; aarch64) QEMU_PKG=qemu-arm ;; esac progs="lz4 busybox qemu dhcp-client python3 plymouth yast2-firstboot binutils netcat-openbsd cryptsetup less $QEMU_PKG" [[ $VERSION == 237 ]] && progs+=" ninja quota ppp" for prog in $progs; do rpm -q $prog || zypper -n in --no-recommends "$prog" [[ $? -ne 0 ]] && { echo "error installing required packages"; exit 1; } done for id in 1 2 3; do [[ $(getent group systemdtestsuitegroup$id) ]] || groupadd -g $id systemdtestsuitegroup$id [[ $(getent passwd systemdtestsuiteuser$id) ]] || useradd -u $id -g $id systemdtestsuiteuser$id done for user in systemd-journal-upload systemd-journal-remote; do [[ $(getent passwd $user) ]] || useradd $user done for group in systemd-journal-upload systemd-journal-remote mail adm; do [[ $(getent group $group) ]] || groupadd $group done [[ -d /var/opt/systemd-tests/test/sys ]] || /var/opt/systemd-tests/sys-script.py /var/opt/systemd-tests/test ;; 228) zypper -n in python3-lxml || zypper in python3-lxml ;; 210) ;; *) echo "unknown systemd version: $VERSION" cleanup exit 1 ;; esac echo "" #increase test timeout on slow machines sed -i 's/QEMU_TIMEOUT=[[:digit:]]*/QEMU_TIMEOUT=300/' /var/opt/systemd-tests/test/TEST-*/test.sh #export testdata directory export SYSTEMD_TEST_DATA=/var/opt/systemd-tests/test #create input files for test-catalog for i in $(ls /var/opt/systemd-tests/catalog/systemd.*.in); do mv $i ${i%%.in}; done } function summary { ws='[ ]' results=$(echo logs/*.trs) [[ -n "$results" ]] || results=/dev/null all=`grep "^$ws*:test-result:" $results | wc -l` pass=`grep "^$ws*:test-result:$ws*PASS" $results | wc -l` fail=`grep "^$ws*:test-result:$ws*FAIL" $results | wc -l` skip=`grep "^$ws*:test-result:$ws*SKIP" $results | wc -l` xfail=`grep "^$ws*:test-result:$ws*XFAIL" $results | wc -l` xpass=`grep "^$ws*:test-result:$ws*XPASS" $results | wc -l` error=`grep "^$ws*:test-result:$ws*ERROR" $results | wc -l` if [ $(expr $fail + $xpass + $error) -eq 0 ]; then success=0; else success=1;\ fi echo echo "============================================================================" echo "Testsuite summary for systemd $VERSION" echo "============================================================================" echo -e "# TOTAL: $all" echo -e '\033[0;32m'"# PASS: $pass" echo -e '\033[1;34m'"# SKIP: $skip" #echo -e '\033[m'"# XFAIL: $xfail" echo -e '\033[0;31m'"# FAIL: $fail" #echo -e '\033[m'"# XPASS: $xpass" echo -e '\033[m'"# ERROR: $error" echo "============================================================================" echo -e "See logs/\$testname.log\n" } if [ "$1" == "--help" ]; then echo "Usage: ./run-tests.sh [--skip=\$tests]" echo " \$tests is a space separated list of test names" exit 0 fi [ -d logs ] || mkdir logs rm -f logs/* testsuiteprepare testfiles=$(echo test-*)" " testfiles+="test/udev-test.pl test/hwdb-test.sh test/rule-syntax-check.py hwdb/parse_hwdb.py test/sysv-generator-test.py" skiptests="test-coredump-vacuum test-qcow2 test-patch-uid test-ns test-hostname test-ask-password-api test-dissect-image test-ipcrm test-btrfs test-netlink-manual test-cgroup test-install test-udev test-nss test-bus-benchmark test-ipv4ll-manual test-acd test-inhibit " skiptests+="*.sh test-driver " for toskip in ${@##--skip=}; do [[ "$testfiles" =~ "$toskip" ]] && skiptests+=" $toskip" done echo -e "\nrunning basic tests\n" [[ -f /proc/sys/kernel/nmi_watchdog ]] && WD=$(cat /proc/sys/kernel/nmi_watchdog) [[ "$WD" == 1 ]] && echo 0 > /proc/sys/kernel/nmi_watchdog for test in $testfiles; do for skip in $skiptests; do [[ $skip == $test ]] && continue 2; done [[ "$test" == "test/rule-syntax-check.py" ]] && testname=rule-syntax-check-run.sh || testname=$test ./test-driver --test-name $testname --log-file logs/${test#*/}.log --trs-file logs/${test#*/}.trs --color-tests yes done if [ "$1" != "--all" ]; then summary exit $success fi [[ "$WD" == 1 ]] && echo 1 > /proc/sys/kernel/nmi_watchdog echo -e "\nrunning extended tests\n" #route package not available in openSUSE sed -i 's/route //' test/test-functions export TEST_BASE_DIR='/var/opt/systemd-tests/test' TESTDIR='none' for dir in $(echo test/TEST-*); do [[ "$dir" == "test/TEST-06-SELINUX" ]] && continue cd $dir sed -i '/SKIP_INITRD=yes/d' test.sh testname=$(basename $dir) ./test.sh --clean &> /dev/null ./test.sh --setup &> ${TEST_BASE_DIR%%/test}/logs/$testname-setup.log [[ $? == 0 ]] && ./test.sh --run &> ${TEST_BASE_DIR%%/test}/logs/$testname-run.log [[ $? == 0 ]] && TESTRES='\033[0;32m'"PASS" || TESTRES='\033[0;31m'"FAIL" echo -e "$TESTRES:" '\033[m'"$testname" echo ":test-result: ${TESTRES##*m}" > ${TEST_BASE_DIR%%/test}/logs/$testname.trs losetup -D TESTDIR=$(sed -n '/systemd-test.*system.journal/s/.*\(systemd-test.[[:alnum:]]*\)\/.*/\1/p' ${TEST_BASE_DIR%%/test}/logs/$testname-run.log) [[ -n "$TESTDIR" ]] && [[ "$TESTRES" =~ "PASS" ]] && rm -rf /var/tmp/$TESTDIR &>/dev/null cd ${TEST_BASE_DIR%%/test} done summary cleanup exit $success
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor