diff options
author | John Hodge <tpg@mutabah.net> | 2017-09-22 18:38:10 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-09-22 18:38:10 +0800 |
commit | d0c9d063a1f19b64fa11c846a98d5ce46c1912d4 (patch) | |
tree | 014ef3394a4dbd3910c4f1ceaaf2801991dd79c4 /tools | |
parent | 286d5d37627665d3b1a9cbbdf01b4e86f3fa0336 (diff) | |
download | mrust-d0c9d063a1f19b64fa11c846a98d5ce46c1912d4.tar.gz |
testrunner - Move running of tests to enumeration
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testrunner/main.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/tools/testrunner/main.cpp b/tools/testrunner/main.cpp index c5903014..81dc4686 100644 --- a/tools/testrunner/main.cpp +++ b/tools/testrunner/main.cpp @@ -67,12 +67,16 @@ int main(int argc, const char* argv[]) { auto exceptions_list = ::helpers::path(opts.exceptions_file); } + auto outdir = opts.output_dir ? ::helpers::path(opts.output_dir) : throw ""; ::std::vector<TestDesc> tests; // 1. Take input glob/folder and enumerate .rs files/matches // - If input path is a folder, find *.rs // - Otherwise, accept glob. + // 2. Open each file and extract the various flags required. + // 3. Build each test to its own output subdirectory + // 4. Run tests { auto input_path = ::helpers::path(opts.input_glob); #ifdef _WIN32 @@ -120,7 +124,20 @@ int main(int argc, const char* argv[]) td.m_name.pop_back(); td.m_path = test_file_path; + + auto test = td; + tests.push_back(td); + DEBUG(">> " << test.m_name); + auto depdir = outdir / "deps-" + test.m_name.c_str(); + + for(const auto& file : test.m_pre_build) + { + run_compiler(file, depdir); + } + run_compiler(test.m_path, outdir, outdir); + // - Run the test + run_executable(outdir / test.m_name, {}); #ifndef _WIN32 } closedir(dp); @@ -130,25 +147,6 @@ int main(int argc, const char* argv[]) #endif } - // 2. Open each file and extract the various flags required. - - // 3. Build each test to its own output subdirectory - auto outdir = opts.output_dir ? ::helpers::path(opts.output_dir) : throw ""; - for(const auto& test : tests) - { - DEBUG("> " << test.m_name); - auto depdir = outdir / "deps-" + test.m_name.c_str(); - - for(const auto& file : test.m_pre_build) - { - run_compiler(file, depdir); - } - run_compiler(test.m_path, outdir, outdir); - run_executable(outdir / test.m_name, {}); - } - - // 4. Run tests - return 0; } |