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