grub2/tests/syslinux_test.in
Colin Watson 0bcc9fc48a syslinux_test: Fix out-of-tree build handling
When doing out-of-tree builds, abs_top_srcdir may well contain ".."
segments, and grub-syslinux2cfg canonicalises its --root argument.  As a
result, the expansion of @abs_top_srcdir@ may not match what
grub-syslinux2cfg produces.

It's somewhat difficult to portably canonicalize a path in shell, and
autoconf/automake don't offer any support for this.  But there's a much
simpler option: copy the test data to a temporary directory and make
substitutions in the expected output file based on that.

Forwarded: http://lists.gnu.org/archive/html/grub-devel/2016-09/msg00013.html
Last-Update: 2016-09-19

Patch-Name: syslinux-test-out-of-tree.patch
2017-06-23 11:35:06 +01:00

23 lines
608 B
Bash

#!/bin/sh
set -e
tdir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
cp -a "@top_srcdir@/tests/syslinux/ubuntu10.04" "$tdir/ubuntu10.04"
"@builddir@/grub-syslinux2cfg" -r "$tdir/ubuntu10.04" "$tdir/ubuntu10.04/isolinux/isolinux.cfg" -o "$tdir/observed.cfg"
echo "$tdir/observed.cfg"
sed -e "s,@dir@,$tdir,g" "@top_srcdir@/tests/syslinux/ubuntu10.04_grub.cfg.in" >"$tdir/expected.cfg"
if ! diff -u "$tdir/observed.cfg" "$tdir/expected.cfg"; then
echo "Mismatch in ubuntu10.04"
rm -rf "$tdir"
exit 1
fi
rm -rf "$tdir"
exit 0