Skip to content

Commit

Permalink
REMOVE: FW: Test mgmt refactor: preserve the order of the tests.
Browse files Browse the repository at this point in the history
This should not be needed and we do not actually guarantee any
particular order of the tests. Instead the unit test must be fixed to
account of that, perhaps.
  • Loading branch information
busykai committed Mar 14, 2024
1 parent bad7233 commit ad28ae3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions framework/sandstone_tests.cpp
Expand Up @@ -2,13 +2,13 @@
#include "sandstone_p.h"
#include "sandstone_tests.h"

static std::span<struct test> known_tests;
static std::map<const char *, struct test *, SandstoneTestSet::cstr_cmp> all_test_map; /* maps test name to test */
static std::map<const char *, std::vector <struct test *>, SandstoneTestSet::cstr_cmp> all_group_map; /* maps group name to a vector of tests it contains */
static bool initialized = false;

void SandstoneTestSet::init(enum InitSet init_set)
{
std::span<struct test> known_tests;
switch (init_set) {
case REGULAR_TESTS:
known_tests = regular_tests;
Expand All @@ -19,7 +19,7 @@ void SandstoneTestSet::init(enum InitSet init_set)
default:
break;
}
for (struct test &t: known_tests) {
for (struct test &t : known_tests) {
all_test_map[t.id] = &t;
for (auto ptr = t.groups; ptr && *ptr; ++ptr) {
if (!all_group_map.contains((*ptr)->id)) {
Expand All @@ -41,9 +41,9 @@ std::vector<struct test *> SandstoneTestSet::lookup(const char *name)
std::vector<struct test*> res;
if (!name || !strlen(name)) return res;
if (strchr(name, '*')) { /* if it has an asterisk, it's a glob, so expand it. */
for (auto pair : all_test_map) {
if (!fnmatch(name, pair.first, 0))
res.push_back(pair.second);
for (struct test &t : known_tests) {
if (!fnmatch(name, t.id, 0))
res.push_back(&t);
}
} else if (name[0] == '@') { /* it's a group name */
const char *group_name = name + 1;
Expand All @@ -55,6 +55,7 @@ std::vector<struct test *> SandstoneTestSet::lookup(const char *name)
struct test *t = all_test_map.at(name);
res.push_back(t);
} catch(const std::out_of_range &e) {
fprintf(stderr, "Test not found: %s\n", name);
}
}
return res;
Expand Down

0 comments on commit ad28ae3

Please sign in to comment.