test/parser: Error on invalid parser name
[petitboot] / 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;
 }