tpm2_key_protector: Enable build for powerpc_ieee1275
[grub.git] / tests / grub_cmd_test.in
blob043c3a634b3167219a1b0e5a94e368e93069a11a
1 #! @BUILD_SHEBANG@
2 set -e
4 # create a randome file
5 empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
6 non_empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
7 cat >$non_empty <<EOF
8 hello world!
9 EOF
11 . "@builddir@/grub-core/modinfo.sh"
13 if [ x"${grub_modinfo_platform}" = xemu ]; then
14     grub_empty="(host)$empty"
15     grub_non_empty="(host)$non_empty"
16     grub_dir="(host)${TMPDIR:-/tmp}"
17 else
18     grub_empty="/boot/empty"
19     grub_non_empty="/boot/non_empty"
20     grub_dir="/boot/grub"
24 outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
25 @builddir@/grub-shell --files=$grub_empty=$empty  --files=$grub_non_empty=$non_empty>$outfile <<EOF
26 if ! test -f $grub_empty; then
27   echo FAIL1
29 if ! test -e $grub_empty; then
30   echo FAIL2
32 if test -d $grub_empty; then
33   echo FAIL3
35 if ! test -d $grub_dir; then
36   echo FAIL4
38 if test -s $grub_empty; then
39   echo FAIL5
41 if ! test -s $grub_non_empty; then
42   echo FAIL6
44 if test -f $grub_empty -a foo = bar; then
45   echo FAIL7
47 if test -e $grub_empty -a foo = bar; then
48   echo FAIL8
50 if test -s $grub_non_empty -a foo = bar; then
51   echo FAIL9
53 if test -d $grub_dir -a foo = bar; then
54   echo FAIL10
57 EOF
59 rm -f "$empty" "$non_empty"
61 if grep FAIL "$outfile" > /dev/null 2>&1; then
62     echo "GRUB test command file tests failed."
63     cat "$outfile"
64     exit 1
65 else
66     rm -f "${outfile}"
67     exit 0