Skip to content

Commit

Permalink
In ./scripts/test.py, readded external commands, tweaked subprocesses
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
geky committed Jun 6, 2022
1 parent 5a572ce commit d679fbb
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 53 deletions.
21 changes: 6 additions & 15 deletions runners/test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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},
Expand All @@ -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.",
Expand Down Expand Up @@ -724,9 +718,6 @@ int main(int argc, char **argv) {
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);
Expand Down
1 change: 0 additions & 1 deletion runners/test_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
enum test_types {
TEST_NORMAL = 0x1,
TEST_REENTRANT = 0x2,
TEST_VALGRIND = 0x4,
};

typedef uint8_t test_types_t;
Expand Down

0 comments on commit d679fbb

Please sign in to comment.