Moved the test/bench runner path behind an optional flag

So now instead of needing:

  ./scripts/test.py ./runners/test_runner test_dtree

You can just do:

  ./scripts/test.py test_dtree

Or with an explicit path:

  ./scripts/test.py -R./runners/test_runner test_dtree

This makes it easier to run the script manually. And, while there may be
some hiccups with the implicit relative path, I think in general this will
make the test/bench scripts easier to use.

There was already an implicit runner path, though only if the test suite
was completely omitted. I'm not sure that would ever have actually
been useful...

---

Also increased the permutation field size in --list-*, since I noticed it
was overflowing.
This commit is contained in:
Christopher Haster
2023-10-02 00:43:51 -05:00
parent df32211bda
commit 52113c6ead
5 changed files with 24 additions and 26 deletions
+4 -4
View File
@@ -378,12 +378,12 @@ endif
## Run the tests, -j enables parallel tests
.PHONY: test
test: test-runner
./scripts/test.py $(TEST_RUNNER) $(TESTFLAGS)
./scripts/test.py -R$(TEST_RUNNER) $(TESTFLAGS)
## List the tests
.PHONY: test-list
test-list: test-runner
./scripts/test.py $(TEST_RUNNER) $(TESTFLAGS) -l
./scripts/test.py -R$(TEST_RUNNER) $(TESTFLAGS) -l
## Summarize the testmarks
.PHONY: testmarks
@@ -430,12 +430,12 @@ endif
## Run the benchmarks, -j enables parallel benchmarks
.PHONY: bench
bench: bench-runner
./scripts/bench.py $(BENCH_RUNNER) $(BENCHFLAGS)
./scripts/bench.py -R$(BENCH_RUNNER) $(BENCHFLAGS)
## List the benchmarks
.PHONY: bench-list
bench-list: bench-runner
./scripts/bench.py $(BENCH_RUNNER) $(BENCHFLAGS) -l
./scripts/bench.py -R$(BENCH_RUNNER) $(BENCHFLAGS) -l
## Summarize the benchmarks
.PHONY: benchmarks
+6 -6
View File
@@ -835,7 +835,7 @@ void perm_count(
// operations we can do
static void summary(void) {
printf("%-23s %7s %7s %7s %11s\n",
printf("%-23s %7s %7s %7s %15s\n",
"", "flags", "suites", "cases", "perms");
size_t suites = 0;
size_t cases = 0;
@@ -877,7 +877,7 @@ static void summary(void) {
sprintf(flag_buf, "%s%s",
(flags & BENCH_INTERNAL) ? "i" : "",
(!flags) ? "-" : "");
printf("%-23s %7s %7zu %7zu %11s\n",
printf("%-23s %7s %7zu %7zu %15s\n",
"TOTAL",
flag_buf,
suites,
@@ -896,7 +896,7 @@ static void list_suites(void) {
}
name_width = 4*((name_width+1+4-1)/4)-1;
printf("%-*s %7s %7s %11s\n",
printf("%-*s %7s %7s %15s\n",
name_width, "suite", "flags", "cases", "perms");
for (size_t t = 0; t < bench_id_count; t++) {
for (size_t i = 0; i < bench_suite_count; i++) {
@@ -936,7 +936,7 @@ static void list_suites(void) {
sprintf(flag_buf, "%s%s",
(bench_suites[i]->flags & BENCH_INTERNAL) ? "i" : "",
(!bench_suites[i]->flags) ? "-" : "");
printf("%-*s %7s %7zu %11s\n",
printf("%-*s %7s %7zu %15s\n",
name_width,
bench_suites[i]->name,
flag_buf,
@@ -959,7 +959,7 @@ static void list_cases(void) {
}
name_width = 4*((name_width+1+4-1)/4)-1;
printf("%-*s %7s %11s\n", name_width, "case", "flags", "perms");
printf("%-*s %7s %15s\n", name_width, "case", "flags", "perms");
for (size_t t = 0; t < bench_id_count; t++) {
for (size_t i = 0; i < bench_suite_count; i++) {
bench_define_suite(bench_suites[i]);
@@ -991,7 +991,7 @@ static void list_cases(void) {
? "i" : "",
(!bench_suites[i]->cases[j].flags)
? "-" : "");
printf("%-*s %7s %11s\n",
printf("%-*s %7s %15s\n",
name_width,
bench_suites[i]->cases[j].name,
flag_buf,
+6 -6
View File
@@ -864,7 +864,7 @@ void perm_count(
// operations we can do
static void summary(void) {
printf("%-23s %7s %7s %7s %11s\n",
printf("%-23s %7s %7s %7s %15s\n",
"", "flags", "suites", "cases", "perms");
size_t suites = 0;
size_t cases = 0;
@@ -909,7 +909,7 @@ static void summary(void) {
(flags & TEST_REENTRANT) ? "r" : "",
(flags & TEST_INTERNAL) ? "i" : "",
(!flags) ? "-" : "");
printf("%-23s %7s %7zu %7zu %11s\n",
printf("%-23s %7s %7zu %7zu %15s\n",
"TOTAL",
flag_buf,
suites,
@@ -928,7 +928,7 @@ static void list_suites(void) {
}
name_width = 4*((name_width+1+4-1)/4)-1;
printf("%-*s %7s %7s %11s\n",
printf("%-*s %7s %7s %15s\n",
name_width, "suite", "flags", "cases", "perms");
for (size_t t = 0; t < test_id_count; t++) {
for (size_t i = 0; i < test_suite_count; i++) {
@@ -971,7 +971,7 @@ static void list_suites(void) {
(test_suites[i]->flags & TEST_REENTRANT) ? "r" : "",
(test_suites[i]->flags & TEST_INTERNAL) ? "i" : "",
(!test_suites[i]->flags) ? "-" : "");
printf("%-*s %7s %7zu %11s\n",
printf("%-*s %7s %7zu %15s\n",
name_width,
test_suites[i]->name,
flag_buf,
@@ -994,7 +994,7 @@ static void list_cases(void) {
}
name_width = 4*((name_width+1+4-1)/4)-1;
printf("%-*s %7s %11s\n", name_width, "case", "flags", "perms");
printf("%-*s %7s %15s\n", name_width, "case", "flags", "perms");
for (size_t t = 0; t < test_id_count; t++) {
for (size_t i = 0; i < test_suite_count; i++) {
test_define_suite(test_suites[i]);
@@ -1030,7 +1030,7 @@ static void list_cases(void) {
? "i" : "",
(!test_suites[i]->cases[j].flags)
? "-" : "");
printf("%-*s %7s %11s\n",
printf("%-*s %7s %15s\n",
name_width,
test_suites[i]->cases[j].name,
flag_buf,
+4 -5
View File
@@ -1429,15 +1429,14 @@ if __name__ == "__main__":
# bench flags
bench_parser = parser.add_argument_group('bench options')
bench_parser.add_argument(
'runner',
nargs='?',
type=lambda x: x.split(),
help="Bench runner to use for benching. Defaults to %r." % RUNNER_PATH)
bench_parser.add_argument(
'bench_ids',
nargs='*',
help="Description of benches to run.")
bench_parser.add_argument(
'-R', '--runner',
type=lambda x: x.split(),
help="Bench runner to use for benching. Defaults to %r." % RUNNER_PATH)
bench_parser.add_argument(
'-Y', '--summary',
action='store_true',
+4 -5
View File
@@ -1457,15 +1457,14 @@ if __name__ == "__main__":
# test flags
test_parser = parser.add_argument_group('test options')
test_parser.add_argument(
'runner',
nargs='?',
type=lambda x: x.split(),
help="Test runner to use for testing. Defaults to %r." % RUNNER_PATH)
test_parser.add_argument(
'test_ids',
nargs='*',
help="Description of tests to run.")
test_parser.add_argument(
'-R', '--runner',
type=lambda x: x.split(),
help="Test runner to use for testing. Defaults to %r." % RUNNER_PATH)
test_parser.add_argument(
'-Y', '--summary',
action='store_true',