
+while true +do + [ $# -eq 0 ] && break + case "$1" in + -h|--help) + help;; + -d|--debug) + export DEBUG=true;;
^--- if the first times use '-d' option, 'DEBUG' will be env variable; when the second times run the script, whether 'DEBUG' will still be effective?
export effect current shell and subshell
Nice. -------- Thanks Yu Chuan
Thanks, Shenwei
Thanks, Liushaofei
+ *) + log_error "Unknown param: $1" + help + exit 1;; + esac + shift +done + [[ $tbox_group ]] || tbox_group=vm-2p8g export hostname=$tbox_group.$USER-$$ diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index 93977ec15438..ec8c00887283 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -122,11 +122,11 @@ set_qemu()
print_message() { - echo SCHED_PORT: $SCHED_PORT - echo kernel: $kernel - echo initrds: $initrds - echo append: $append - echo less $log_file + log_info SCHED_PORT: $SCHED_PORT + log_info kernel: $kernel + log_info initrds: $initrds + log_info append: $append + [ "$DEBUG" == "true" ] || log_info less $log_file
sleep 5 } @@ -143,9 +143,10 @@ public_option() -k en-us -no-reboot -nographic - -serial file:${log_file} -monitor null ) + + [ "$DEBUG" == "true" ] || kvm=("${kvm[@]}" -serial file:${log_file}) }
individual_option() diff --git a/providers/qemu/pxe.sh b/providers/qemu/pxe.sh index fa688331964a..0ba052c8276e 100755 --- a/providers/qemu/pxe.sh +++ b/providers/qemu/pxe.sh @@ -4,6 +4,10 @@ # - nr_cpu # - memory
+: ${LKP_SRC:="/c/lkp-tests"} + +source ${LKP_SRC}/lib/log.sh + : ${nr_cpu:=1} : ${memory:=1G}
@@ -18,7 +22,7 @@ fi qemu=qemu-system-aarch64 command -v $qemu >/dev/null || qemu=qemu-kvm
-echo less $serial_log +[ "$DEBUG" == "true" ] || log_info less $serial_log
kvm=( $qemu @@ -33,7 +37,9 @@ kvm=( -k en-us -no-reboot -nographic - -serial file:${serial_log} -monitor null ) + +[ "$DEBUG" == "true" ] || kvm=("${kvm[@]}" -serial file:${serial_log}) + "${kvm[@]}" -- 2.23.0