vaseboot/tests/VasEBoot_cmd_test.in

68 lines
1.4 KiB
Bash

#! /bin/bash
# create a randome file
empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
non_empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
cat >$non_empty <<EOF
hello world!
EOF
. "@builddir@/VasEBoot-core/modinfo.sh"
if [ x"${VasEBoot_modinfo_platform}" = xemu ]; then
VasEBoot_empty="(host)$empty"
VasEBoot_non_empty="(host)$non_empty"
VasEBoot_dir="(host)${TMPDIR:-/tmp}"
else
VasEBoot_empty="/boot/empty"
VasEBoot_non_empty="/boot/non_empty"
VasEBoot_dir="/boot/VasEBoot"
fi
outfile="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
@builddir@/VasEBoot-shell --files=$VasEBoot_empty=$empty --files=$VasEBoot_non_empty=$non_empty>$outfile <<EOF
if ! test -f $VasEBoot_empty; then
echo FAIL1
fi
if ! test -e $VasEBoot_empty; then
echo FAIL2
fi
if test -d $VasEBoot_empty; then
echo FAIL3
fi
if ! test -d $VasEBoot_dir; then
echo FAIL4
fi
if test -s $VasEBoot_empty; then
echo FAIL5
fi
if ! test -s $VasEBoot_non_empty; then
echo FAIL6
fi
if test -f $VasEBoot_empty -a foo = bar; then
echo FAIL7
fi
if test -e $VasEBoot_empty -a foo = bar; then
echo FAIL8
fi
if test -s $VasEBoot_non_empty -a foo = bar; then
echo FAIL9
fi
if test -d $VasEBoot_dir -a foo = bar; then
echo FAIL10
fi
EOF
rm -f "$empty" "$non_empty"
if grep FAIL "$outfile" > /dev/null 2>&1; then
echo "VasEBoot test command file tests failed."
cat "$outfile"
exit 1
else
rm -f "${outfile}"
exit 0
fi