summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-26 15:45:58 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-26 15:45:58 +0800
commitffc167572a9d56c52908aebefe62ba3e3e2a9cf8 (patch)
tree9878d068dc4994dcad32c37ea6321f0995193ab2 /test
parent300859ca50c0ea5d9c17d27fd3e3538ce966e08a (diff)
downloadtalos-petitboot-ffc167572a9d56c52908aebefe62ba3e3e2a9cf8.tar.gz
talos-petitboot-ffc167572a9d56c52908aebefe62ba3e3e2a9cf8.zip
discover/grub2: Clean up error-handling for grub2 parser & lexer
Rather than printf() & exit(), use the pb logging functions and abort the parse. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'test')
-rw-r--r--test/parser/Makefile.am2
-rw-r--r--test/parser/test-grub2-lexer-error.c13
-rw-r--r--test/parser/test-grub2-parser-error.c13
3 files changed, 28 insertions, 0 deletions
diff --git a/test/parser/Makefile.am b/test/parser/Makefile.am
index 8159bd6..e7146c5 100644
--- a/test/parser/Makefile.am
+++ b/test/parser/Makefile.am
@@ -35,6 +35,8 @@ TESTS = \
test-grub2-single-line-if \
test-grub2-f18-ppc64 \
test-grub2-ubuntu-13_04-x86 \
+ test-grub2-lexer-error \
+ test-grub2-parser-error \
test-kboot-single \
test-yaboot-single \
test-yaboot-partition \
diff --git a/test/parser/test-grub2-lexer-error.c b/test/parser/test-grub2-lexer-error.c
new file mode 100644
index 0000000..503ec99
--- /dev/null
+++ b/test/parser/test-grub2-lexer-error.c
@@ -0,0 +1,13 @@
+
+#include "parser-test.h"
+
+#if 0 /* PARSER_EMBEDDED_CONFIG */
+&
+#endif
+
+void run_test(struct parser_test *test)
+{
+ test_read_conf_embedded(test);
+ test_run_parser(test, "grub2");
+ check_boot_option_count(test->ctx, 0);
+}
diff --git a/test/parser/test-grub2-parser-error.c b/test/parser/test-grub2-parser-error.c
new file mode 100644
index 0000000..a7a00a4
--- /dev/null
+++ b/test/parser/test-grub2-parser-error.c
@@ -0,0 +1,13 @@
+
+#include "parser-test.h"
+
+#if 0 /* PARSER_EMBEDDED_CONFIG */
+{
+#endif
+
+void run_test(struct parser_test *test)
+{
+ test_read_conf_embedded(test);
+ test_run_parser(test, "grub2");
+ check_boot_option_count(test->ctx, 0);
+}
OpenPOWER on IntegriCloud