grub2: bring back build of aros-side grub2 tools
[AROS.git] / arch / all-pc / boot / grub2-aros / tests / grub_cmd_test.in
blob6269891c9eeddb70f42da372e5636089e666818d
1 #! /bin/bash
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
10 . "@builddir@/grub-core/modinfo.sh"
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"
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
28 if ! test -e $grub_empty; then
29 echo FAIL2
31 if test -d $grub_empty; then
32 echo FAIL3
34 if ! test -d $grub_dir; then
35 echo FAIL4
37 if test -s $grub_empty; then
38 echo FAIL5
40 if ! test -s $grub_non_empty; then
41 echo FAIL6
43 if test -f $grub_empty -a foo = bar; then
44 echo FAIL7
46 if test -e $grub_empty -a foo = bar; then
47 echo FAIL8
49 if test -s $grub_non_empty -a foo = bar; then
50 echo FAIL9
52 if test -d $grub_dir -a foo = bar; then
53 echo FAIL10
56 EOF
58 rm -f "$empty" "$non_empty"
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