From 4b94e3227b611a381e96ab41899cd4e8682f995d Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Fri, 5 Dec 2014 19:55:59 +0300 Subject: [PATCH 128/506] grub-shell: support --files also for net boot This allows running tests that require extra files using netboot as well. --- ChangeLog | 4 ++++ tests/util/grub-shell.in | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 46f049d..c163cd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-12-05 Andrei Borzenkov + + * tests/util/grub-shell.in: Support --files also for netboot. + 2014-12-01 Andrei Borzenkov * grub-core/loader/i386/xen_fileXX.c (grub_xen_get_infoXX): Fix diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index d9a5253..5b66139 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -422,11 +422,28 @@ do_trim () fi } +copy_extra_files() { + _destdir="$1" + shift + + # FIXME support '=' in file names + for _file in "$@"; do + _target="${_file%=*}" + _source="${_file#*=}" + [ -n "$_source" ] || _source="$_target" + _target="$_destdir/$_target" + _targetdir="$(dirname "$_target")" + [ -d "$_targetdir" ] || mkdir -p "$_targetdir" + cp "$_source" "$_target" + done +} + if [ x$boot = xnet ]; then netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 pkgdatadir="@builddir@" "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" ${mkrescue_args} > /dev/null cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" cp "${source}" "$netdir/boot/grub/testcase.cfg" + [ -z "$files" ] || copy_extra_files "$netdir" $files 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 | cat | tr -d "\r" | do_trim elif [ x$boot = xemu ]; then grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")" -- 2.4.3