Commit 62936820 authored by Mark Andrews's avatar Mark Andrews

Add the ability select individual tests to rdata_test

parent a9c33747
......@@ -21,8 +21,9 @@
#include <unistd.h>
#define UNIT_TESTING
#include <cmocka.h>
#include <isc/cmocka.h>
#include <isc/commandline.h>
#include <isc/hex.h>
#include <isc/lex.h>
#include <isc/print.h>
......@@ -2656,14 +2657,44 @@ main(int argc, char **argv) {
cmocka_unit_test_setup_teardown(atparent, NULL, NULL),
cmocka_unit_test_setup_teardown(iszonecutauth, NULL, NULL),
};
struct CMUnitTest selected[sizeof(tests) / sizeof(tests[0])];
size_t i;
int c;
UNUSED(argv);
memset(selected, 0, sizeof(selected));
if (argc > 1) {
debug = true;
while ((c = isc_commandline_parse(argc, argv, "dlt:")) != -1) {
switch (c) {
case 'd':
debug = true;
break;
case 'l':
for (i = 0; i < (sizeof(tests) / sizeof(tests[0])); i++)
{
if (tests[i].name != NULL) {
fprintf(stdout, "%s\n", tests[i].name);
}
}
return (0);
case 't':
if (!cmocka_add_test_byname(
tests, isc_commandline_argument, selected))
{
fprintf(stderr, "unknown test '%s'\n",
isc_commandline_argument);
exit(1);
}
break;
default:
break;
}
}
return (cmocka_run_group_tests(tests, NULL, NULL));
if (selected[0].name != NULL) {
return (cmocka_run_group_tests(selected, NULL, NULL));
} else {
return (cmocka_run_group_tests(tests, NULL, NULL));
}
}
#else /* HAVE_CMOCKA */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment