run_all() takes an optional substring list; vtest_main forwards argv and a comma-separated $VT_ONLY. No filter => run everything, as before. Makes iterating on one slow end-to-end case (the engine suite) practical without a framework swap. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HPPSGhiArbvQgwC2DNiURS
30 lines
918 B
C++
30 lines
918 B
C++
// vtest_main.cpp — shared entry point for every CORE test binary.
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "vtest.hpp"
|
|
|
|
// Optional filters: each argv argument (or a comma-separated entry in $VT_ONLY) is a
|
|
// substring; a test runs only if its name contains one of them. No filters => run all.
|
|
int main(int argc, char **argv) {
|
|
std::vector<std::string> filters;
|
|
for (int i = 1; i < argc; ++i)
|
|
filters.emplace_back(argv[i]);
|
|
if (const char *env = std::getenv("VT_ONLY")) {
|
|
std::string cur;
|
|
for (const char *p = env;; ++p) {
|
|
if (*p == ',' || *p == '\0') {
|
|
if (!cur.empty())
|
|
filters.push_back(cur);
|
|
cur.clear();
|
|
if (*p == '\0')
|
|
break;
|
|
} else {
|
|
cur.push_back(*p);
|
|
}
|
|
}
|
|
}
|
|
return ::vt::run_all(filters);
|
|
}
|