diff options
author | Cy Schubert <cy@FreeBSD.org> | 2022-01-17 15:48:49 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2022-01-17 15:48:49 +0000 |
commit | 03f33dd0772867358dffaf3a8b5ddf42842aaf55 (patch) | |
tree | c9ae839eab1522fe3ea6145ea085ab3f58049441 /tests/hwsim/vm | |
parent | 7b54fad80747371c628e848d3cc53ea9a5e21c14 (diff) | |
download | src-vendor/wpa/2.10.tar.gz src-vendor/wpa/2.10.zip |
wpa: Import wpa 2.10vendor/wpa/2.10
The long awaited wpa 2.10 is finally here.
Diffstat (limited to 'tests/hwsim/vm')
-rw-r--r-- | tests/hwsim/vm/.gitignore | 1 | ||||
-rw-r--r-- | tests/hwsim/vm/README | 80 | ||||
-rwxr-xr-x | tests/hwsim/vm/bisect-run.sh | 43 | ||||
-rwxr-xr-x | tests/hwsim/vm/build-codecov.sh | 57 | ||||
-rwxr-xr-x | tests/hwsim/vm/combine-codecov.sh | 39 | ||||
-rw-r--r-- | tests/hwsim/vm/dbus.conf | 34 | ||||
-rw-r--r-- | tests/hwsim/vm/example-vm-setup.txt | 95 | ||||
-rwxr-xr-x | tests/hwsim/vm/inside.sh | 171 | ||||
-rw-r--r-- | tests/hwsim/vm/kernel-config | 175 | ||||
-rw-r--r-- | tests/hwsim/vm/kernel-config.uml | 131 | ||||
-rwxr-xr-x | tests/hwsim/vm/parallel-vm.py | 669 | ||||
-rwxr-xr-x | tests/hwsim/vm/process-codecov.sh | 36 | ||||
-rw-r--r-- | tests/hwsim/vm/regdb/regulatory.db | bin | 4036 -> 0 bytes | |||
-rw-r--r-- | tests/hwsim/vm/regdb/regulatory.db.p7s | bin | 1182 -> 0 bytes | |||
-rwxr-xr-x | tests/hwsim/vm/uevent.sh | 9 | ||||
-rwxr-xr-x | tests/hwsim/vm/vm-run.sh | 202 |
16 files changed, 0 insertions, 1742 deletions
diff --git a/tests/hwsim/vm/.gitignore b/tests/hwsim/vm/.gitignore deleted file mode 100644 index b1ce1b1050f5..000000000000 --- a/tests/hwsim/vm/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vm-config diff --git a/tests/hwsim/vm/README b/tests/hwsim/vm/README deleted file mode 100644 index 224d65a26109..000000000000 --- a/tests/hwsim/vm/README +++ /dev/null @@ -1,80 +0,0 @@ -These scripts allow you to run the hwsim tests inside a KVM virtual machine or -as a UML (User Mode Linux) program. - -To set it up, first compile a kernel with the kernel-config[.uml] file as the -.config. You can adjust it as needed, the configuration is for a 64-bit x86 -system and should be close to minimal. The architecture must be the same as -your host since the host's filesystem is used. - -To build the regular x86_64 kernel, simply issue - -yes "" | make -j <n_cpus> - -or to build UML: - -yes "" | ARCH=um make -j <n_cpus> - -Running a UML kernel is recommended as it can optimize out any sleep()s or -kernel timers by taking advantage of UML time travel mode, greatly increasing -test efficiency (~3200 tests can be run in under 5 minutes using parallel-vm.py -on a 24 core CPU). - -Install the required tools: at least 'kvm', if you want tracing trace-cmd, -valgrind if you want, etc. - -Compile the hwsim tests as per the instructions given, you may have to -install some extra development packages (e.g. binutils-dev for libbfd). - -Create a vm-config file and put the KERNELDIR option into it (see the -vm-run.sh script). If you want valgrind, also increase the memory size. - -Now you can run the vm-run.sh script and it will execute the tests using -your system's root filesystem (read-only) inside the VM. The options you -give it are passed through to run-all.sh, see there. - -To speed up testing, it is possible to run multiple VMs concurrently and -split the test cases between all the VMs. If the host system has enough -memory and CPU resources, this can significantly speed up the full test -cycle. For example, a 4 core system with 4 GB of RAM can easily run 8 -parallel VMs (assuming valgrind is not used with its higher memory -requirements). This can be run with: - -./parallel-vm.py <number of VMs> [arguments..] - - --------------------------------------------------------------------------------- - -Code Coverage Analysis for user space code - -Code coverage for wpa_supplicant and hostapd can be generated from the -test run with following command line: - -./vm-run.sh --codecov [other arguments..] - -This builds a separate copies of wpa_supplicant and hostapd into a -directory that is writable from the virtual machine to collect the gcov -data. lcov is then used to prepare the reports at the end of the test -run. - - -Code Coverage Analysis for kernel code - -In order to do code coverage analysis, reconfigure the kernel to include - -CONFIG_GCOV_KERNEL=y -CONFIG_GCOV_PROFILE_ALL=y - -Note that for gcc 4.7, kernel version 3.13-rc1 or higher is required. - -The scripts inside the VM will automatically copy the gcov data out of the -VM into the logs directory. To post-process this data, you'll want to use -lcov and run - -cd /tmp/hwsim-test-logs/<timestamp> -lcov -b <path to kernel dir> -c -d gcov/ > gcov/data -genhtml -o html/ gcov/data - -Then open html/index.html in your browser. - -Note that in this case you need to keep your build and source directories -across the test run (otherwise, it's safe to only keep the kernel image.) diff --git a/tests/hwsim/vm/bisect-run.sh b/tests/hwsim/vm/bisect-run.sh deleted file mode 100755 index fa511073f0db..000000000000 --- a/tests/hwsim/vm/bisect-run.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -set -e - -path="$(dirname $0)" - -test="$1" -makedir="$2" -if [ -z $test ] ; then - echo "This script helps bisect test failures, given a test case." - echo "" - echo "Use it like this:" - echo " git bisect start" - echo " git bisect bad <commit>" - echo " git bisect good <commit>" - echo " git bisect run $0 <test name> [<compile directory>]" - echo "" - echo "(the compile directory is optional, use it if you want to" - echo "use an out-of-tree kernel build." - echo "" - echo "Note that, of course, you have to have a working vm-run setup." - exit 200 # exit git bisect run if called that way -fi - -if [ -n "$makedir" ] ; then - cd "$makedir" -fi - -yes '' | make oldconfig || exit 125 -make -j8 || exit 125 - -output=$(mktemp) -if [ $? -ne 0 ] ; then - exit 202 -fi -finish() { - rm -f $output -} -trap finish EXIT - -"$path/vm-run.sh" $test 2>&1 | tee $output - -grep -q 'ALL-PASSED' $output && exit 0 || exit 1 diff --git a/tests/hwsim/vm/build-codecov.sh b/tests/hwsim/vm/build-codecov.sh deleted file mode 100755 index e67ef2ea8e0e..000000000000 --- a/tests/hwsim/vm/build-codecov.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -LOGDIR=$1 -DIR=$PWD -TMPDIR=/tmp/logs - -if [ -e $TMPDIR ]; then - echo "$TMPDIR exists - cannot prepare build trees" - exit 1 -fi -mkdir $TMPDIR -echo "Preparing separate build trees for hostapd/wpa_supplicant" -cd ../../.. -git archive --format=tar --prefix=hostap/ HEAD > $TMPDIR/hostap.tar -cd $DIR -cat ../../../wpa_supplicant/.config > $TMPDIR/wpa_supplicant.config -echo "CONFIG_CODE_COVERAGE=y" >> $TMPDIR/wpa_supplicant.config -cat ../../../hostapd/.config > $TMPDIR/hostapd.config -echo "CONFIG_CODE_COVERAGE=y" >> $TMPDIR/hostapd.config - -cd $TMPDIR -tar xf hostap.tar -mv hostap alt-wpa_supplicant -mv wpa_supplicant.config alt-wpa_supplicant/wpa_supplicant/.config -tar xf hostap.tar -mv hostap alt-hostapd -cp hostapd.config alt-hostapd/hostapd/.config -tar xf hostap.tar -mv hostap alt-hostapd-as -cp hostapd.config alt-hostapd-as/hostapd/.config -tar xf hostap.tar -mv hostap alt-hlr_auc_gw -mv hostapd.config alt-hlr_auc_gw/hostapd/.config -rm hostap.tar - -cd $TMPDIR/alt-wpa_supplicant/wpa_supplicant -echo "Building wpa_supplicant" -make -j8 > /dev/null - -cd $TMPDIR/alt-hostapd/hostapd -echo "Building hostapd" -make -j8 hostapd hostapd_cli > /dev/null - -cd $TMPDIR/alt-hostapd-as/hostapd -echo "Building hostapd (AS)" -make -j8 hostapd hostapd_cli > /dev/null - -cd $TMPDIR/alt-hlr_auc_gw/hostapd -echo "Building hlr_auc_gw" -make -j8 hlr_auc_gw > /dev/null - -cd $DIR - -mv $TMPDIR/alt-wpa_supplicant $LOGDIR -mv $TMPDIR/alt-hostapd $LOGDIR -mv $TMPDIR/alt-hostapd-as $LOGDIR -mv $TMPDIR/alt-hlr_auc_gw $LOGDIR diff --git a/tests/hwsim/vm/combine-codecov.sh b/tests/hwsim/vm/combine-codecov.sh deleted file mode 100755 index 309125f22b7b..000000000000 --- a/tests/hwsim/vm/combine-codecov.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -LOGDIR=$1 -if [ -n "$2" ]; then - ODIR=$2 -else - ODIR=. -fi -TMPDIR=/tmp/logs - -mv $LOGDIR/alt-* $TMPDIR - -cd $TMPDIR -args="" -for i in lcov-*.info-*; do - args="$args -a $i" -done - -lcov $args -o $LOGDIR/combined.info > $LOGDIR/combined-lcov.log 2>&1 -cat $LOGDIR/combined.info | - sed "/^TN:$/{N;s/TN:\n\(SF:.*\/bits\/byteswap.h$\)/\1/};/^SF:.*\/bits\/byteswap.h$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*\/openssl\/x509.h$\)/\1/};/^SF:.*\/openssl\/x509.h$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*\/openssl\/x509v3.h$\)/\1/};/^SF:.*\/openssl\/x509v3.h$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*\/common\/wpa_ctrl.c$\)/\1/};/^SF:.*\/common\/wpa_ctrl.c$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*\/common\/cli.c$\)/\1/};/^SF:.*\/common\/cli.c$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*\/utils\/edit.c$\)/\1/};/^SF:.*\/utils\/edit.c$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*_module_tests.c$\)/\1/};/^SF:.*_module_tests.c$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*\/hostapd\/hostapd_cli.c$\)/\1/};/^SF:.*\/hostapd\/hostapd_cli.c$/,/^end_of_record$/d" | - sed "/^TN:$/{N;s/TN:\n\(SF:.*wpa_supplicant\/wpa_cli.c$\)/\1/};/^SF:.*wpa_supplicant\/wpa_cli.c$/,/^end_of_record$/d" > $LOGDIR/combined.info.filtered - -cd $LOGDIR -genhtml -t "wpa_supplicant/hostapd combined for hwsim test run $(date +%s)" combined.info.filtered --output-directory $ODIR > lcov.log 2>&1 - -rm -r /tmp/logs/alt-wpa_supplicant -rm -r /tmp/logs/alt-hostapd -rm -r /tmp/logs/alt-hostapd-as -rm -r /tmp/logs/alt-hlr_auc_gw -rm /tmp/logs/lcov-*info-* -rmdir /tmp/logs diff --git a/tests/hwsim/vm/dbus.conf b/tests/hwsim/vm/dbus.conf deleted file mode 100644 index 1f3b56353c88..000000000000 --- a/tests/hwsim/vm/dbus.conf +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -<busconfig> - <type>system</type> - <user>messagebus</user> - <fork/> - <standard_system_servicedirs/> - <servicehelper>/usr/lib/dbus-1.0/dbus-daemon-launch-helper</servicehelper> - <pidfile>/var/run/dbus/pid</pidfile> - <auth>EXTERNAL</auth> - <listen>unix:path=/var/run/dbus/system_bus_socket</listen> - <policy context="default"> - <allow user="*"/> - <deny own="*"/> - <deny send_type="method_call"/> - <allow send_type="signal"/> - <allow send_requested_reply="true" send_type="method_return"/> - <allow send_requested_reply="true" send_type="error"/> - <allow receive_type="method_call"/> - <allow receive_type="method_return"/> - <allow receive_type="error"/> - <allow receive_type="signal"/> - <allow send_destination="org.freedesktop.DBus"/> - <deny send_destination="org.freedesktop.DBus" - send_interface="org.freedesktop.DBus" - send_member="UpdateActivationEnvironment"/> - </policy> - <policy user="root"> - <allow own="fi.w1.wpa_supplicant1"/> - <allow send_destination="fi.w1.wpa_supplicant1"/> - <allow send_interface="fi.w1.wpa_supplicant1"/> - <allow receive_sender="fi.w1.wpa_supplicant1" receive_type="signal"/> - </policy> -</busconfig> diff --git a/tests/hwsim/vm/example-vm-setup.txt b/tests/hwsim/vm/example-vm-setup.txt deleted file mode 100644 index 81e2dfdb9ffe..000000000000 --- a/tests/hwsim/vm/example-vm-setup.txt +++ /dev/null @@ -1,95 +0,0 @@ -Step-by-step guide for setting up hostapd/wpa_supplicant test framework (VM) ----------------------------------------------------------------------------- - -This document can be used as a quick guide for getting started with -hostapd/wpa_supplicant test framework with mac80211_hwsim. While the -example here uses Ubuntu 16.04.1 server to have a list of exact steps, -there are no requirements for using that specific distribution in the -testing setup. - -The steps here describe how to run a guest VM for testing on a Linux -host system. - - -Install Ubuntu Server 16.04.1 as the host system for VMs - -- download installation image, e.g., - http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-server-amd64.iso -- install the host system with default settings -- boot to the installed system -- update the installed packages: - sudo apt update - sudo apt upgrade - - -Install the prerequisite packages that may not have been installed by default - -# kvm for running the VM guests -sudo apt install qemu-kvm - -# build tools -sudo apt install build-essential git libpcap-dev libsqlite3-dev binutils-dev \ - bc pkg-config libssl-dev libiberty-dev libdbus-1-dev \ - libnl-3-dev libnl-genl-3-dev libnl-route-3-dev - -# tools used be the test scripts -sudo apt install python-minimal python-crypto python-pyrad python-netifaces \ - python-dbus python-gobject python-openssl bridge-utils ebtables tshark - - -Enable kvm use for the user - -sudo adduser $USER kvm - - -Download a snapshot of the hostap.git repository and build the programs - -cd -git clone git://w1.fi/hostap.git -cd hostap/tests/hwsim -./build.sh -cd vm -cat > vm-config <<EOF -KERNELDIR=~/wireless-testing -MEMORY=512 -KVMARGS="-cpu host" -EOF - - -Build a Linux kernel for testing - -cd -git clone git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git -cd wireless-testing -cp ~/hostap/tests/hwsim/vm/kernel-config .config -make oldconfig -make -j8 - - -Setup is now ready for testing. You can run a quick test to confirm that -things work as expected: - -cd ~/hostap/tests/hwsim/vm -./vm-run ap_open - -This should print out following style results: - -Starting test run in a virtual machine -./run-all.sh: passing the following args to run-tests.py: ap_open -START ap_open 1/1 -PASS ap_open 0.924019 2017-01-28 20:20:12.137717 -passed all 1 test case(s) -ALL-PASSED - -Test run completed -Logfiles are at /tmp/hwsim-test-logs/1485634801 - -(If that "PASS ap_open" line does not show up, something unexpected has -happened and the setup is not in working condition.) - - -To run all available test cases in 7 parallel VMs, you can run -following: - -cd ~/hostap/tests/hwsim/vm -./parallel-vm.py 7 diff --git a/tests/hwsim/vm/inside.sh b/tests/hwsim/vm/inside.sh deleted file mode 100755 index bfcbda631e4f..000000000000 --- a/tests/hwsim/vm/inside.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/sh - -# keep old /etc -mount tmpfs -t tmpfs /tmp -mkdir /tmp/etc -mount --bind /etc /tmp/etc -# mount all kinds of things -mount tmpfs -t tmpfs /etc -# we need our own /dev/rfkill, and don't want device access -mount tmpfs -t tmpfs /dev -# some sockets go into /var/run, and / is read-only -mount tmpfs -t tmpfs /var/run -mount proc -t proc /proc -mount sysfs -t sysfs /sys -# needed for tracing -mount debugfs -t debugfs /sys/kernel/debug - -mkdir /tmp/wireshark-share -mount --bind /usr/share/wireshark /tmp/wireshark-share -mount tmpfs -t tmpfs /usr/share/wireshark - -# for inside telnet -mkdir /dev/pts -mount devpts -t devpts /dev/pts - -export PATH=/usr/sbin:$PATH -export HOME=/tmp - -# reboot on any sort of crash -sysctl kernel.panic_on_oops=1 -sysctl kernel.panic=1 - -# get extra command line variables from /proc/cmdline -TESTDIR=$(sed 's/.*testdir=\([^ ]*\) .*/\1/' /proc/cmdline) -TIMEWARP=$(sed 's/.*timewarp=\([^ ]*\) .*/\1/' /proc/cmdline) -EPATH=$(sed 's/.*EPATH=\([^ ]*\) .*/\1/' /proc/cmdline) -TELNET=$(sed 's/.*TELNET=\([^ ]*\) .*/\1/' /proc/cmdline) -ARGS=$(sed 's/.*ARGS=\([^ ]*\)\( \|$\).*/\1/' /proc/cmdline) -LOGDIR=$(sed 's/.*LOGDIR=\([^ ]*\)\( \|$\).*/\1/' /proc/cmdline) - -mount --bind "$TESTDIR/vm/regdb/" /lib/firmware - -# create /dev entries we need -mknod -m 660 /dev/ttyS0 c 4 64 -mknod -m 666 /dev/ptmx c 5 2 -mknod -m 660 /dev/random c 1 8 -mknod -m 660 /dev/urandom c 1 9 -mknod -m 666 /dev/null c 1 3 -mknod -m 666 /dev/kmsg c 1 11 -test -f /sys/class/misc/rfkill/dev && \ - mknod -m 660 /dev/rfkill c $(cat /sys/class/misc/rfkill/dev | tr ':' ' ') -ln -s /proc/self/fd/0 /dev/stdin -ln -s /proc/self/fd/1 /dev/stdout -ln -s /proc/self/fd/2 /dev/stderr - -echo "VM has started up" > /dev/ttyS0 - -# create stub sudo - everything runs as uid 0 -mkdir /tmp/bin -cat > /tmp/bin/sudo << EOF -#!/bin/bash - -exec "\$@" -EOF -chmod +x /tmp/bin/sudo -# and put it into $PATH, as well as our extra-$PATH -export PATH=/tmp/bin:$EPATH:$PATH - -# some tests assume adm/admin group(s) exist(s) -cat > /etc/group <<EOF -adm:x:0: -admin:x:0: -messagebus:x:106: -EOF -# root should exist -cat > /etc/passwd <<EOF -root:x:0:0:root:/tmp:/bin/bash -messagebus:x:102:106::/var/run/dbus:/bin/false -EOF -cat > /etc/ethertypes <<EOF -IPv4 0800 ip ip4 -ARP 0806 ether-arp -IPv6 86DD ip6 -EOF -cat > /etc/protocols <<EOF -ip 0 IP -icmp 1 ICMP -tcp 6 TCP -udp 17 UDP -ipv6-icmp 58 IPv6-ICMP -EOF - -# we may need /etc/alternatives, at least on Debian-based systems -ln -s /tmp/etc/alternatives /etc/ - -# local network is needed for some tests -ip link set lo up - -# create logs mountpoint and mount the logshare -mkdir /tmp/logs -if grep -q rootfstype=hostfs /proc/cmdline; then - mount -t hostfs none /tmp/logs -o $LOGDIR -else - mount -t 9p -o trans=virtio,rw logshare /tmp/logs -fi - -# allow access to any outside directory (e.g. /tmp) we also have -mkdir /tmp/host -mount --bind / /tmp/host - -if [ "$TIMEWARP" = "1" ] ; then - ( - while sleep 1 ; do - date --set "@$(($(date +%s) + 19))" - done - ) & -fi - -echo hwsimvm > /proc/sys/kernel/hostname -echo 8 8 8 8 > /proc/sys/kernel/printk - -cat > /tmp/bin/login <<EOF -#!/bin/sh - -export PS1='\h:\w\$ ' -exec bash -EOF -chmod +x /tmp/bin/login - -if [ "$TELNET" = "1" ] ; then - ip link set eth0 up - ip addr add 172.16.0.15/24 dev eth0 - which in.telnetd >/dev/null && ( - while true ; do - in.telnetd -debug 23 -L /tmp/bin/login - done - ) & -fi - -# check if we're rebooting due to a kernel panic ... -if grep -q 'Kernel panic' /tmp/logs/console ; then - echo "KERNEL CRASHED!" >/dev/ttyS0 -else - # finally run the tests - export USER=0 - export LOGDIR=/tmp/logs - export DBFILE=$LOGDIR/results.db - export PREFILL_DB=y - - # some tests need CRDA, install a simple uevent helper - # and preload the 00 domain it will have asked for already - echo $TESTDIR/vm/uevent.sh > /sys/kernel/uevent_helper - COUNTRY=00 crda - - mkdir -p /var/run/dbus - touch /var/run/dbus/hwsim-test - chown messagebus.messagebus /var/run/dbus - dbus-daemon --config-file=$TESTDIR/vm/dbus.conf --fork - - cd $TESTDIR - ./run-all.sh --vm $(cat /tmp/host$ARGS) </dev/ttyS0 >/dev/ttyS0 2>&1 - if test -d /sys/kernel/debug/gcov ; then - cp -ar /sys/kernel/debug/gcov /tmp/logs/ - # these are broken as they're updated while being read ... - find /tmp/logs/gcov/ -wholename '*kernel/gcov/*' -print0 | xargs -0 rm - fi - #bash </dev/ttyS0 >/dev/ttyS0 2>&1 -fi - -# and shut down the machine again -halt -f -p diff --git a/tests/hwsim/vm/kernel-config b/tests/hwsim/vm/kernel-config deleted file mode 100644 index 2aff20af49ad..000000000000 --- a/tests/hwsim/vm/kernel-config +++ /dev/null @@ -1,175 +0,0 @@ -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_KERNEL_BZIP2=y -# CONFIG_SWAP is not set -CONFIG_SYSVIPC=y -# CONFIG_CROSS_MEMORY_ATTACH is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y -CONFIG_PREEMPT=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_TASKSTATS=y -CONFIG_TASK_DELAY_ACCT=y -CONFIG_TASK_XACCT=y -CONFIG_TASK_IO_ACCOUNTING=y -CONFIG_LOG_BUF_SHIFT=21 -CONFIG_NAMESPACES=y -# CONFIG_FHANDLE is not set -CONFIG_EMBEDDED=y -# CONFIG_COMPAT_BRK is not set -CONFIG_SMP=y -# CONFIG_X86_EXTENDED_PLATFORM is not set -CONFIG_HYPERVISOR_GUEST=y -CONFIG_PARAVIRT=y -CONFIG_PARAVIRT_SPINLOCKS=y -CONFIG_MCORE2=y -CONFIG_GART_IOMMU=y -CONFIG_NR_CPUS=4 -# CONFIG_X86_MCE is not set -CONFIG_MICROCODE_OLD_INTERFACE=y -# CONFIG_MTRR_SANITIZER is not set -# CONFIG_SECCOMP is not set -CONFIG_HZ_100=y -# CONFIG_RELOCATABLE is not set -CONFIG_PHYSICAL_ALIGN=0x1000000 -CONFIG_LEGACY_VSYSCALL_EMULATE=y -# CONFIG_SUSPEND is not set -# CONFIG_ACPI_AC is not set -# CONFIG_ACPI_BATTERY is not set -# CONFIG_ACPI_BUTTON is not set -# CONFIG_ACPI_FAN is not set -CONFIG_CPU_IDLE_GOV_LADDER=y -# CONFIG_PCI_MMCONFIG is not set -# CONFIG_ISA_DMA_API is not set -# CONFIG_DMIID is not set -# CONFIG_VIRTUALIZATION is not set -CONFIG_JUMP_LABEL=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -CONFIG_MAC_PARTITION=y -# CONFIG_COMPACTION is not set -# CONFIG_BOUNCE is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=65536 -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -CONFIG_IP_MULTIPLE_TABLES=y -# CONFIG_INET_DIAG is not set -CONFIG_NETFILTER=y -CONFIG_BRIDGE_NETFILTER=y -CONFIG_NF_TABLES=y -CONFIG_NETFILTER_XTABLES=y -CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y -CONFIG_NF_TABLES_BRIDGE=y -CONFIG_BRIDGE_NF_EBTABLES=y -CONFIG_BRIDGE_EBT_T_FILTER=y -CONFIG_BRIDGE_EBT_ARP=y -CONFIG_BRIDGE_EBT_IP=y -CONFIG_BRIDGE_EBT_IP6=y -CONFIG_BRIDGE_EBT_PKTTYPE=y -CONFIG_BRIDGE_EBT_ARPREPLY=y -CONFIG_BRIDGE=y -CONFIG_VLAN_8021Q=y -CONFIG_CFG80211=y -CONFIG_CFG80211_DEVELOPER_WARNINGS=y -CONFIG_CFG80211_DEBUGFS=y -CONFIG_CFG80211_WEXT=y -CONFIG_MAC80211=y -CONFIG_MAC80211_MESH=y -CONFIG_MAC80211_DEBUGFS=y -CONFIG_MAC80211_MESSAGE_TRACING=y -CONFIG_MAC80211_DEBUG_MENU=y -CONFIG_MAC80211_NOINLINE=y -CONFIG_MAC80211_VERBOSE_DEBUG=y -CONFIG_MAC80211_MLME_DEBUG=y -CONFIG_MAC80211_STA_DEBUG=y -CONFIG_MAC80211_HT_DEBUG=y -CONFIG_MAC80211_IBSS_DEBUG=y -CONFIG_MAC80211_PS_DEBUG=y -CONFIG_MAC80211_TDLS_DEBUG=y -CONFIG_RFKILL=y -CONFIG_NET_9P=y -CONFIG_NET_9P_VIRTIO=y -CONFIG_PCI=y -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -# CONFIG_PNP_DEBUG_MESSAGES is not set -# CONFIG_BLK_DEV is not set -CONFIG_NETDEVICES=y -CONFIG_DUMMY=y -CONFIG_MACSEC=y -CONFIG_VETH=y -# CONFIG_ETHERNET is not set -CONFIG_MAC80211_HWSIM=y -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_LEGACY_PTYS is not set -CONFIG_SERIAL_8250=y -# CONFIG_SERIAL_8250_PNP is not set -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_8250_MID is not set -# CONFIG_HW_RANDOM is not set -CONFIG_POWER_SUPPLY=y -# CONFIG_HWMON is not set -CONFIG_FB=y -CONFIG_FB_MODE_HELPERS=y -CONFIG_FB_VESA=y -CONFIG_VGACON_SOFT_SCROLLBACK=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_HIDRAW=y -# CONFIG_USB_SUPPORT is not set -CONFIG_VIRT_DRIVERS=y -CONFIG_VIRTIO_PCI=y -# CONFIG_X86_PLATFORM_DEVICES is not set -# CONFIG_IOMMU_SUPPORT is not set -# CONFIG_DNOTIFY is not set -# CONFIG_INOTIFY_USER is not set -CONFIG_ISO9660_FS=y -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_CONFIGFS_FS=y -# CONFIG_MISC_FILESYSTEMS is not set -CONFIG_9P_FS=y -CONFIG_9P_FS_POSIX_ACL=y -CONFIG_CRYPTO_ECHAINIV=y -CONFIG_CRYPTO_CRCT10DIF=y -CONFIG_CRYPTO_ARC4=y -# CONFIG_CRYPTO_HW is not set -CONFIG_PRINTK_TIME=y -CONFIG_DYNAMIC_DEBUG=y -CONFIG_DEBUG_INFO=y -CONFIG_DEBUG_INFO_REDUCED=y -CONFIG_FRAME_WARN=1024 -CONFIG_DEBUG_SECTION_MISMATCH=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_PAGE_EXTENSION=y -CONFIG_DEBUG_PAGEALLOC=y -CONFIG_DEBUG_RODATA_TEST=y -CONFIG_DEBUG_OBJECTS=y -CONFIG_DEBUG_OBJECTS_SELFTEST=y -CONFIG_DEBUG_OBJECTS_FREE=y -CONFIG_DEBUG_OBJECTS_TIMERS=y -CONFIG_DEBUG_OBJECTS_WORK=y -CONFIG_DEBUG_OBJECTS_RCU_HEAD=y -CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y -CONFIG_SLUB_DEBUG_ON=y -CONFIG_DEBUG_KMEMLEAK=y -CONFIG_DEBUG_STACK_USAGE=y -CONFIG_PANIC_ON_OOPS=y -CONFIG_HARDLOCKUP_DETECTOR=y -CONFIG_PROVE_LOCKING=y -CONFIG_LOCK_STAT=y -CONFIG_DEBUG_LOCKDEP=y -CONFIG_DEBUG_ATOMIC_SLEEP=y -CONFIG_DEBUG_KOBJECT=y -CONFIG_DEBUG_LIST=y -CONFIG_DEBUG_NOTIFIERS=y -CONFIG_RCU_CPU_STALL_TIMEOUT=60 -# CONFIG_RCU_TRACE is not set -CONFIG_LATENCYTOP=y -CONFIG_FUNCTION_TRACER=y -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set diff --git a/tests/hwsim/vm/kernel-config.uml b/tests/hwsim/vm/kernel-config.uml deleted file mode 100644 index b0f2f65ac390..000000000000 --- a/tests/hwsim/vm/kernel-config.uml +++ /dev/null @@ -1,131 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_CGROUPS=y -CONFIG_BLK_CGROUP=y -CONFIG_CGROUP_SCHED=y -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CGROUP_CPUACCT=y -# CONFIG_PID_NS is not set -CONFIG_SYSFS_DEPRECATED=y -CONFIG_CC_OPTIMIZE_FOR_SIZE=y -CONFIG_SLAB=y -CONFIG_HOSTFS=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_MMAPPER=y -# CONFIG_SECCOMP is not set -CONFIG_UML_TIME_TRAVEL_SUPPORT=y -CONFIG_SSL=y -CONFIG_NULL_CHAN=y -CONFIG_PORT_CHAN=y -CONFIG_PTY_CHAN=y -CONFIG_TTY_CHAN=y -CONFIG_XTERM_CHAN=y -CONFIG_CON_CHAN="pts" -CONFIG_SSL_CHAN="pts" -CONFIG_UML_NET=y -CONFIG_UML_NET_TUNTAP=y -CONFIG_UML_NET_VECTOR=y -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_MQ_IOSCHED_DEADLINE is not set -# CONFIG_MQ_IOSCHED_KYBER is not set -CONFIG_BINFMT_MISC=y -# CONFIG_COMPACTION is not set -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -CONFIG_IP_MULTIPLE_TABLES=y -CONFIG_NETFILTER=y -CONFIG_BRIDGE_NETFILTER=y -CONFIG_NF_TABLES=y -CONFIG_NETFILTER_XTABLES=y -CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y -CONFIG_NF_TABLES_BRIDGE=y -CONFIG_BRIDGE_NF_EBTABLES=y -CONFIG_BRIDGE_EBT_T_FILTER=y -CONFIG_BRIDGE_EBT_ARP=y -CONFIG_BRIDGE_EBT_IP=y -CONFIG_BRIDGE_EBT_IP6=y -CONFIG_BRIDGE_EBT_PKTTYPE=y -CONFIG_BRIDGE_EBT_ARPREPLY=y -CONFIG_BRIDGE=y -CONFIG_BRIDGE_VLAN_FILTERING=y -CONFIG_VLAN_8021Q=y -CONFIG_CFG80211=y -CONFIG_CFG80211_DEBUGFS=y -CONFIG_CFG80211_WEXT=y -CONFIG_MAC80211=y -CONFIG_MAC80211_MESH=y -CONFIG_MAC80211_DEBUGFS=y -CONFIG_MAC80211_MESSAGE_TRACING=y -CONFIG_MAC80211_DEBUG_MENU=y -CONFIG_MAC80211_VERBOSE_DEBUG=y -CONFIG_MAC80211_MLME_DEBUG=y -CONFIG_MAC80211_STA_DEBUG=y -CONFIG_MAC80211_HT_DEBUG=y -CONFIG_MAC80211_OCB_DEBUG=y -CONFIG_MAC80211_IBSS_DEBUG=y -CONFIG_MAC80211_PS_DEBUG=y -CONFIG_MAC80211_TDLS_DEBUG=y -CONFIG_MAC80211_DEBUG_COUNTERS=y -CONFIG_RFKILL=y -CONFIG_UEVENT_HELPER=y -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_BLK_DEV_UBD=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_DUMMY=y -CONFIG_MACSEC=y -CONFIG_VETH=y -# CONFIG_ETHERNET is not set -# CONFIG_WLAN_VENDOR_ADMTEK is not set -# CONFIG_WLAN_VENDOR_ATH is not set -# CONFIG_WLAN_VENDOR_ATMEL is not set -# CONFIG_WLAN_VENDOR_BROADCOM is not set -# CONFIG_WLAN_VENDOR_CISCO is not set -# CONFIG_WLAN_VENDOR_INTEL is not set -# CONFIG_WLAN_VENDOR_INTERSIL is not set -# CONFIG_WLAN_VENDOR_MARVELL is not set -# CONFIG_WLAN_VENDOR_MEDIATEK is not set -# CONFIG_WLAN_VENDOR_RALINK is not set -# CONFIG_WLAN_VENDOR_REALTEK is not set -# CONFIG_WLAN_VENDOR_RSI is not set -# CONFIG_WLAN_VENDOR_ST is not set -# CONFIG_WLAN_VENDOR_TI is not set -# CONFIG_WLAN_VENDOR_ZYDAS is not set -# CONFIG_WLAN_VENDOR_QUANTENNA is not set -CONFIG_MAC80211_HWSIM=y -CONFIG_LEGACY_PTY_COUNT=32 -# CONFIG_HW_RANDOM is not set -CONFIG_UML_RANDOM=y -# CONFIG_IOMMU_SUPPORT is not set -# CONFIG_DNOTIFY is not set -# CONFIG_INOTIFY_USER is not set -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -# CONFIG_MISC_FILESYSTEMS is not set -# CONFIG_NETWORK_FILESYSTEMS is not set -CONFIG_NLS=y -CONFIG_LSM="yama,loadpin,safesetid,integrity" -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_ARC4=y -CONFIG_CRC16=y -CONFIG_PRINTK_TIME=y -CONFIG_DEBUG_INFO=y -CONFIG_FRAME_WARN=1024 -CONFIG_DEBUG_FS=y -CONFIG_DEBUG_KERNEL=y -CONFIG_PANIC_ON_OOPS=y -CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y -CONFIG_PREEMPTIRQ_EVENTS=y -# CONFIG_RUNTIME_TESTING_MENU is not set diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py deleted file mode 100755 index 86565c677493..000000000000 --- a/tests/hwsim/vm/parallel-vm.py +++ /dev/null @@ -1,669 +0,0 @@ -#!/usr/bin/env python3 -# -# Parallel VM test case executor -# Copyright (c) 2014-2019, Jouni Malinen <j@w1.fi> -# -# This software may be distributed under the terms of the BSD license. -# See README for more details. - -from __future__ import print_function -import curses -import fcntl -import logging -import multiprocessing -import os -import selectors -import subprocess -import sys -import time -import errno - -logger = logging.getLogger() - -# Test cases that take significantly longer time to execute than average. -long_tests = ["ap_roam_open", - "wpas_mesh_password_mismatch_retry", - "wpas_mesh_password_mismatch", - "hostapd_oom_wpa2_psk_connect", - "ap_hs20_fetch_osu_stop", - "ap_roam_wpa2_psk", - "ibss_wpa_none_ccmp", - "nfc_wps_er_handover_pk_hash_mismatch_sta", - "go_neg_peers_force_diff_freq", - "p2p_cli_invite", - "sta_ap_scan_2b", - "ap_pmf_sta_unprot_deauth_burst", - "ap_bss_add_remove_during_ht_scan", - "wext_scan_hidden", - "autoscan_exponential", - "nfc_p2p_client", - "wnm_bss_keep_alive", - "ap_inactivity_disconnect", - "scan_bss_expiration_age", - "autoscan_periodic", - "discovery_group_client", - "concurrent_p2pcli", - "ap_bss_add_remove", - "wpas_ap_wps", - "wext_pmksa_cache", - "ibss_wpa_none", - "ap_ht_40mhz_intolerant_ap", - "ibss_rsn", - "discovery_pd_retries", - "ap_wps_setup_locked_timeout", - "ap_vht160", - 'he160', - 'he160b', - "dfs_radar", - "dfs", - "dfs_ht40_minus", - "dfs_etsi", - "dfs_radar_vht80_downgrade", - "ap_acs_dfs", - "grpform_cred_ready_timeout", - "hostapd_oom_wpa2_eap_connect", - "wpas_ap_dfs", - "autogo_many", - "hostapd_oom_wpa2_eap", - "ibss_open", - "proxyarp_open_ebtables", - "proxyarp_open_ebtables_ipv6", - "radius_failover", - "obss_scan_40_intolerant", - "dbus_connect_oom", - "proxyarp_open", - "proxyarp_open_ipv6", - "ap_wps_iteration", - "ap_wps_iteration_error", - "ap_wps_pbc_timeout", - "ap_wps_pbc_ap_timeout", - "ap_wps_pin_ap_timeout", - "ap_wps_http_timeout", - "p2p_go_move_reg_change", - "p2p_go_move_active", - "p2p_go_move_scm", - "p2p_go_move_scm_peer_supports", - "p2p_go_move_scm_peer_does_not_support", - "p2p_go_move_scm_multi"] - -def get_failed(vm): - failed = [] - for i in range(num_servers): - failed += vm[i]['failed'] - return failed - -def vm_read_stdout(vm, test_queue): - global total_started, total_passed, total_failed, total_skipped - global rerun_failures - global first_run_failures - - ready = False - try: - out = vm['proc'].stdout.read() - if out == None: - return False - out = out.decode() - except IOError as e: - if e.errno == errno.EAGAIN: - return False - raise - logger.debug("VM[%d] stdout.read[%s]" % (vm['idx'], out.rstrip())) - pending = vm['pending'] + out - lines = [] - while True: - pos = pending.find('\n') - if pos < 0: - break - line = pending[0:pos].rstrip() - pending = pending[(pos + 1):] - logger.debug("VM[%d] stdout full line[%s]" % (vm['idx'], line)) - if line.startswith("READY"): - vm['starting'] = False - vm['started'] = True - ready = True - elif line.startswith("PASS"): - ready = True - total_passed += 1 - elif line.startswith("FAIL"): - ready = True - total_failed += 1 - vals = line.split(' ') - if len(vals) < 2: - logger.info("VM[%d] incomplete FAIL line: %s" % (vm['idx'], - line)) - name = line - else: - name = vals[1] - logger.debug("VM[%d] test case failed: %s" % (vm['idx'], name)) - vm['failed'].append(name) - if name != vm['current_name']: - logger.info("VM[%d] test result mismatch: %s (expected %s)" % (vm['idx'], name, vm['current_name'])) - else: - count = vm['current_count'] - if count == 0: - first_run_failures.append(name) - if rerun_failures and count < 1: - logger.debug("Requeue test case %s" % name) - test_queue.append((name, vm['current_count'] + 1)) - elif line.startswith("NOT-FOUND"): - ready = True - total_failed += 1 - logger.info("VM[%d] test case not found" % vm['idx']) - elif line.startswith("SKIP"): - ready = True - total_skipped += 1 - elif line.startswith("REASON"): - vm['skip_reason'].append(line[7:]) - elif line.startswith("START"): - total_started += 1 - if len(vm['failed']) == 0: - vals = line.split(' ') - if len(vals) >= 2: - vm['fail_seq'].append(vals[1]) - vm['out'] += line + '\n' - lines.append(line) - vm['pending'] = pending - return ready - -def start_vm(vm, sel): - logger.info("VM[%d] starting up" % (vm['idx'] + 1)) - vm['starting'] = True - vm['proc'] = subprocess.Popen(vm['cmd'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - vm['cmd'] = None - for stream in [vm['proc'].stdout, vm['proc'].stderr]: - fd = stream.fileno() - fl = fcntl.fcntl(fd, fcntl.F_GETFL) - fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK) - sel.register(stream, selectors.EVENT_READ, vm) - -def num_vm_starting(): - count = 0 - for i in range(num_servers): - if vm[i]['starting']: - count += 1 - return count - -def vm_read_stderr(vm): - try: - err = vm['proc'].stderr.read() - if err != None: - err = err.decode() - if len(err) > 0: - vm['err'] += err - logger.info("VM[%d] stderr.read[%s]" % (vm['idx'], err)) - except IOError as e: - if e.errno != errno.EAGAIN: - raise - -def vm_next_step(_vm, scr, test_queue): - scr.move(_vm['idx'] + 1, 10) - scr.clrtoeol() - if not test_queue: - _vm['proc'].stdin.write(b'\n') - _vm['proc'].stdin.flush() - scr.addstr("shutting down") - logger.info("VM[%d] shutting down" % _vm['idx']) - return - (name, count) = test_queue.pop(0) - _vm['current_name'] = name - _vm['current_count'] = count - _vm['proc'].stdin.write(name.encode() + b'\n') - _vm['proc'].stdin.flush() - scr.addstr(name) - logger.debug("VM[%d] start test %s" % (_vm['idx'], name)) - -def check_vm_start(scr, sel, test_queue): - running = False - for i in range(num_servers): - if vm[i]['proc']: - running = True - continue - - # Either not yet started or already stopped VM - max_start = multiprocessing.cpu_count() - if max_start > 4: - max_start /= 2 - num_starting = num_vm_starting() - if vm[i]['cmd'] and len(test_queue) > num_starting and \ - num_starting < max_start: - scr.move(i + 1, 10) - scr.clrtoeol() - scr.addstr(i + 1, 10, "starting VM") - start_vm(vm[i], sel) - return True, True - - return running, False - -def vm_terminated(_vm, scr, sel, test_queue): - updated = False - for stream in [_vm['proc'].stdout, _vm['proc'].stderr]: - sel.unregister(stream) - _vm['proc'] = None - scr.move(_vm['idx'] + 1, 10) - scr.clrtoeol() - log = '{}/{}.srv.{}/console'.format(dir, timestamp, _vm['idx'] + 1) - with open(log, 'r') as f: - if "Kernel panic" in f.read(): - scr.addstr("kernel panic") - logger.info("VM[%d] kernel panic" % _vm['idx']) - updated = True - if test_queue: - num_vm = 0 - for i in range(num_servers): - if _vm['proc']: - num_vm += 1 - if len(test_queue) > num_vm: - scr.addstr("unexpected exit") - logger.info("VM[%d] unexpected exit" % i) - updated = True - return updated - -def update_screen(scr, total_tests): - scr.move(num_servers + 1, 10) - scr.clrtoeol() - scr.addstr("{} %".format(int(100.0 * (total_passed + total_failed + total_skipped) / total_tests))) - scr.addstr(num_servers + 1, 20, - "TOTAL={} STARTED={} PASS={} FAIL={} SKIP={}".format(total_tests, total_started, total_passed, total_failed, total_skipped)) - failed = get_failed(vm) - if len(failed) > 0: - scr.move(num_servers + 2, 0) - scr.clrtoeol() - scr.addstr("Failed test cases: ") - count = 0 - for f in failed: - count += 1 - if count > 30: - scr.addstr('...') - scr.clrtoeol() - break - scr.addstr(f) - scr.addstr(' ') - scr.refresh() - -def show_progress(scr): - global num_servers - global vm - global dir - global timestamp - global tests - global first_run_failures - global total_started, total_passed, total_failed, total_skipped - global rerun_failures - - sel = selectors.DefaultSelector() - total_tests = len(tests) - logger.info("Total tests: %d" % total_tests) - test_queue = [(t, 0) for t in tests] - start_vm(vm[0], sel) - - scr.leaveok(1) - scr.addstr(0, 0, "Parallel test execution status", curses.A_BOLD) - for i in range(0, num_servers): - scr.addstr(i + 1, 0, "VM %d:" % (i + 1), curses.A_BOLD) - status = "starting VM" if vm[i]['proc'] else "not yet started" - scr.addstr(i + 1, 10, status) - scr.addstr(num_servers + 1, 0, "Total:", curses.A_BOLD) - scr.addstr(num_servers + 1, 20, "TOTAL={} STARTED=0 PASS=0 FAIL=0 SKIP=0".format(total_tests)) - scr.refresh() - - while True: - updated = False - events = sel.select(timeout=1) - for key, mask in events: - _vm = key.data - if not _vm['proc']: - continue - vm_read_stderr(_vm) - if vm_read_stdout(_vm, test_queue): - vm_next_step(_vm, scr, test_queue) - updated = True - vm_read_stderr(_vm) - if _vm['proc'].poll() is not None: - if vm_terminated(_vm, scr, sel, test_queue): - updated = True - - running, run_update = check_vm_start(scr, sel, test_queue) - if updated or run_update: - update_screen(scr, total_tests) - if not running: - break - sel.close() - - for i in range(num_servers): - if not vm[i]['proc']: - continue - vm[i]['proc'] = None - scr.move(i + 1, 10) - scr.clrtoeol() - scr.addstr("still running") - logger.info("VM[%d] still running" % i) - - scr.refresh() - time.sleep(0.3) - -def known_output(tests, line): - if not line: - return True - if line in tests: - return True - known = ["START ", "PASS ", "FAIL ", "SKIP ", "REASON ", "ALL-PASSED", - "READY", - " ", "Exception: ", "Traceback (most recent call last):", - "./run-all.sh: running", - "./run-all.sh: passing", - "Test run completed", "Logfiles are at", "Starting test run", - "passed all", "skipped ", "failed tests:"] - for k in known: - if line.startswith(k): - return True - return False - -def main(): - import argparse - import os - global num_servers - global vm - global dir - global timestamp - global tests - global first_run_failures - global total_started, total_passed, total_failed, total_skipped - global rerun_failures - - total_started = 0 - total_passed = 0 - total_failed = 0 - total_skipped = 0 - - debug_level = logging.INFO - rerun_failures = True - timestamp = int(time.time()) - - scriptsdir = os.path.dirname(os.path.realpath(sys.argv[0])) - - p = argparse.ArgumentParser(description='run multiple testing VMs in parallel') - p.add_argument('num_servers', metavar='number of VMs', type=int, choices=range(1, 100), - help="number of VMs to start") - p.add_argument('-f', dest='testmodules', metavar='<test module>', - help='execute only tests from these test modules', - type=str, nargs='+') - p.add_argument('-1', dest='no_retry', action='store_const', const=True, default=False, - help="don't retry failed tests automatically") - p.add_argument('--debug', dest='debug', action='store_const', const=True, default=False, - help="enable debug logging") - p.add_argument('--codecov', dest='codecov', action='store_const', const=True, default=False, - help="enable code coverage collection") - p.add_argument('--shuffle-tests', dest='shuffle', action='store_const', const=True, default=False, - help="shuffle test cases to randomize order") - p.add_argument('--short', dest='short', action='store_const', const=True, - default=False, - help="only run short-duration test cases") - p.add_argument('--long', dest='long', action='store_const', const=True, - default=False, - help="include long-duration test cases") - p.add_argument('--valgrind', dest='valgrind', action='store_const', - const=True, default=False, - help="run tests under valgrind") - p.add_argument('--telnet', dest='telnet', metavar='<baseport>', type=int, - help="enable telnet server inside VMs, specify the base port here") - p.add_argument('--nocurses', dest='nocurses', action='store_const', - const=True, default=False, help="Don't use curses for output") - p.add_argument('params', nargs='*') - args = p.parse_args() - - dir = os.environ.get('HWSIM_TEST_LOG_DIR', '/tmp/hwsim-test-logs') - try: - os.makedirs(dir) - except OSError as e: - if e.errno != errno.EEXIST: - raise - - num_servers = args.num_servers - rerun_failures = not args.no_retry - if args.debug: - debug_level = logging.DEBUG - extra_args = [] - if args.valgrind: - extra_args += ['--valgrind'] - if args.long: - extra_args += ['--long'] - if args.codecov: - print("Code coverage - build separate binaries") - logdir = os.path.join(dir, str(timestamp)) - os.makedirs(logdir) - subprocess.check_call([os.path.join(scriptsdir, 'build-codecov.sh'), - logdir]) - codecov_args = ['--codecov_dir', logdir] - codecov = True - else: - codecov_args = [] - codecov = False - - first_run_failures = [] - if args.params: - tests = args.params - else: - tests = [] - cmd = [os.path.join(os.path.dirname(scriptsdir), 'run-tests.py'), '-L'] - if args.testmodules: - cmd += ["-f"] - cmd += args.testmodules - lst = subprocess.Popen(cmd, stdout=subprocess.PIPE) - for l in lst.stdout.readlines(): - name = l.decode().split(' ')[0] - tests.append(name) - if len(tests) == 0: - sys.exit("No test cases selected") - - if args.shuffle: - from random import shuffle - shuffle(tests) - elif num_servers > 2 and len(tests) > 100: - # Move test cases with long duration to the beginning as an - # optimization to avoid last part of the test execution running a long - # duration test case on a single VM while all other VMs have already - # completed their work. - for l in long_tests: - if l in tests: - tests.remove(l) - tests.insert(0, l) - if args.short: - tests = [t for t in tests if t not in long_tests] - - logger.setLevel(debug_level) - if not args.nocurses: - log_handler = logging.FileHandler('parallel-vm.log') - else: - log_handler = logging.StreamHandler(sys.stdout) - log_handler.setLevel(debug_level) - fmt = "%(asctime)s %(levelname)s %(message)s" - log_formatter = logging.Formatter(fmt) - log_handler.setFormatter(log_formatter) - logger.addHandler(log_handler) - - vm = {} - for i in range(0, num_servers): - cmd = [os.path.join(scriptsdir, 'vm-run.sh'), - '--timestamp', str(timestamp), - '--ext', 'srv.%d' % (i + 1), - '-i'] + codecov_args + extra_args - if args.telnet: - cmd += ['--telnet', str(args.telnet + i)] - vm[i] = {} - vm[i]['idx'] = i - vm[i]['starting'] = False - vm[i]['started'] = False - vm[i]['cmd'] = cmd - vm[i]['proc'] = None - vm[i]['out'] = "" - vm[i]['pending'] = "" - vm[i]['err'] = "" - vm[i]['failed'] = [] - vm[i]['fail_seq'] = [] - vm[i]['skip_reason'] = [] - print('') - - if not args.nocurses: - curses.wrapper(show_progress) - else: - class FakeScreen: - def leaveok(self, n): - pass - def refresh(self): - pass - def addstr(self, *args, **kw): - pass - def move(self, x, y): - pass - def clrtoeol(self): - pass - show_progress(FakeScreen()) - - with open('{}/{}-parallel.log'.format(dir, timestamp), 'w') as f: - for i in range(0, num_servers): - f.write('VM {}\n{}\n{}\n'.format(i + 1, vm[i]['out'], vm[i]['err'])) - first = True - for i in range(0, num_servers): - for line in vm[i]['out'].splitlines(): - if line.startswith("FAIL "): - if first: - first = False - print("Logs for failed test cases:") - f.write("Logs for failed test cases:\n") - fname = "%s/%d.srv.%d/%s.log" % (dir, timestamp, i + 1, - line.split(' ')[1]) - print(fname) - f.write("%s\n" % fname) - - failed = get_failed(vm) - - if first_run_failures: - print("To re-run same failure sequence(s):") - for i in range(0, num_servers): - if len(vm[i]['failed']) == 0: - continue - print("./vm-run.sh", end=' ') - if args.long: - print("--long", end=' ') - skip = len(vm[i]['fail_seq']) - skip -= min(skip, 30) - for t in vm[i]['fail_seq']: - if skip > 0: - skip -= 1 - continue - print(t, end=' ') - print('') - print("Failed test cases:") - for f in first_run_failures: - print(f, end=' ') - logger.info("Failed: " + f) - print('') - double_failed = [] - for name in failed: - double_failed.append(name) - for test in first_run_failures: - double_failed.remove(test) - if not rerun_failures: - pass - elif failed and not double_failed: - print("All failed cases passed on retry") - logger.info("All failed cases passed on retry") - elif double_failed: - print("Failed even on retry:") - for f in double_failed: - print(f, end=' ') - logger.info("Failed on retry: " + f) - print('') - res = "TOTAL={} PASS={} FAIL={} SKIP={}".format(total_started, - total_passed, - total_failed, - total_skipped) - print(res) - logger.info(res) - print("Logs: " + dir + '/' + str(timestamp)) - logger.info("Logs: " + dir + '/' + str(timestamp)) - - skip_reason = [] - for i in range(num_servers): - if not vm[i]['started']: - continue - skip_reason += vm[i]['skip_reason'] - if len(vm[i]['pending']) > 0: - logger.info("Unprocessed stdout from VM[%d]: '%s'" % - (i, vm[i]['pending'])) - log = '{}/{}.srv.{}/console'.format(dir, timestamp, i + 1) - with open(log, 'r') as f: - if "Kernel panic" in f.read(): - print("Kernel panic in " + log) - logger.info("Kernel panic in " + log) - missing = {} - missing['OCV not supported'] = 'OCV' - missing['sigma_dut not available'] = 'sigma_dut' - missing['Skip test case with long duration due to --long not specified'] = 'long' - missing['TEST_ALLOC_FAIL not supported' ] = 'TEST_FAIL' - missing['TEST_ALLOC_FAIL not supported in the build'] = 'TEST_FAIL' - missing['TEST_FAIL not supported' ] = 'TEST_FAIL' - missing['veth not supported (kernel CONFIG_VETH)'] = 'KERNEL:CONFIG_VETH' - missing['WPA-EAP-SUITE-B-192 not supported'] = 'CONFIG_SUITEB192' - missing['WPA-EAP-SUITE-B not supported'] = 'CONFIG_SUITEB' - missing['wmediumd not available'] = 'wmediumd' - missing['DPP not supported'] = 'CONFIG_DPP' - missing['DPP version 2 not supported'] = 'CONFIG_DPP2' - missing['EAP method PWD not supported in the build'] = 'CONFIG_EAP_PWD' - missing['EAP method TEAP not supported in the build'] = 'CONFIG_EAP_TEAP' - missing['FILS not supported'] = 'CONFIG_FILS' - missing['FILS-SK-PFS not supported'] = 'CONFIG_FILS_SK_PFS' - missing['OWE not supported'] = 'CONFIG_OWE' - missing['SAE not supported'] = 'CONFIG_SAE' - missing['Not using OpenSSL'] = 'CONFIG_TLS=openssl' - missing['wpa_supplicant TLS library is not OpenSSL: internal'] = 'CONFIG_TLS=openssl' - missing_items = [] - other_reasons = [] - for reason in sorted(set(skip_reason)): - if reason in missing: - missing_items.append(missing[reason]) - elif reason.startswith('OCSP-multi not supported with this TLS library'): - missing_items.append('OCSP-MULTI') - else: - other_reasons.append(reason) - if missing_items: - print("Missing items (SKIP):", missing_items) - if other_reasons: - print("Other skip reasons:", other_reasons) - - for i in range(num_servers): - unknown = "" - for line in vm[i]['out'].splitlines(): - if not known_output(tests, line): - unknown += line + "\n" - if unknown: - print("\nVM %d - unexpected stdout output:\n%s" % (i, unknown)) - if vm[i]['err']: - print("\nVM %d - unexpected stderr output:\n%s\n" % (i, vm[i]['err'])) - - if codecov: - print("Code coverage - preparing report") - for i in range(num_servers): - subprocess.check_call([os.path.join(scriptsdir, - 'process-codecov.sh'), - logdir + ".srv.%d" % (i + 1), - str(i)]) - subprocess.check_call([os.path.join(scriptsdir, 'combine-codecov.sh'), - logdir]) - print("file://%s/index.html" % logdir) - logger.info("Code coverage report: file://%s/index.html" % logdir) - - if double_failed or (failed and not rerun_failures): - logger.info("Test run complete - failures found") - sys.exit(2) - if failed: - logger.info("Test run complete - failures found on first run; passed on retry") - sys.exit(1) - logger.info("Test run complete - no failures") - sys.exit(0) - -if __name__ == "__main__": - main() diff --git a/tests/hwsim/vm/process-codecov.sh b/tests/hwsim/vm/process-codecov.sh deleted file mode 100755 index d932aa2d011e..000000000000 --- a/tests/hwsim/vm/process-codecov.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -LOGDIR=$1 -POSTFIX=$2 -RESTORE=$3 - -DIR=$PWD -TMPDIR=/tmp/logs - -mv $LOGDIR/alt-wpa_supplicant $TMPDIR -mv $LOGDIR/alt-hostapd $TMPDIR -mv $LOGDIR/alt-hostapd-as $TMPDIR -mv $LOGDIR/alt-hlr_auc_gw $TMPDIR - -cd $TMPDIR/alt-wpa_supplicant/wpa_supplicant -lcov -c -d .. 2> lcov.log | sed s%SF:/tmp/logs/alt-[^/]*/%SF:/tmp/logs/alt-wpa_supplicant/% > $TMPDIR/lcov-wpa_supplicant.info-$POSTFIX & - -cd $TMPDIR/alt-hostapd/hostapd -lcov -c -d .. 2> lcov.log | sed s%SF:/tmp/logs/alt-[^/]*/%SF:/tmp/logs/alt-wpa_supplicant/% > $TMPDIR/lcov-hostapd.info-$POSTFIX & - -cd $TMPDIR/alt-hostapd-as/hostapd -lcov -c -d .. 2> lcov.log | sed s%SF:/tmp/logs/alt-[^/]*/%SF:/tmp/logs/alt-wpa_supplicant/% > $TMPDIR/lcov-hostapd-as.info-$POSTFIX & - -cd $TMPDIR/alt-hlr_auc_gw/hostapd -lcov -c -d .. 2> lcov.log | sed s%SF:/tmp/logs/alt-[^/]*/%SF:/tmp/logs/alt-wpa_supplicant/% > $TMPDIR/lcov-hlr_auc_gw.info-$POSTFIX & -wait - -cd $DIR -if [ "$RESTORE" == "restore" ]; then - mv $TMPDIR/alt-* $LOGDIR -else - rm -r $TMPDIR/alt-wpa_supplicant - rm -r $TMPDIR/alt-hostapd - rm -r $TMPDIR/alt-hostapd-as - rm -r $TMPDIR/alt-hlr_auc_gw -fi diff --git a/tests/hwsim/vm/regdb/regulatory.db b/tests/hwsim/vm/regdb/regulatory.db Binary files differdeleted file mode 100644 index e0db5f8be0f4..000000000000 --- a/tests/hwsim/vm/regdb/regulatory.db +++ /dev/null diff --git a/tests/hwsim/vm/regdb/regulatory.db.p7s b/tests/hwsim/vm/regdb/regulatory.db.p7s Binary files differdeleted file mode 100644 index 730aef4f364c..000000000000 --- a/tests/hwsim/vm/regdb/regulatory.db.p7s +++ /dev/null diff --git a/tests/hwsim/vm/uevent.sh b/tests/hwsim/vm/uevent.sh deleted file mode 100755 index 76e31e76d3be..000000000000 --- a/tests/hwsim/vm/uevent.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -EPATH=$(sed 's/.*EPATH=\([^ ]*\) .*/\1/' /proc/cmdline) -PATH=/tmp/bin:$EPATH:$PATH - -# assume this was a call for CRDA, -# if not then it won't find a COUNTRY -# environment variable and exit -exec crda diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh deleted file mode 100755 index 06dee068960b..000000000000 --- a/tests/hwsim/vm/vm-run.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/bash - -cd "$(dirname $0)" - -if [ -z "$TESTDIR" ] ; then - TESTDIR=$(pwd)/../ -fi - -if [ -n "$HWSIM_TEST_LOG_DIR" ] ; then - LOGS="$HWSIM_TEST_LOG_DIR" -else - LOGS=/tmp/hwsim-test-logs -fi - -# increase the memory size if you want to run with valgrind, 512 MB works -MEMORY=256 - -# Some ubuntu systems (notably 12.04) have issues with this - since the guest -# mounts as read-only it should be safe to not specify ,readonly. Override in -# vm-config if needed (see below) -ROTAG=,readonly - -# set this to ttyS0 to see kvm messages (if something doesn't work) -KVMOUT=ttyS1 - -# you can set EPATH if you need anything extra in $PATH inside the VM -#EPATH=/some/dir - -# extra KVM arguments, e.g., -s for gdbserver -#KVMARGS=-s - -# number of channels each hwsim device supports -CHANNELS=1 - -test -f vm-config && . vm-config -test -f ~/.wpas-vm-config && . ~/.wpas-vm-config - -if [ -z "$KERNEL" ] && [ -z "$KERNELDIR" ] ; then - echo "You need to set a KERNEL or KERNELDIR (in the environment or vm-config)" - exit 2 -fi -if [ -z "$KERNEL" ] ; then - if [ -e $KERNELDIR/arch/x86_64/boot/bzImage ]; then - KERNEL=$KERNELDIR/arch/x86_64/boot/bzImage - elif [ -e $KERNELDIR/linux ]; then - KERNEL=$KERNELDIR/linux - else - echo "No suitable kernel image found from KERNELDIR" - exit 2 - fi -fi -if [ ! -e $KERNEL ]; then - echo "Kernel image not found: $KERNEL" - exit 2 -fi - - -CMD=$TESTDIR/vm/inside.sh - -unset RUN_TEST_ARGS -TIMESTAMP=$(date +%s) -DATE=$TIMESTAMP -CODECOV=no -TIMEWARP=0 -TELNET_QEMU= -TELNET_ARG=0 -CODECOV_DIR= -while [ "$1" != "" ]; do - case $1 in - --timestamp ) shift - TIMESTAMP=$1 - shift - ;; - --ext ) shift - DATE=$TIMESTAMP.$1 - shift - ;; - --codecov ) shift - CODECOV=yes - ;; - --codecov_dir ) shift - CODECOV_DIR=$1 - shift - ;; - --timewrap ) shift - TIMEWARP=1 - ;; - --telnet ) shift - TELNET_ARG=1 - TELNET_QEMU="-net nic,model=virtio -net user,id=telnet,restrict=on,net=172.16.0.0/24,hostfwd=tcp:127.0.0.1:$1-:23" - shift - ;; - * ) - RUN_TEST_ARGS="$RUN_TEST_ARGS$1 " - shift - ;; - esac -done - -LOGDIR=$LOGS/$DATE -mkdir -p $LOGDIR -rm -f $LOGS/latest -ln -s $LOGDIR $LOGS/latest - -if [ -n "$CODECOV_DIR" ]; then - cp -a $CODECOV_DIR/alt-wpa_supplicant $LOGDIR - cp -a $CODECOV_DIR/alt-hostapd $LOGDIR - cp -a $CODECOV_DIR/alt-hostapd-as $LOGDIR - cp -a $CODECOV_DIR/alt-hlr_auc_gw $LOGDIR -elif [ $CODECOV = "yes" ]; then - ./build-codecov.sh $LOGDIR || exit 1 -else - CODECOV=no -fi - -echo "Starting test run in a virtual machine" - -if [ -x $KERNEL ]; then - unset KVM -else - KVM=kvm - for kvmprog in kvm qemu-kvm; do - if $kvmprog --version &> /dev/null; then - KVM=$kvmprog - break - fi - done -fi - -argsfile=$(mktemp) -if [ $? -ne 0 ] ; then - exit 2 -fi -function finish { - rm -f $argsfile -} -trap finish EXIT - -if [ -z $KVM ]; then - RUN_TEST_ARGS="--long $RUN_TEST_ARGS" -fi -echo "$RUN_TEST_ARGS" > $argsfile - -A="mac80211_hwsim.support_p2p_device=0 " -A+="mac80211_hwsim.channels=$CHANNELS " -A+="mac80211_hwsim.radios=7 " -A+="cfg80211.dyndbg=+p " -A+="mac80211.dyndbg=+p " -A+="mac80211_hwsim.dyndbg=+p " -A+="init=$CMD " -A+="testdir=$TESTDIR " -A+="timewarp=$TIMEWARP " -A+="TELNET=$TELNET_ARG " -A+="EPATH=$EPATH " -A+="ARGS=$argsfile " -A+="console=$KVMOUT " -A+="ro" - -if [ -z $KVM ]; then - $KERNEL \ - mem=${MEMORY}M \ - LOGDIR=$LOGDIR \ - time-travel=inf-cpu \ - $A \ - root=none hostfs=/ rootfstype=hostfs rootflags=/ \ - ssl0=fd:0,fd:1 \ - ssl1=fd:100 \ - ssl-non-raw \ - 100<>$LOGDIR/console 2>&1 | \ - sed -u '0,/VM has started up/d' -else - $KVM \ - -kernel $KERNEL \ - -smp 4 \ - $KVMARGS \ - -m $MEMORY \ - -nographic \ - -fsdev local,security_model=none,id=fsdev-root,path=/$ROTAG \ - -device virtio-9p-pci,id=fs-root,fsdev=fsdev-root,mount_tag=/dev/root \ - -fsdev local,security_model=none,id=fsdev-logs,path="$LOGDIR",writeout=immediate \ - -device virtio-9p-pci,id=fs-logs,fsdev=fsdev-logs,mount_tag=logshare \ - -monitor null \ - -serial stdio \ - -serial file:$LOGDIR/console \ - $TELNET_QEMU \ - -append "$A root=/dev/root rootflags=trans=virtio,version=9p2000.u rootfstype=9p" | \ - sed -u '0,/VM has started up/d' -fi - -if [ $CODECOV = "yes" ]; then - echo "Preparing code coverage reports" - ./process-codecov.sh $LOGDIR "" restore - ./combine-codecov.sh $LOGDIR lcov -fi - -echo -echo "Test run completed" -echo "Logfiles are at $LOGDIR ($LOGS/latest)" -if [ $CODECOV = "yes" ]; then - echo "Code coverage report:" - echo "file://$LOGDIR/lcov/index.html" -fi |