test/parser: Error on invalid parser name
authorJeremy Kerr <jk@ozlabs.org>
Mon, 6 May 2013 03:09:31 +0000 (11:09 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 16 May 2013 03:53:34 +0000 (11:53 +0800)
We should error-out if we didn't find a valid parser, so it doesn't look
like we found no boot options.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
test/parser/utils.c

index a1d0ad24b590d9938dcdd12ed00b3548137d1e97..69b0006d1f25c6263b8f58f76e02ad6cd466ab36 100644 (file)
@@ -131,7 +131,12 @@ int test_run_parser(struct parser_test *test, const char *parser_name)
                        continue;
                test->ctx->parser = parser;
                rc = parser->parse(test->ctx, test->conf.buf, test->conf.size);
+               break;
        }
 
+       if (i == n_parsers)
+               errx(EXIT_FAILURE, "%s: parser '%s' not found",
+                               __func__, parser_name);
+
        return rc;
 }