Commit 6f3df775 authored by Noah Orensa's avatar Noah Orensa
Browse files

add --module argument to select specific test modules to run

parent 13fccc8a
......@@ -74,6 +74,8 @@ protected:
private:
void _skip();
void _run();
public:
......@@ -165,6 +167,7 @@ public:
static bool runAll(
const std::vector<std::pair<std::string, std::string>> &config = {},
const std::unordered_set<std::string> &modules = {},
std::ostream &out = std::cout
);
......
......@@ -10,13 +10,15 @@
#include <dtest_core/util.h>
#include <vector>
#include <string>
#include <unordered_set>
using namespace dtest;
static std::vector<std::string> dynamicTests;
bool runWorker = false;
uint32_t workerId = 0;
static bool runWorker = false;
static uint32_t workerId = 0;
static std::unordered_set<std::string> modules;
static void loadTests(const char *path) {
std::cerr << "Loading " << path << "\n";
......@@ -74,6 +76,8 @@ void printHelp() {
" --driver <address> Connects to a remote test driver at <address>.\n"
" --worker-id <id> Runs a test worker, using <id> as its unique\n"
" identifier.\n"
" --module <test-module> Runs one or more test modules and skips all other\n"
" tests.\n"
"\n\n"
;
}
......@@ -99,6 +103,9 @@ void parseArguments(int argc, char *argv[], const char *cwd) {
else if (strcasecmp(argv[i], "--worker-id") == 0) {
workerId = atoi(argv[++i]);
}
else if (strcasecmp(argv[i], "--module") == 0) {
modules.insert(argv[++i]);
}
else if (strcasecmp(argv[i], "-h") == 0 || strcasecmp(argv[i], "--help") == 0) {
printHelp();
exit(0);
......@@ -151,6 +158,7 @@ int main(int argc, char *argv[]) {
{ "working_dir", cwd },
{ "loaded_test_files", jsonify(dynamicTests, 2) },
},
modules,
logFile
);
logFile.close();
......
......@@ -8,6 +8,11 @@ using namespace dtest;
///////////////////////////////////////////////////////////////////////////////
void Test::_skip() {
_status = Status::SKIP;
_success = true;
}
void Test::_run() {
if (_enabled) {
......@@ -40,8 +45,7 @@ void Test::_run() {
_detailedReport = s.str();
}
else {
_status = Status::SKIP;
_success = true;
_skip();
}
}
......@@ -109,6 +113,7 @@ void Test::setGlobalModuleDependencies(
bool Test::runAll(
const std::vector<std::pair<std::string, std::string>> &config,
const std::unordered_set<std::string> &modules,
std::ostream &out
) {
......@@ -196,7 +201,8 @@ bool Test::runAll(
std::cerr << "RUNNING TEST #" << testnum << " " << shortTestName << " ";
}
test->_run();
if (modules.empty() || modules.count(test->_module) != 0) test->_run();
else test->_skip();
if (test->_status == Status::SKIP) {
if (_logStatsToStderr) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment