]>
Commit | Line | Data |
---|---|---|
a827807a | 1 | #! @BUILD_SHEBANG@ |
1e047e53 AB |
2 | |
3 | # create a randome file | |
4 | empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 | |
5 | non_empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 | |
6 | cat >$non_empty <<EOF | |
7 | hello world! | |
8 | EOF | |
9 | ||
10 | . "@builddir@/grub-core/modinfo.sh" | |
11 | ||
12 | if [ x"${grub_modinfo_platform}" = xemu ]; then | |
13 | grub_empty="(host)$empty" | |
14 | grub_non_empty="(host)$non_empty" | |
15 | grub_dir="(host)${TMPDIR:-/tmp}" | |
16 | else | |
17 | grub_empty="/boot/empty" | |
18 | grub_non_empty="/boot/non_empty" | |
19 | grub_dir="/boot/grub" | |
20 | fi | |
21 | ||
22 | ||
23 | outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 | |
24 | @builddir@/grub-shell --files=$grub_empty=$empty --files=$grub_non_empty=$non_empty>$outfile <<EOF | |
25 | if ! test -f $grub_empty; then | |
26 | echo FAIL1 | |
27 | fi | |
28 | if ! test -e $grub_empty; then | |
29 | echo FAIL2 | |
30 | fi | |
31 | if test -d $grub_empty; then | |
32 | echo FAIL3 | |
33 | fi | |
34 | if ! test -d $grub_dir; then | |
35 | echo FAIL4 | |
36 | fi | |
37 | if test -s $grub_empty; then | |
38 | echo FAIL5 | |
39 | fi | |
40 | if ! test -s $grub_non_empty; then | |
41 | echo FAIL6 | |
42 | fi | |
43 | if test -f $grub_empty -a foo = bar; then | |
44 | echo FAIL7 | |
45 | fi | |
46 | if test -e $grub_empty -a foo = bar; then | |
47 | echo FAIL8 | |
48 | fi | |
49 | if test -s $grub_non_empty -a foo = bar; then | |
50 | echo FAIL9 | |
51 | fi | |
52 | if test -d $grub_dir -a foo = bar; then | |
53 | echo FAIL10 | |
54 | fi | |
55 | ||
56 | EOF | |
57 | ||
58 | rm -f "$empty" "$non_empty" | |
59 | ||
60 | if grep FAIL "$outfile" > /dev/null 2>&1; then | |
61 | echo "GRUB test command file tests failed." | |
62 | cat "$outfile" | |
63 | exit 1 | |
64 | else | |
65 | rm -f "${outfile}" | |
66 | exit 0 | |
67 | fi |