From: Glenn Washburn Date: Sat, 21 Jan 2023 06:10:45 +0000 (-0600) Subject: tests/util/grub-shell: Create run.sh in working directory for easily running test... X-Git-Tag: grub-2.12-rc1~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73f2e7381532a2c191bb59c92a2f53c12404c628;p=thirdparty%2Fgrub.git tests/util/grub-shell: Create run.sh in working directory for easily running test again Now it becomes trivial to re-run a test from the output in its working directory. This also makes it easy to send a reproducible failing test to the mailing list. This has allowed a refactor so that the duplicated code to call QEMU has be condensed (e.g. the use of timeout and file descriptor redirection). The run.sh script will pass any arguments given to QEMU. This allows QEMU to be easily started in a state ready for GDB to be attached. Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper --- diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 60494bcf1..658485f7e 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -521,8 +521,11 @@ if [ x$boot = xnet ]; then cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" cp "${source}" "$netdir/boot/grub/testcase.cfg" [ -z "$files" ] || copy_extra_files "$netdir" $files - setup_qemu_logger - timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic > "$work_directory/qemu-pipe" || ret=$? + cat >"$work_directory/run.sh" < "$work_directory/qemu-pipe" || ret=$? + cat >"$work_directory/run.sh" <"$work_directory/run.sh" < "$work_directory/qemu-pipe" || ret=$? + chmod +x "$work_directory/run.sh" + timeout -s KILL $timeout "$work_directory/run.sh" > "$work_directory/qemu-pipe" || ret=$? fi wait @@ -565,6 +582,7 @@ fi test -n "$debug" || rm -f "${isofile}" test -n "$debug" || rm -rf "${rom_directory}" test -n "$debug" || rm -f "${tmpfile}" "${cfgfile}" "${goutfile}" +test -n "$debug" || rm -f "$work_directory/run.sh" exit $ret