From 626f5f9e2261f0d9caf498b8748a85c343abf1a4 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Mon, 13 Aug 2018 21:08:27 +0100 Subject: [PATCH] bench-boot: add -f option to only run fast boots Comment out all tests that are known to be failing. run: exit 1 on failure, was broken dude to termout pipe --- README.adoc | 42 +++++++++++++++-------------------- bench-boot | 58 +++++++++++++++++++++++++++++++++++------------- build-all | 2 +- eeval | 8 +++++-- gem5-bench-cache | 1 - gem5-stat | 1 - run | 6 ++--- rungdb | 11 +++++---- test | 4 ++++ 9 files changed, 79 insertions(+), 54 deletions(-) create mode 100755 test diff --git a/README.adoc b/README.adoc index 73d2e1e..32e0867 100644 --- a/README.adoc +++ b/README.adoc @@ -3115,16 +3115,8 @@ git remote add up git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-sta git fetch up git rebase --onto "$next_mainline_revision" "$last_mainline_revision" -cd .. -./build -lk -# Manually fix broken kernel modules if necessary. -git branch "buildroot-2017.08-linux-${last_mainline_revision}" -git add . # And update the README to show off. git commit -m "linux: update to ${next_mainline_revision}" -# Test the heck out of it, especially kernel modules and GDB. -./run -git push .... But we have since moved to running just mainline, which makes the update simpler. @@ -3629,7 +3621,7 @@ warn: Kernel panic in simulated kernel before hanging forever. -We can make gem5 ff52563a214c71fcd1e21e9f00ad839612032e3b `fs.py` quit instead of hang with: +We can make gem5 ff52563a214c71fcd1e21e9f00ad839612032e3b `fs.py` quit instead of hang with `system.panic_on_panic`: .... patch -d gem5/gem5 -p1 < patches/manual/gem5-panic.patch @@ -3640,6 +3632,12 @@ Source: link:patches/manual/gem5-panic.patch[]. It does not seem to be exposed to `fs.py`. +TODO: fs.py x86 does not have it: + +.... +AttributeError: Class LinuxX86System has no parameter panic_on_panic +.... + However TODO it still exits with status 0... so we are just parsing the logs for now, as for QEMU. This seems to happen because the abort that is used to quit at link:https://github.com/gem5/gem5/blob/ff52563a214c71fcd1e21e9f00ad839612032e3b/src/base/logging.hh#L124[src/base/logging.hh]: .... @@ -9462,25 +9460,21 @@ Testing that should be done for every functional patch. ===== Guest testing -.... -./run -a x86_64 -e '- lkmc_eval="/insrm.sh hello 5;/sbin/ifup -a;wget -S google.com;poweroff;"' -./run -a arm -e '- lkmc_eval="/insrm.sh hello 5;/sbin/ifup -a;wget -S google.com;poweroff;"' -.... - -Should: - -* boot -* show `hello.ko`, `init` and `exit` messages -* make a network request -* shutdown gracefully - -We are slowly automating testable guest tests with: +Build for all stable archs and run basic fast tests: .... -./run -F '/test_all.sh;/poweroff.out' | grep lkmc_test +./build-all +./test +echo $? .... -which outputs `lkmc_test_pass` or `lkmc_test_fail`. +Shoud output 0. + +Test that the Internet works: + +.... +./run -a x86_64 -e '- lkmc_eval="/sbin/ifup -a;wget -S google.com;poweroff;"' +.... Source: link:rootfs_overlay/test_all.sh[]. diff --git a/bench-boot b/bench-boot index 361abba..fd5212b 100755 --- a/bench-boot +++ b/bench-boot @@ -1,9 +1,27 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" +test_size=1 +OPTIND=1 +while getopts t: OPT; do + case "$OPT" in + t) + # 1: a few seconds and important + # 2: < 5 minutes and important or a few seconds and not too important + # 3: all + test_size="$OPTARG" + ;; + ?) + exit 2 + ;; + esac +done +shift "$(($OPTIND - 1))" +extra_args="$*" + caches='--caches --l2cache --l1d_size=1024kB --l1i_size=1024kB --l2_size=1024kB --l3_size=1024kB' bench() ( - common_bench_cmd "./run -a ${1}" "$common_bench_boot" + common_bench_cmd "./run -a ${1} ${extra_args}" "$common_bench_boot" + echo >> "$common_bench_boot" ) gem5_insts() ( printf "instructions $(./gem5-stat -a "$1" sim_insts)\n" >> "$common_bench_boot" @@ -19,27 +37,35 @@ rm -f "${common_bench_boot}" arch=x86_64 bench "$arch -E '/poweroff.out'" bench "$arch -E '/poweroff.out' -K" -bench "$arch -E '/poweroff.out' -T exec_tb" -qemu_insts "$arch" -bench "$arch -E 'm5 exit' -g" -gem5_insts "$arch" +if [ "$test_size" -ge 2 ]; then + bench "$arch -E '/poweroff.out' -T exec_tb" + qemu_insts "$arch" +fi +if [ "$test_size" -ge 2 ]; then + bench "$arch -E 'm5 exit' -g" + gem5_insts "$arch" +fi #bench "$arch -E 'm5 exit' -g -- --cpu-type=DerivO3CPU ${caches}" #gem5_insts "$arch" arch=arm bench "$arch -E '/poweroff.out'" -bench "$arch -E '/poweroff.out' -T exec_tb" -qemu_insts "$arch" -bench "$arch -E 'm5 exit' -g" -gem5_insts "$arch" +if [ "$test_size" -ge 2 ]; then + bench "$arch -E '/poweroff.out' -T exec_tb" + qemu_insts "$arch" +fi +#bench "$arch -E 'm5 exit' -g" +#gem5_insts "$arch" #bench "$arch -E 'm5 exit' -g -- --cpu-type=HPI ${caches}" #gem5_insts "$arch" arch=aarch64 bench "$arch -E '/poweroff.out'" -bench "$arch -E '/poweroff.out' -T exec_tb" -qemu_insts "$arch" -bench "$arch -E 'm5 exit' -g" -gem5_insts "$arch" -bench "$arch -E 'm5 exit' -g -- --cpu-type=HPI ${caches}" -gem5_insts "$arch" +if [ "$test_size" -ge 2 ]; then + bench "$arch -E '/poweroff.out' -T exec_tb" + qemu_insts "$arch" +fi +#bench "$arch -E 'm5 exit' -g" +#gem5_insts "$arch" +#bench "$arch -E 'm5 exit' -g -- --cpu-type=HPI ${caches}" +#gem5_insts "$arch" diff --git a/build-all b/build-all index bd9133f..939f4a2 100755 --- a/build-all +++ b/build-all @@ -14,5 +14,5 @@ while getopts G OPT; do done shift "$(($OPTIND - 1))" for arch in x86_64 arm aarch64; do - ./build -a "$arch" -klq $gem5 + ./build -a "$arch" -klq $gem5 "$@" done diff --git a/eeval b/eeval index d913261..cb5264a 100755 --- a/eeval +++ b/eeval @@ -18,5 +18,9 @@ cmd="$1" outfile="${2:-/dev/null}" mkdir -p "$(dirname "$outfile")" echo "$cmd" | tee $a "$outfile" -eval "$cmd" -exit "$?" +# PIPESTATUS so that cmd="main_cmd | post_process" will return the status of cmd. +# Not POSIX. +# https://unix.stackexchange.com/questions/14270/get-exit-status-of-process-thats-piped-to-another +# https://stackoverflow.com/questions/1221833/pipe-output-and-capture-exit-status-in-bash +eval "${cmd}; cmd_exit=\${PIPESTATUS[0]}" +exit "$cmd_exit" diff --git a/gem5-bench-cache b/gem5-bench-cache index 8fc6bc2..e7e42c7 100755 --- a/gem5-bench-cache +++ b/gem5-bench-cache @@ -1,5 +1,4 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" common_gem5=true generate_checkpoints=true diff --git a/gem5-stat b/gem5-stat index 29dd169..59106d0 100755 --- a/gem5-stat +++ b/gem5-stat @@ -1,5 +1,4 @@ #!/usr/bin/env bash -set -eu . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common" common_gem5=true while getopts a:hs: OPT; do diff --git a/run b/run index 48fe5af..2152ef9 100755 --- a/run +++ b/run @@ -263,7 +263,8 @@ else serial_monitor= fi if "$kvm"; then - extra_flags="${extra_flags} -enable-kvm" + extra_flags="${extra_flags}-enable-kvm \\ +" fi if "$kgdb"; then extra_flags_qemu="${extra_flags_qemu}-serial 'tcp::${common_gdb_port},server,nowait' \\ @@ -393,10 +394,9 @@ if [ -n "${1:-}" ]; then " fi cmd="time \\ -${cmd}" +${cmd}${extra_flags}" if [ -z "$debug_vm" ]; then cmd="${cmd}\ -${extra_flags}\ |& tee >(ts -s %.s > ${common_termout_file})\ " fi diff --git a/rungdb b/rungdb index 91d4a56..aa9c85a 100755 --- a/rungdb +++ b/rungdb @@ -54,7 +54,7 @@ gdb="${common_host_dir}/usr/bin/${common_arch}-linux-gdb \\ ${before}" if "$kgdb"; then cmd="\ -${gdb} \ +${gdb}\ -q \\ -ex 'add-auto-load-safe-path $(pwd)' \\ -ex 'file vmlinux' \\ @@ -81,19 +81,18 @@ else # The lx-symbols commands gets loaded through the file vmlinux-gdb.py # which gets put on the kernel build root when python debugging scripts are enabled. cmd="\ -${gdb} \ +${gdb}\ -q \\ -ex 'add-auto-load-safe-path $(pwd)' \\ -ex 'file vmlinux' \\ -ex 'target remote localhost:${common_gdb_port}' \\ -${brk} \ +${brk}\ " fi if "$docontinue"; then - echo asdf - cmd="${cmd} \ + cmd="${cmd}\ -ex continue \\ -${lx_symbols} \ +${lx_symbols}\ " fi "${common_root_dir}/eeval" "cd '${common_linux_variant_dir}' && \\ diff --git a/test b/test new file mode 100755 index 0000000..e8e9eea --- /dev/null +++ b/test @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -eu +./bench-boot -t "${1:-1}" +./run -F '/test_all.sh;/poweroff.out' | grep -q lkmc_test_pass