More progress toward test-runner feature parity

- Added internal tests, which can run tests inside other source files,
  allowing access to "private" functions and data

  Note this required a special bit of handling our defining and later
  undefining test configurations to not polute the namespace of the
  source file, since it can end up with test cases from different
  suites/configuration namespaces.

- Removed unnecessary/unused permutation argument to generated test
  functions.

- Some cleanup to progress output of test.py.
This commit is contained in:
Christopher Haster
2022-05-01 21:13:13 -05:00
parent 4962829017
commit be0e6ad5eb
3 changed files with 140 additions and 108 deletions
+3 -3
View File
@@ -218,7 +218,7 @@ static void test_case_permcount(
test_define_geometry(&test_geometries[geom_perm]);
if (case_->filter) {
if (!case_->filter(case_perm)) {
if (!case_->filter()) {
continue;
}
}
@@ -495,7 +495,7 @@ static void run(void) {
// filter?
if (test_suites[i]->cases[j]->filter) {
if (!test_suites[i]->cases[j]->filter(case_perm)) {
if (!test_suites[i]->cases[j]->filter()) {
printf("skipped %s#%zu\n",
test_suites[i]->cases[j]->id,
perm);
@@ -538,7 +538,7 @@ static void run(void) {
// run the test
printf("running %s#%zu\n", test_suites[i]->cases[j]->id, perm);
test_suites[i]->cases[j]->run(&cfg, case_perm);
test_suites[i]->cases[j]->run(&cfg);
printf("finished %s#%zu\n", test_suites[i]->cases[j]->id, perm);
+2 -2
View File
@@ -24,8 +24,8 @@ struct test_case {
const test_define_t *const *defines;
const uint8_t *define_map;
bool (*filter)(uint32_t perm);
void (*run)(struct lfs_config *cfg, uint32_t perm);
bool (*filter)(void);
void (*run)(struct lfs_config *cfg);
};
struct test_suite {