mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
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
This commit is contained in:
42
README.adoc
42
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 fetch up
|
||||||
git rebase --onto "$next_mainline_revision" "$last_mainline_revision"
|
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.
|
# And update the README to show off.
|
||||||
git commit -m "linux: update to ${next_mainline_revision}"
|
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.
|
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.
|
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
|
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`.
|
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]:
|
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
|
===== Guest testing
|
||||||
|
|
||||||
....
|
Build for all stable archs and run basic fast tests:
|
||||||
./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:
|
|
||||||
|
|
||||||
....
|
....
|
||||||
./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[].
|
Source: link:rootfs_overlay/test_all.sh[].
|
||||||
|
|
||||||
|
|||||||
58
bench-boot
58
bench-boot
@@ -1,9 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu
|
|
||||||
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
|
. "$(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'
|
caches='--caches --l2cache --l1d_size=1024kB --l1i_size=1024kB --l2_size=1024kB --l3_size=1024kB'
|
||||||
bench() (
|
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() (
|
gem5_insts() (
|
||||||
printf "instructions $(./gem5-stat -a "$1" sim_insts)\n" >> "$common_bench_boot"
|
printf "instructions $(./gem5-stat -a "$1" sim_insts)\n" >> "$common_bench_boot"
|
||||||
@@ -19,27 +37,35 @@ rm -f "${common_bench_boot}"
|
|||||||
arch=x86_64
|
arch=x86_64
|
||||||
bench "$arch -E '/poweroff.out'"
|
bench "$arch -E '/poweroff.out'"
|
||||||
bench "$arch -E '/poweroff.out' -K"
|
bench "$arch -E '/poweroff.out' -K"
|
||||||
bench "$arch -E '/poweroff.out' -T exec_tb"
|
if [ "$test_size" -ge 2 ]; then
|
||||||
qemu_insts "$arch"
|
bench "$arch -E '/poweroff.out' -T exec_tb"
|
||||||
bench "$arch -E 'm5 exit' -g"
|
qemu_insts "$arch"
|
||||||
gem5_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}"
|
#bench "$arch -E 'm5 exit' -g -- --cpu-type=DerivO3CPU ${caches}"
|
||||||
#gem5_insts "$arch"
|
#gem5_insts "$arch"
|
||||||
|
|
||||||
arch=arm
|
arch=arm
|
||||||
bench "$arch -E '/poweroff.out'"
|
bench "$arch -E '/poweroff.out'"
|
||||||
bench "$arch -E '/poweroff.out' -T exec_tb"
|
if [ "$test_size" -ge 2 ]; then
|
||||||
qemu_insts "$arch"
|
bench "$arch -E '/poweroff.out' -T exec_tb"
|
||||||
bench "$arch -E 'm5 exit' -g"
|
qemu_insts "$arch"
|
||||||
gem5_insts "$arch"
|
fi
|
||||||
|
#bench "$arch -E 'm5 exit' -g"
|
||||||
|
#gem5_insts "$arch"
|
||||||
#bench "$arch -E 'm5 exit' -g -- --cpu-type=HPI ${caches}"
|
#bench "$arch -E 'm5 exit' -g -- --cpu-type=HPI ${caches}"
|
||||||
#gem5_insts "$arch"
|
#gem5_insts "$arch"
|
||||||
|
|
||||||
arch=aarch64
|
arch=aarch64
|
||||||
bench "$arch -E '/poweroff.out'"
|
bench "$arch -E '/poweroff.out'"
|
||||||
bench "$arch -E '/poweroff.out' -T exec_tb"
|
if [ "$test_size" -ge 2 ]; then
|
||||||
qemu_insts "$arch"
|
bench "$arch -E '/poweroff.out' -T exec_tb"
|
||||||
bench "$arch -E 'm5 exit' -g"
|
qemu_insts "$arch"
|
||||||
gem5_insts "$arch"
|
fi
|
||||||
bench "$arch -E 'm5 exit' -g -- --cpu-type=HPI ${caches}"
|
#bench "$arch -E 'm5 exit' -g"
|
||||||
gem5_insts "$arch"
|
#gem5_insts "$arch"
|
||||||
|
#bench "$arch -E 'm5 exit' -g -- --cpu-type=HPI ${caches}"
|
||||||
|
#gem5_insts "$arch"
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ while getopts G OPT; do
|
|||||||
done
|
done
|
||||||
shift "$(($OPTIND - 1))"
|
shift "$(($OPTIND - 1))"
|
||||||
for arch in x86_64 arm aarch64; do
|
for arch in x86_64 arm aarch64; do
|
||||||
./build -a "$arch" -klq $gem5
|
./build -a "$arch" -klq $gem5 "$@"
|
||||||
done
|
done
|
||||||
|
|||||||
8
eeval
8
eeval
@@ -18,5 +18,9 @@ cmd="$1"
|
|||||||
outfile="${2:-/dev/null}"
|
outfile="${2:-/dev/null}"
|
||||||
mkdir -p "$(dirname "$outfile")"
|
mkdir -p "$(dirname "$outfile")"
|
||||||
echo "$cmd" | tee $a "$outfile"
|
echo "$cmd" | tee $a "$outfile"
|
||||||
eval "$cmd"
|
# PIPESTATUS so that cmd="main_cmd | post_process" will return the status of cmd.
|
||||||
exit "$?"
|
# 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"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu
|
|
||||||
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
|
||||||
common_gem5=true
|
common_gem5=true
|
||||||
generate_checkpoints=true
|
generate_checkpoints=true
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu
|
|
||||||
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
|
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
|
||||||
common_gem5=true
|
common_gem5=true
|
||||||
while getopts a:hs: OPT; do
|
while getopts a:hs: OPT; do
|
||||||
|
|||||||
6
run
6
run
@@ -263,7 +263,8 @@ else
|
|||||||
serial_monitor=
|
serial_monitor=
|
||||||
fi
|
fi
|
||||||
if "$kvm"; then
|
if "$kvm"; then
|
||||||
extra_flags="${extra_flags} -enable-kvm"
|
extra_flags="${extra_flags}-enable-kvm \\
|
||||||
|
"
|
||||||
fi
|
fi
|
||||||
if "$kgdb"; then
|
if "$kgdb"; then
|
||||||
extra_flags_qemu="${extra_flags_qemu}-serial 'tcp::${common_gdb_port},server,nowait' \\
|
extra_flags_qemu="${extra_flags_qemu}-serial 'tcp::${common_gdb_port},server,nowait' \\
|
||||||
@@ -393,10 +394,9 @@ if [ -n "${1:-}" ]; then
|
|||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
cmd="time \\
|
cmd="time \\
|
||||||
${cmd}"
|
${cmd}${extra_flags}"
|
||||||
if [ -z "$debug_vm" ]; then
|
if [ -z "$debug_vm" ]; then
|
||||||
cmd="${cmd}\
|
cmd="${cmd}\
|
||||||
${extra_flags}\
|
|
||||||
|& tee >(ts -s %.s > ${common_termout_file})\
|
|& tee >(ts -s %.s > ${common_termout_file})\
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
|
|||||||
11
rungdb
11
rungdb
@@ -54,7 +54,7 @@ gdb="${common_host_dir}/usr/bin/${common_arch}-linux-gdb \\
|
|||||||
${before}"
|
${before}"
|
||||||
if "$kgdb"; then
|
if "$kgdb"; then
|
||||||
cmd="\
|
cmd="\
|
||||||
${gdb} \
|
${gdb}\
|
||||||
-q \\
|
-q \\
|
||||||
-ex 'add-auto-load-safe-path $(pwd)' \\
|
-ex 'add-auto-load-safe-path $(pwd)' \\
|
||||||
-ex 'file vmlinux' \\
|
-ex 'file vmlinux' \\
|
||||||
@@ -81,19 +81,18 @@ else
|
|||||||
# The lx-symbols commands gets loaded through the file vmlinux-gdb.py
|
# 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.
|
# which gets put on the kernel build root when python debugging scripts are enabled.
|
||||||
cmd="\
|
cmd="\
|
||||||
${gdb} \
|
${gdb}\
|
||||||
-q \\
|
-q \\
|
||||||
-ex 'add-auto-load-safe-path $(pwd)' \\
|
-ex 'add-auto-load-safe-path $(pwd)' \\
|
||||||
-ex 'file vmlinux' \\
|
-ex 'file vmlinux' \\
|
||||||
-ex 'target remote localhost:${common_gdb_port}' \\
|
-ex 'target remote localhost:${common_gdb_port}' \\
|
||||||
${brk} \
|
${brk}\
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
if "$docontinue"; then
|
if "$docontinue"; then
|
||||||
echo asdf
|
cmd="${cmd}\
|
||||||
cmd="${cmd} \
|
|
||||||
-ex continue \\
|
-ex continue \\
|
||||||
${lx_symbols} \
|
${lx_symbols}\
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
"${common_root_dir}/eeval" "cd '${common_linux_variant_dir}' && \\
|
"${common_root_dir}/eeval" "cd '${common_linux_variant_dir}' && \\
|
||||||
|
|||||||
Reference in New Issue
Block a user