Package: grub2 / 2.02~beta3-5+deb9u2

syslinux-test-out-of-tree.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
From f00d3163dfde3fb528aee59912748d9d25282a69 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Sun, 18 Sep 2016 17:26:00 +0100
Subject: 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
---
 Makefile.am                            |  6 ------
 tests/syslinux/ubuntu10.04_grub.cfg.in | 30 +++++++++++++++---------------
 tests/syslinux_test.in                 | 14 ++++++++++----
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 00a9663b3..bc9030350 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -460,9 +460,3 @@ ChangeLog: FORCE
 	fi
 
 EXTRA_DIST += ChangeLog ChangeLog-2015
-
-syslinux_test: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg
-
-tests/syslinux/ubuntu10.04_grub.cfg: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg.in
-	(for x in tests/syslinux/ubuntu10.04_grub.cfg.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
-CLEANFILES += tests/syslinux/ubuntu10.04_grub.cfg
diff --git a/tests/syslinux/ubuntu10.04_grub.cfg.in b/tests/syslinux/ubuntu10.04_grub.cfg.in
index 846e4acf0..f285afb1e 100644
--- a/tests/syslinux/ubuntu10.04_grub.cfg.in
+++ b/tests/syslinux/ubuntu10.04_grub.cfg.in
@@ -1,4 +1,4 @@
-  background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux'/'splash.png'
+  background_image '@dir@/ubuntu10.04/isolinux'/'splash.png'
 # D-I config version 2.0
   # UNSUPPORTED command 'menu hshift 13'
   # UNSUPPORTED command 'menu width 49'
@@ -41,7 +41,7 @@ menuentry 'Test memory' --hotkey 'm' --id 'memtest' {
   linux$linux_suffix '/'/'/install/mt86plus' 
 }
 menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' {
-# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/gtk.cfg not found
+# File (host)/@dir@/ubuntu10.04/isolinux/gtk.cfg not found
   # UNSUPPORTED command 'menu begin advanced'
   # UNSUPPORTED command 'menu title Advanced options'
   # UNSUPPORTED command 'menu color title	* #FFFFFFFF *'
@@ -63,15 +63,15 @@ menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' {
 }
 menuentry 'Back..' --hotkey 'b' --id 'mainmenu' {
   # UNSUPPORTED command 'menu exit'
-# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/adgtk.cfg not found
+# File (host)/@dir@/ubuntu10.04/isolinux/adgtk.cfg not found
   # UNSUPPORTED command 'menu end'
   # UNSUPPORTED entry type 0
 true;
 }
 menuentry 'Help' --hotkey 'h' --id 'help' {
   # UNSUPPORTED command 'ui gfxboot bootlogo'
-#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg:
-  background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'splash.png'
+#'@dir@/ubuntu10.04/isolinux'/'prompt.cfg' (host)@dir@/ubuntu10.04/isolinux/prompt.cfg:
+  background_image '@dir@/ubuntu10.04/isolinux/'/'splash.png'
   # UNSUPPORTED command 'display f1.txt'
   # UNSUPPORTED command 'menu hshift 13'
   # UNSUPPORTED command 'menu width 49'
@@ -114,7 +114,7 @@ menuentry 'Test memory' --hotkey 'm' --id 'memtest' {
   linux$linux_suffix '/'/'/install/mt86plus' 
 }
 menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' {
-# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//gtk.cfg not found
+# File (host)/@dir@/ubuntu10.04/isolinux//gtk.cfg not found
   # UNSUPPORTED command 'menu begin advanced'
   # UNSUPPORTED command 'menu title Advanced options'
   # UNSUPPORTED command 'menu color title	* #FFFFFFFF *'
@@ -136,14 +136,14 @@ menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' {
 }
 menuentry 'Back..' --hotkey 'b' --id 'mainmenu' {
   # UNSUPPORTED command 'menu exit'
-# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//adgtk.cfg not found
+# File (host)/@dir@/ubuntu10.04/isolinux//adgtk.cfg not found
   # UNSUPPORTED command 'menu end'
   # UNSUPPORTED entry type 0
 true;
 }
 menuentry 'Help' --hotkey 'h' --id 'help' {
-#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg:
-  syslinux_configfile -r '/'/'/' -c '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'' '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'prompt.cfg'
+#'@dir@/ubuntu10.04/isolinux/'/'prompt.cfg' (host)@dir@/ubuntu10.04/isolinux/prompt.cfg:
+  syslinux_configfile -r '/'/'/' -c '@dir@/ubuntu10.04/isolinux/'/'' '@dir@/ubuntu10.04/isolinux/'/'prompt.cfg'
 }
 menuentry 'menu' --id 'menu' {
   # UNSUPPORTED command 'f1 f1.txt'
@@ -156,8 +156,8 @@ menuentry 'menu' --id 'menu' {
   # UNSUPPORTED command 'f8 f8.txt'
   # UNSUPPORTED command 'f9 f9.txt'
   # UNSUPPORTED command 'f0 f10.txt'
-#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/'/'isolinux.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg:
-  background_image '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'splash.png'
+#'@dir@/ubuntu10.04/isolinux/'/'isolinux.cfg' (host)@dir@/ubuntu10.04/isolinux/isolinux.cfg:
+  background_image '@dir@/ubuntu10.04/isolinux//'/'splash.png'
 # D-I config version 2.0
   # UNSUPPORTED command 'menu hshift 13'
   # UNSUPPORTED command 'menu width 49'
@@ -200,7 +200,7 @@ menuentry 'Test memory' --hotkey 'm' --id 'memtest' {
   linux$linux_suffix '/'/'/install/mt86plus' 
 }
 menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' {
-# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux///gtk.cfg not found
+# File (host)/@dir@/ubuntu10.04/isolinux///gtk.cfg not found
   # UNSUPPORTED command 'menu begin advanced'
   # UNSUPPORTED command 'menu title Advanced options'
   # UNSUPPORTED command 'menu color title	* #FFFFFFFF *'
@@ -222,15 +222,15 @@ menuentry 'Boot from first hard disk' --hotkey 'b' --id 'hd' {
 }
 menuentry 'Back..' --hotkey 'b' --id 'mainmenu' {
   # UNSUPPORTED command 'menu exit'
-# File (host)/@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux///adgtk.cfg not found
+# File (host)/@dir@/ubuntu10.04/isolinux///adgtk.cfg not found
   # UNSUPPORTED command 'menu end'
   # UNSUPPORTED entry type 0
 true;
 }
 menuentry 'Help' --hotkey 'h' --id 'help' {
   # UNSUPPORTED command 'ui gfxboot bootlogo'
-#'@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg' (host)@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/prompt.cfg:
-  syslinux_configfile -r '/'/'/' -c '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'' '@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux//'/'prompt.cfg'
+#'@dir@/ubuntu10.04/isolinux//'/'prompt.cfg' (host)@dir@/ubuntu10.04/isolinux/prompt.cfg:
+  syslinux_configfile -r '/'/'/' -c '@dir@/ubuntu10.04/isolinux//'/'' '@dir@/ubuntu10.04/isolinux//'/'prompt.cfg'
 }
 }
 }
diff --git a/tests/syslinux_test.in b/tests/syslinux_test.in
index fc4edd8ef..4ba94c576 100644
--- a/tests/syslinux_test.in
+++ b/tests/syslinux_test.in
@@ -2,15 +2,21 @@
 
 set -e
 
+tdir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
 outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
 
-"@builddir@/grub-syslinux2cfg" -r "@abs_top_srcdir@/tests/syslinux/ubuntu10.04" "@abs_top_srcdir@/tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg" -o "$outfile"
+cp -a "@top_srcdir@/tests/syslinux/ubuntu10.04" "$tdir/ubuntu10.04"
 
-echo "$outfile"
+"@builddir@/grub-syslinux2cfg" -r "$tdir/ubuntu10.04" "$tdir/ubuntu10.04/isolinux/isolinux.cfg" -o "$tdir/observed.cfg"
 
-if ! diff -u "$outfile" "@builddir@/tests/syslinux/ubuntu10.04_grub.cfg"; then
+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"
-  exit 1;
+  rm -rf "$tdir"
+  exit 1
 fi
 
+rm -rf "$tdir"
 exit 0