From: Andrei Borzenkov Date: Fri, 30 Jan 2015 18:42:46 +0000 (+0300) Subject: tests: add test command file tests X-Git-Tag: 2.02-beta3~447 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e047e53aeb684a3a21a4269a99c708c381b96b5;p=thirdparty%2Fgrub.git tests: add test command file tests This requires access to files in both host and grub image, so implementing as separate test unit instead of script test was more easy. --- diff --git a/Makefile.util.def b/Makefile.util.def index fed96d864..378b5777a 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -1156,6 +1156,12 @@ script = { common = tests/file_filter_test.in; }; +script = { + testcase; + name = grub_cmd_test; + common = tests/grub_cmd_test.in; +}; + program = { testcase; name = example_unit_test; diff --git a/tests/grub_cmd_test.in b/tests/grub_cmd_test.in new file mode 100644 index 000000000..6269891c9 --- /dev/null +++ b/tests/grub_cmd_test.in @@ -0,0 +1,67 @@ +#! /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 <$outfile < /dev/null 2>&1; then + echo "GRUB test command file tests failed." + cat "$outfile" + exit 1 +else + rm -f "${outfile}" + exit 0 +fi