In ./scripts/test.py, readded external commands, tweaked subprocesses

- Added --exec for wrapping the test-runner with external commands, such as
  Qemu or Valgrind.

- Added --valgrind, which just aliases --exec=valgrind with a few extra
  flags useful during testing.

- Dropped the "valgrind" type for tests. These aren't separate tests
  that run in the test-runner, and I don't see a need for disabling
  Valgrind for any tests. This can be added back later if needed.

- Readded support for dropping directly into gdb after a test failure,
  either at the assert failure, entry point of test case, or entry point
  of the test runner with --gdb, --gdb-case, or --gdb-main.

- Added --isolate for running each test permutation in its own process,
  this is required for associating Valgrind errors with the right test
  case.

- Fixed an issue where explicit test identifier conflicted with
  per-stage test identifiers generated as a part of --by-suite and
  --by-case.
This commit is contained in:
Christopher Haster
2022-05-08 09:51:14 -05:00
parent 5a572ced3c
commit d679fbb389
3 changed files with 103 additions and 53 deletions
+6 -15
View File
@@ -235,10 +235,9 @@ static void summary(void) {
char perm_buf[64];
sprintf(perm_buf, "%zu/%zu", filtered, perms);
char type_buf[64];
sprintf(type_buf, "%s%s%s",
sprintf(type_buf, "%s%s",
(types & TEST_NORMAL) ? "n" : "",
(types & TEST_REENTRANT) ? "r" : "",
(types & TEST_VALGRIND) ? "V" : "");
(types & TEST_REENTRANT) ? "r" : "");
printf("%-36s %7s %7zu %7zu %11s\n",
"TOTAL",
type_buf,
@@ -270,10 +269,9 @@ static void list_suites(void) {
char perm_buf[64];
sprintf(perm_buf, "%zu/%zu", filtered, perms);
char type_buf[64];
sprintf(type_buf, "%s%s%s",
sprintf(type_buf, "%s%s",
(test_suites[i]->types & TEST_NORMAL) ? "n" : "",
(test_suites[i]->types & TEST_REENTRANT) ? "r" : "",
(test_suites[i]->types & TEST_VALGRIND) ? "V" : "");
(test_suites[i]->types & TEST_REENTRANT) ? "r" : "");
printf("%-36s %7s %7zu %11s\n",
test_suites[i]->id,
type_buf,
@@ -305,10 +303,9 @@ static void list_cases(void) {
char perm_buf[64];
sprintf(perm_buf, "%zu/%zu", filtered, perms);
char type_buf[64];
sprintf(type_buf, "%s%s%s",
sprintf(type_buf, "%s%s",
(types & TEST_NORMAL) ? "n" : "",
(types & TEST_REENTRANT) ? "r" : "",
(types & TEST_VALGRIND) ? "V" : "");
(types & TEST_REENTRANT) ? "r" : "");
printf("%-36s %7s %11s\n",
test_suites[i]->cases[j]->id,
type_buf,
@@ -532,7 +529,6 @@ enum opt_flags {
OPT_GEOMETRY = 'G',
OPT_NORMAL = 'n',
OPT_REENTRANT = 'r',
OPT_VALGRIND = 'V',
OPT_START = 5,
OPT_STEP = 6,
OPT_STOP = 7,
@@ -555,7 +551,6 @@ const struct option long_opts[] = {
{"geometry", required_argument, NULL, OPT_GEOMETRY},
{"normal", no_argument, NULL, OPT_NORMAL},
{"reentrant", no_argument, NULL, OPT_REENTRANT},
{"valgrind", no_argument, NULL, OPT_VALGRIND},
{"start", required_argument, NULL, OPT_START},
{"stop", required_argument, NULL, OPT_STOP},
{"step", required_argument, NULL, OPT_STEP},
@@ -577,7 +572,6 @@ const char *const help_text[] = {
"Filter by geometry.",
"Filter for normal tests. Can be combined.",
"Filter for reentrant tests. Can be combined.",
"Filter for Valgrind tests. Can be combined.",
"Start at the nth test.",
"Stop before the nth test.",
"Only run every n tests, calculated after --start and --stop.",
@@ -724,9 +718,6 @@ invalid_define:
case OPT_REENTRANT:
test_types |= TEST_REENTRANT;
break;
case OPT_VALGRIND:
test_types |= TEST_VALGRIND;
break;
case OPT_START: {
char *parsed = NULL;
test_start = strtoumax(optarg, &parsed, 0);
-1
View File
@@ -8,7 +8,6 @@
enum test_types {
TEST_NORMAL = 0x1,
TEST_REENTRANT = 0x2,
TEST_VALGRIND = 0x4,
};
typedef uint8_t test_types_t;