diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:03:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:03:26 +0000 |
commit | fe42aa9fe8c20c7d1d6d45228e9c30f11695e0e1 (patch) | |
tree | 53466f3b71d405ea01a4a2227d64f84ea3ff4f69 /run_qemu.sh | |
parent | Adding upstream version 1.5.0. (diff) | |
download | mmdebstrap-fe42aa9fe8c20c7d1d6d45228e9c30f11695e0e1.tar.xz mmdebstrap-fe42aa9fe8c20c7d1d6d45228e9c30f11695e0e1.zip |
Adding upstream version 1.5.1.upstream/1.5.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'run_qemu.sh')
-rwxr-xr-x | run_qemu.sh | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/run_qemu.sh b/run_qemu.sh index fc00ed9..a51493b 100755 --- a/run_qemu.sh +++ b/run_qemu.sh @@ -4,6 +4,7 @@ set -eu : "${DEFAULT_DIST:=unstable}" : "${cachedir:=./shared/cache}" +: "${MMDEBSTRAP_TESTS_DEBUG:=no}" tmpdir="$(mktemp -d)" cleanup() { @@ -29,20 +30,42 @@ fi touch shared/output.txt setpriv --pdeathsig TERM tail -f shared/output.txt & -# to connect to serial use: -# minicom -D 'unix#/tmp/ttyS0' -# -# or this (quit with ctrl+q): -# socat stdin,raw,echo=0,escape=0x11 unix-connect:/tmp/ttyS0 -ret=0 -timeout --foreground 40m debvm-run --image="$(realpath "$cachedir")/debian-$DEFAULT_DIST.ext4" -- \ - -nic none \ - -m 4G -snapshot \ +set -- timeout --foreground 40m \ + debvm-run --image="$(realpath "$cachedir")/debian-$DEFAULT_DIST.ext4" \ + -- +cpuname=$(lscpu | awk '/Model name:/ {print $3}' | tr '\n' '+') +ncpu=$(lscpu | awk '/Core\(s\) per socket:/ {print $4}' | tr '\n' '+') +if [ "$cpuname" = "Cortex-A53+Cortex-A73+" ] && [ "$ncpu" = "2+4+" ]; then + # crude detection of the big.LITTLE heterogeneous setup of cores on the + # amlogic a311d bananapi + # + # https://lists.nongnu.org/archive/html/qemu-devel/2020-10/msg08494.html + # https://gitlab.com/qemu-project/qemu/-/issues/239 + # https://segments.zhan.science/posts/kvm_on_pinehone_pro/#trouble-with-heterogeneous-architecture + set -- taskset --cpu-list 2,3,4,5 "$@" -smp 4 +fi + +set -- "$@" -nic none -m 4G -snapshot + +if [ "$MMDEBSTRAP_TESTS_DEBUG" = "no" ]; then + # to connect to serial use: + # minicom -D 'unix#/tmp/ttyS0' + # or this (quit with ctrl+q): + # socat stdin,raw,echo=0,escape=0x11 unix-connect:/tmp/ttyS0 + set -- "$@" \ -monitor unix:/tmp/monitor,server,nowait \ -serial unix:/tmp/ttyS0,server,nowait \ - -serial unix:/tmp/ttyS1,server,nowait \ - -virtfs local,id=mmdebstrap,path="$(pwd)/shared",security_model=none,mount_tag=mmdebstrap \ - >"$tmpdir/log" 2>&1 || ret=$? + -serial unix:/tmp/ttyS1,server,nowait +fi + +set -- "$@" -virtfs local,id=mmdebstrap,path="$(pwd)/shared",security_model=none,mount_tag=mmdebstrap + +ret=0 +if [ "$MMDEBSTRAP_TESTS_DEBUG" = "no" ]; then + "$@" >"$tmpdir/log" 2>&1 || ret=$? +else + "$@" 2>&1 | tee "$tmpdir/log" || ret=$? +fi if [ "$ret" -ne 0 ]; then cat "$tmpdir/log" exit $ret |