Skip to content

Commit

Permalink
Remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
Sir-NoChill committed Sep 8, 2024
1 parent 6b30ab5 commit 615a369
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 78 deletions.
1 change: 0 additions & 1 deletion include/testharness/TestHarness.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class TestHarness {

private:
// test running
bool runTestsForToolChain(std::string tcId, std::string exeName);
void threadRunTestsForToolChain(std::string tcId, std::string exeName);

// helper for formatting tester output
Expand Down
77 changes: 0 additions & 77 deletions src/testharness/TestHarness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,83 +185,6 @@ void TestHarness::threadRunTestsForToolChain(std::string tcName, std::string exe
}
}

bool TestHarness::runTestsForToolChain(std::string exeName, std::string tcName) {
bool failed = false;

ToolChain toolChain = cfg.getToolChain(tcName); // Get the toolchain to use.
const fs::path& exe = cfg.getExecutablePath(exeName); // Set the toolchain's exe to be tested.
toolChain.setTestedExecutable(exe);

if (cfg.hasRuntime(exeName)) // If we have a runtime, set that as well.
toolChain.setTestedRuntime(cfg.getRuntimePath(exeName));
else
toolChain.setTestedRuntime("");

std::cout << "\nTesting executable: " << exeName << " -> " << exe << '\n';
std::cout << "With toolchain: " << tcName << " -> " << toolChain.getBriefDescription() << '\n';

unsigned int toolChainCount = 0, toolChainPasses = 0; // Stat tracking for toolchain tests.

// Iterate over each package.
for (auto& [packageName, package] : testSet) {
std::cout << "Entering package: " << packageName << '\n';
unsigned int packageCount = 0, packagePasses = 0;

// Iterate over each subpackage
for (auto& [subPackageName, subPackage] : package) {
std::cout << " Entering subpackage: " << subPackageName << '\n';
unsigned int subPackagePasses = 0, subPackageSize = subPackage.size();

// Iterate over each test in the package
for (size_t i = 0; i < subPackage.size(); ++i) {
std::unique_ptr<TestFile>& test = subPackage[i].first;
if (test->getParseError() == ParseError::NoError) {

TestResult result = runTest(test.get(), toolChain, cfg);
// keep the result with the test for pretty printing
std::optional<TestResult> res_clone = std::make_optional(result.clone());
subPackage[i].second.swap(res_clone);

results.addResult(exeName, tcName, subPackageName, result);
printTestResult(test.get(), result);

if (result.pass) {
++packagePasses;
++subPackagePasses;
} else {
failed = true;
}
} else {
std::cout << " " << (Colors::YELLOW + "[INVALID]" + Colors::RESET) << " "
<< test->getTestPath().stem().string() << '\n';
--subPackageSize;
}
}
std::cout << " Subpackage passed " << subPackagePasses << " / " << subPackageSize << '\n';
// Track how many tests we run.
packageCount += subPackageSize;
}

// Update the toolchain stats from the package stats.
toolChainPasses += packagePasses;
toolChainCount += packageCount;

std::cout << " Package passed " << packagePasses << " / " << packageCount << '\n';
}

std::cout << "Toolchain passed " << toolChainPasses << " / " << toolChainCount << "\n\n";
std::cout << "Invalid " << invalidTests.size() << " / " << toolChainCount + invalidTests.size()
<< "\n";

for (auto& test : invalidTests) {
std::cout << " Skipped: " << test.first->getTestPath().filename().stem() << std::endl
<< " Error: " << Colors::YELLOW << test.first->getParseErrorMsg() << Colors::RESET << "\n";
}
std::cout << "\n";

return failed;
}

bool isTestFile(const fs::path& path) {
return (fs::exists(path)
&& !fs::is_directory(path)
Expand Down

0 comments on commit 615a369

Please sign in to comment.