test/TestRunner.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2026 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #include <string> | ||
| 4 | #include <unordered_set> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include <gtest/gtest.h> | ||
| 8 | |||
| 9 | #include <SourceFile.h> | ||
| 10 | #include <driver/Driver.h> | ||
| 11 | #include <exception/CompilerError.h> | ||
| 12 | #include <exception/LexerError.h> | ||
| 13 | #include <exception/LinkerError.h> | ||
| 14 | #include <exception/ParserError.h> | ||
| 15 | #include <exception/SemanticError.h> | ||
| 16 | #include <global/GlobalResourceManager.h> | ||
| 17 | #include <global/TypeRegistry.h> | ||
| 18 | #include <llvm/IR/Module.h> | ||
| 19 | #include <llvm/TargetParser/Triple.h> | ||
| 20 | #include <symboltablebuilder/Scope.h> | ||
| 21 | #include <symboltablebuilder/SymbolTable.h> | ||
| 22 | #include <typechecker/FunctionManager.h> | ||
| 23 | #include <typechecker/InterfaceManager.h> | ||
| 24 | #include <typechecker/StructManager.h> | ||
| 25 | #include <util/SystemUtil.h> | ||
| 26 | |||
| 27 | #include "driver/TestDriver.h" | ||
| 28 | #include "util/TestUtil.h" | ||
| 29 | |||
| 30 | using namespace spice::compiler; | ||
| 31 | |||
| 32 | namespace spice::testing { | ||
| 33 | |||
| 34 | extern TestDriverCliOptions testDriverCliOptions; | ||
| 35 | |||
| 36 | namespace { | ||
| 37 | |||
| 38 | /** | ||
| 39 | * Re-run the IR generator for the given source file, discarding the module that was built for it before. | ||
| 40 | * | ||
| 41 | * Since the IR generator emits parts of the IR depending on the selected opt level, a module can only be used to check | ||
| 42 | * the dump of the opt level it was generated for. | ||
| 43 | * | ||
| 44 | * @param sourceFile Source file to re-generate the IR for | ||
| 45 | */ | ||
| 46 | 37 | void reGenerateIR(SourceFile *sourceFile) { | |
| 47 | // Rewind the stage marker, so that the IR generator does not consider this file as already done | ||
| 48 | 37 | sourceFile->previousStage = DEP_GRAPH_VISUALIZER; | |
| 49 | 37 | sourceFile->runIRGenerator(); | |
| 50 | 37 | } | |
| 51 | |||
| 52 | /** | ||
| 53 | * Re-run the IR generator for the given source file and all its (transitive) dependencies, dependencies first. | ||
| 54 | * | ||
| 55 | * This is only required for LTO builds, where the modules of all source files are merged into the LTO module, which is | ||
| 56 | * the one that gets dumped. Without LTO, only the module of the main source file ends up in the dump, so re-generating | ||
| 57 | * the dependencies would be wasted work. | ||
| 58 | * | ||
| 59 | * @param sourceFile Source file to re-generate the IR for | ||
| 60 | * @param visitedSet Already visited source files (guards against cycles, caused by circular imports) | ||
| 61 | */ | ||
| 62 | 2 | void reGenerateIRForLTO(SourceFile *sourceFile, std::unordered_set<const SourceFile *> &visitedSet) { // NOLINT(misc-no-recursion) | |
| 63 |
1/2✗ Branch 3 → 4 not taken.
✓ Branch 3 → 5 taken 2 times.
|
2 | if (!visitedSet.insert(sourceFile).second) |
| 64 | ✗ | return; | |
| 65 | |||
| 66 | // Re-generate the dependencies first, mirroring the order of SourceFile::runBackEnd() | ||
| 67 |
5/8✓ Branch 5 → 6 taken 2 times.
✗ Branch 5 → 18 not taken.
✓ Branch 6 → 7 taken 2 times.
✗ Branch 6 → 18 not taken.
✓ Branch 7 → 8 taken 2 times.
✗ Branch 7 → 18 not taken.
✓ Branch 13 → 9 taken 1 time.
✓ Branch 13 → 14 taken 2 times.
|
3 | for (SourceFile *dependency : sourceFile->dependencies | std::views::values) |
| 68 |
1/2✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 18 not taken.
|
1 | reGenerateIRForLTO(dependency, visitedSet); |
| 69 | |||
| 70 | 2 | reGenerateIR(sourceFile); | |
| 71 | |||
| 72 | // The optimizer stages of the main source file are driven by the test runner itself. All other files run their | ||
| 73 | // pre-link optimization as part of their own back end, so it has to be repeated here. | ||
| 74 |
2/2✓ Branch 15 → 16 taken 1 time.
✓ Branch 15 → 17 taken 1 time.
|
2 | if (!sourceFile->isMainFile) |
| 75 | 1 | sourceFile->runPreLinkIROptimizer(); | |
| 76 | } | ||
| 77 | |||
| 78 | } // namespace | ||
| 79 | |||
| 80 | 580 | static void execTestCase(const TestCase &testCase) { | |
| 81 | // Check if test is disabled | ||
| 82 |
3/4✓ Branch 2 → 3 taken 580 times.
✗ Branch 2 → 761 not taken.
✓ Branch 3 → 4 taken 3 times.
✓ Branch 3 → 10 taken 577 times.
|
580 | if (TestUtil::isDisabled(testCase)) |
| 83 |
3/6✓ Branch 4 → 5 taken 3 times.
✗ Branch 4 → 394 not taken.
✓ Branch 5 → 6 taken 3 times.
✗ Branch 5 → 391 not taken.
✓ Branch 6 → 7 taken 3 times.
✗ Branch 6 → 389 not taken.
|
3 | GTEST_SKIP(); |
| 84 | |||
| 85 | // Create fake cli options | ||
| 86 |
2/4✓ Branch 10 → 11 taken 577 times.
✗ Branch 10 → 397 not taken.
✓ Branch 11 → 12 taken 577 times.
✗ Branch 11 → 395 not taken.
|
577 | const std::filesystem::path mainSourceFilePath = testCase.testPath / REF_NAME_SOURCE; |
| 87 | 577 | CliOptions cliOptions = { | |
| 88 | /* mainSourceFile= */ mainSourceFilePath, | ||
| 89 | /* targetTriple= */ {}, | ||
| 90 | − | /* targetArch= */ TARGET_UNKNOWN, // GCOV_EXCL_LINE - coverage tool bug | |
| 91 | ✗ | /* targetVendor= */ TARGET_UNKNOWN, | |
| 92 | ✗ | /* targetOs= */ TARGET_UNKNOWN, | |
| 93 | /* isNativeTarget= */ true, | ||
| 94 | /* useCPUFeatures*/ false, // Disabled because it makes the refs differ on different machines | ||
| 95 | /* execute= */ false, // If we set this to 'true', the compiler will not emit object files | ||
| 96 | /* cacheDir= */ "./cache", | ||
| 97 | /* outputDir= */ "./", | ||
| 98 | /* outputPath= */ "", | ||
| 99 | /* buildMode= */ BuildMode::DEBUG, | ||
| 100 | /* outputContainer= */ OutputContainer::EXECUTABLE, | ||
| 101 | // Compile serially: the test cases are already spread over processes by gtest-parallel, so a parallel back end | ||
| 102 | // would only oversubscribe the machine, and the reference outputs stay strictly deterministic this way. | ||
| 103 | /* compileJobCount= */ 1, | ||
| 104 | /* ignoreCache */ true, | ||
| 105 | ✗ | /* llvmArgs= */ "", | |
| 106 | /* printDebugOutput= */ false, | ||
| 107 | CliOptions::DumpSettings{ | ||
| 108 | /* dumpCST= */ false, | ||
| 109 | /* dumpAST= */ false, | ||
| 110 | /* dumpSymbolTables= */ false, | ||
| 111 | /* dumpTypes= */ false, | ||
| 112 | /* dumpCacheStats= */ false, | ||
| 113 | /* dumpDependencyGraph= */ false, | ||
| 114 | /* dumpIR= */ false, | ||
| 115 | /* dumpAssembly= */ false, | ||
| 116 | /* dumpObjectFile= */ false, | ||
| 117 | /* dumpToFiles= */ false, | ||
| 118 | /* abortAfterDump */ false, | ||
| 119 | }, | ||
| 120 | /* namesForIRValues= */ true, | ||
| 121 | /* useLifetimeMarkers= */ false, | ||
| 122 | /* useTBAAMetadata */ false, | ||
| 123 | /* optLevel= */ OptLevel::O0, | ||
| 124 | /* useLTO= */ false, | ||
| 125 | /* backend= */ Backend::LLVM, | ||
| 126 |
2/4✓ Branch 31 → 32 taken 577 times.
✗ Branch 31 → 406 not taken.
✓ Branch 32 → 33 taken 577 times.
✗ Branch 32 → 404 not taken.
|
1154 | /* noEntryFct= */ exists(testCase.testPath / CTL_RUN_BUILTIN_TESTS), |
| 127 |
2/4✓ Branch 34 → 35 taken 577 times.
✗ Branch 34 → 400 not taken.
✓ Branch 35 → 36 taken 577 times.
✗ Branch 35 → 398 not taken.
|
1154 | /* generateTestMain= */ exists(testCase.testPath / CTL_RUN_BUILTIN_TESTS), |
| 128 | /* staticLinking= */ false, | ||
| 129 | CliOptions::InstrumentationSettings{ | ||
| 130 | /* generateDebugInfo= */ false, | ||
| 131 | /* sanitizer= */ Sanitizer::NONE, | ||
| 132 | }, | ||
| 133 | /* disableVerifier= */ false, | ||
| 134 | /* testMode= */ true, | ||
| 135 | /* comparableOutput= */ true, | ||
| 136 | /* buildVars= */ {}, | ||
| 137 |
19/56✓ Branch 13 → 14 taken 577 times.
✗ Branch 13 → 759 not taken.
✓ Branch 17 → 18 taken 577 times.
✗ Branch 17 → 440 not taken.
✓ Branch 20 → 21 taken 577 times.
✗ Branch 20 → 434 not taken.
✓ Branch 23 → 24 taken 577 times.
✗ Branch 23 → 428 not taken.
✓ Branch 24 → 25 taken 577 times.
✗ Branch 24 → 425 not taken.
✓ Branch 25 → 26 taken 577 times.
✗ Branch 25 → 422 not taken.
✓ Branch 26 → 27 taken 577 times.
✗ Branch 26 → 419 not taken.
✓ Branch 29 → 30 taken 577 times.
✗ Branch 29 → 413 not taken.
✓ Branch 30 → 31 taken 577 times.
✗ Branch 30 → 408 not taken.
✓ Branch 33 → 34 taken 577 times.
✗ Branch 33 → 402 not taken.
✗ Branch 41 → 42 not taken.
✓ Branch 41 → 43 taken 577 times.
✗ Branch 44 → 45 not taken.
✓ Branch 44 → 46 taken 577 times.
✗ Branch 46 → 47 not taken.
✓ Branch 46 → 48 taken 577 times.
✗ Branch 48 → 49 not taken.
✓ Branch 48 → 50 taken 577 times.
✗ Branch 50 → 51 not taken.
✓ Branch 50 → 52 taken 577 times.
✗ Branch 53 → 54 not taken.
✓ Branch 53 → 55 taken 577 times.
✗ Branch 56 → 57 not taken.
✓ Branch 56 → 58 taken 577 times.
✗ Branch 59 → 60 not taken.
✓ Branch 59 → 61 taken 577 times.
✗ Branch 61 → 62 not taken.
✓ Branch 61 → 63 taken 577 times.
✗ Branch 410 → 411 not taken.
✗ Branch 410 → 412 not taken.
✗ Branch 416 → 417 not taken.
✗ Branch 416 → 418 not taken.
✗ Branch 419 → 420 not taken.
✗ Branch 419 → 421 not taken.
✗ Branch 422 → 423 not taken.
✗ Branch 422 → 424 not taken.
✗ Branch 425 → 426 not taken.
✗ Branch 425 → 427 not taken.
✗ Branch 431 → 432 not taken.
✗ Branch 431 → 433 not taken.
✗ Branch 437 → 438 not taken.
✗ Branch 437 → 439 not taken.
✗ Branch 443 → 444 not taken.
✗ Branch 443 → 445 not taken.
✗ Branch 446 → 447 not taken.
✗ Branch 446 → 448 not taken.
|
6924 | }; |
| 138 | static_assert(sizeof(CliOptions::DumpSettings) == 11, "CliOptions::DumpSettings struct size changed"); | ||
| 139 | static_assert(sizeof(CliOptions::InstrumentationSettings) == 2, "CliOptions::InstrumentationSettings struct size changed"); | ||
| 140 | #if defined(__clang__) && defined(__apple_build_version__) | ||
| 141 | // some std types for Apple Clang are smaller than for GCC and Clang | ||
| 142 | static_assert(sizeof(CliOptions) == 312, "CliOptions struct size changed"); | ||
| 143 | #else | ||
| 144 | static_assert(sizeof(CliOptions) == 440, "CliOptions struct size changed"); | ||
| 145 | #endif | ||
| 146 | |||
| 147 | // Parse test args | ||
| 148 |
1/2✓ Branch 65 → 66 taken 577 times.
✗ Branch 65 → 449 not taken.
|
1154 | std::vector<std::string> args = {"spice", "build"}; |
| 149 |
1/2✓ Branch 67 → 68 taken 577 times.
✗ Branch 67 → 755 not taken.
|
577 | TestUtil::parseTestArgs(cliOptions.mainSourceFile, args); |
| 150 |
2/4✓ Branch 68 → 69 taken 577 times.
✗ Branch 68 → 454 not taken.
✓ Branch 69 → 70 taken 577 times.
✗ Branch 69 → 452 not taken.
|
577 | args.push_back(mainSourceFilePath.string()); |
| 151 | |||
| 152 | 577 | bool explicitlySelectedTarget = false; | |
| 153 | 577 | std::vector<const char *> argv; | |
| 154 |
1/2✓ Branch 72 → 73 taken 577 times.
✗ Branch 72 → 753 not taken.
|
577 | argv.reserve(args.size()); |
| 155 |
2/2✓ Branch 91 → 75 taken 1794 times.
✓ Branch 91 → 92 taken 577 times.
|
2948 | for (const std::string &arg : args) { |
| 156 |
2/2✓ Branch 78 → 79 taken 5 times.
✓ Branch 78 → 80 taken 1789 times.
|
1794 | if (arg.starts_with("--target")) |
| 157 | 5 | explicitlySelectedTarget = true; | |
| 158 |
1/2✓ Branch 81 → 82 taken 1794 times.
✗ Branch 81 → 455 not taken.
|
1794 | argv.push_back(arg.c_str()); |
| 159 | } | ||
| 160 |
1/2✓ Branch 92 → 93 taken 577 times.
✗ Branch 92 → 753 not taken.
|
577 | Driver driver(cliOptions, true); |
| 161 |
1/2✓ Branch 95 → 96 taken 577 times.
✗ Branch 95 → 751 not taken.
|
577 | driver.parse(static_cast<int>(argv.size()), argv.data()); |
| 162 |
1/2✓ Branch 96 → 97 taken 577 times.
✗ Branch 96 → 751 not taken.
|
577 | driver.enrich(); |
| 163 | |||
| 164 | // If this is a cross-compilation test, we want to emit the target information in IR. For this we need to set native to false | ||
| 165 |
2/2✓ Branch 97 → 98 taken 5 times.
✓ Branch 97 → 99 taken 572 times.
|
577 | if (explicitlySelectedTarget) |
| 166 | 5 | cliOptions.isNativeTarget = false; | |
| 167 | |||
| 168 | // Redirect all build artifacts to a per-test directory. Driver::enrich() resets these to shared paths (e.g. "./" and a | ||
| 169 | // shared temp cache dir), which would cause concurrently running test processes to clobber each other's object files and | ||
| 170 | // executables. Using a unique directory per test keeps parallel runs (e.g. via gtest-parallel) collision-free. | ||
| 171 |
1/2✓ Branch 99 → 100 taken 577 times.
✗ Branch 99 → 751 not taken.
|
577 | const std::filesystem::path artifactDir = TestUtil::prepareArtifactDir(testCase); |
| 172 |
1/2✓ Branch 100 → 101 taken 577 times.
✗ Branch 100 → 749 not taken.
|
577 | const std::filesystem::path executablePath = TestUtil::getExecutablePath(artifactDir); |
| 173 |
1/2✓ Branch 101 → 102 taken 577 times.
✗ Branch 101 → 747 not taken.
|
577 | cliOptions.outputDir = artifactDir; |
| 174 |
2/4✓ Branch 102 → 103 taken 577 times.
✗ Branch 102 → 459 not taken.
✓ Branch 103 → 104 taken 577 times.
✗ Branch 103 → 457 not taken.
|
577 | cliOptions.cacheDir = artifactDir / "cache"; |
| 175 |
1/2✓ Branch 107 → 108 taken 577 times.
✗ Branch 107 → 747 not taken.
|
577 | std::filesystem::create_directories(cliOptions.cacheDir); |
| 176 | |||
| 177 | // Instantiate GlobalResourceManager | ||
| 178 |
1/2✓ Branch 108 → 109 taken 577 times.
✗ Branch 108 → 747 not taken.
|
577 | GlobalResourceManager resourceManager(cliOptions); |
| 179 | |||
| 180 | try { | ||
| 181 | // Create source file instance for main source file | ||
| 182 |
2/4✓ Branch 111 → 112 taken 577 times.
✗ Branch 111 → 463 not taken.
✓ Branch 112 → 113 taken 577 times.
✗ Branch 112 → 461 not taken.
|
577 | SourceFile *mainSourceFile = resourceManager.createSourceFile(nullptr, MAIN_FILE_NAME, cliOptions.mainSourceFile, false); |
| 183 | |||
| 184 | // Run Lexer and Parser | ||
| 185 |
2/2✓ Branch 115 → 116 taken 575 times.
✓ Branch 115 → 706 taken 2 times.
|
577 | mainSourceFile->runLexer(); |
| 186 |
1/2✓ Branch 116 → 117 taken 575 times.
✗ Branch 116 → 706 not taken.
|
575 | mainSourceFile->runParser(); |
| 187 | |||
| 188 | // Check CST | ||
| 189 |
3/6✓ Branch 119 → 120 taken 575 times.
✗ Branch 119 → 471 not taken.
✓ Branch 120 → 121 taken 575 times.
✗ Branch 120 → 469 not taken.
✓ Branch 121 → 122 taken 575 times.
✗ Branch 121 → 467 not taken.
|
575 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_PARSE_TREE, [&] { |
| 190 | 7 | mainSourceFile->runCSTVisualizer(); | |
| 191 | 7 | return mainSourceFile->compilerOutput.cstString; | |
| 192 | }); | ||
| 193 | |||
| 194 | // Build and optimize AST | ||
| 195 |
2/2✓ Branch 126 → 127 taken 567 times.
✓ Branch 126 → 706 taken 8 times.
|
575 | mainSourceFile->runASTBuilder(); |
| 196 | |||
| 197 | // Check AST | ||
| 198 |
3/6✓ Branch 129 → 130 taken 567 times.
✗ Branch 129 → 485 not taken.
✓ Branch 130 → 131 taken 567 times.
✗ Branch 130 → 483 not taken.
✓ Branch 131 → 132 taken 567 times.
✗ Branch 131 → 481 not taken.
|
567 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_SYNTAX_TREE, [&] { |
| 199 | 7 | mainSourceFile->runASTVisualizer(); | |
| 200 | 7 | return mainSourceFile->compilerOutput.astString; | |
| 201 | }); | ||
| 202 | |||
| 203 | // Execute import collector and semantic analysis stages | ||
| 204 |
2/2✓ Branch 136 → 137 taken 563 times.
✓ Branch 136 → 706 taken 4 times.
|
567 | mainSourceFile->runImportCollector(); |
| 205 |
2/2✓ Branch 137 → 138 taken 544 times.
✓ Branch 137 → 706 taken 19 times.
|
563 | mainSourceFile->runSymbolTableBuilder(); |
| 206 |
2/2✓ Branch 138 → 139 taken 382 times.
✓ Branch 138 → 706 taken 162 times.
|
544 | mainSourceFile->runMiddleEnd(); // TypeChecker pre + post |
| 207 | |||
| 208 | // Check symbol table output (check happens here to include updates from type checker) | ||
| 209 |
3/6✓ Branch 141 → 142 taken 382 times.
✗ Branch 141 → 499 not taken.
✓ Branch 142 → 143 taken 382 times.
✗ Branch 142 → 497 not taken.
✓ Branch 143 → 144 taken 382 times.
✗ Branch 143 → 495 not taken.
|
764 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_SYMBOL_TABLE, |
| 210 |
2/4✓ Branch 3 → 4 taken 8 times.
✗ Branch 3 → 11 not taken.
✓ Branch 4 → 5 taken 8 times.
✗ Branch 4 → 9 not taken.
|
780 | [&] { return mainSourceFile->globalScope->getSymbolTableJSON().dump(/*indent=*/2); }); |
| 211 | |||
| 212 | // Fail if an error was expected | ||
| 213 | − | if (TestUtil::doesRefExist(testCase.testPath / REF_NAME_ERROR_OUTPUT)) // GCOV_EXCL_LINE | |
| 214 | − | FAIL() << "Expected error, but got no error"; // GCOV_EXCL_LINE | |
| 215 | |||
| 216 | // Check dependency graph | ||
| 217 |
3/6✓ Branch 163 → 164 taken 382 times.
✗ Branch 163 → 525 not taken.
✓ Branch 164 → 165 taken 382 times.
✗ Branch 164 → 523 not taken.
✓ Branch 165 → 166 taken 382 times.
✗ Branch 165 → 521 not taken.
|
382 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_DEP_GRAPH, [&] { |
| 218 | 2 | mainSourceFile->runDependencyGraphVisualizer(); | |
| 219 | 2 | return mainSourceFile->compilerOutput.depGraphString; | |
| 220 | }); | ||
| 221 | |||
| 222 | // Run backend for all dependencies | ||
| 223 |
5/8✓ Branch 170 → 171 taken 382 times.
✗ Branch 170 → 535 not taken.
✓ Branch 171 → 172 taken 382 times.
✗ Branch 171 → 535 not taken.
✓ Branch 172 → 173 taken 382 times.
✗ Branch 172 → 535 not taken.
✓ Branch 178 → 174 taken 395 times.
✓ Branch 178 → 179 taken 382 times.
|
777 | for (SourceFile *sourceFile : mainSourceFile->dependencies | std::views::values) |
| 224 |
1/2✓ Branch 175 → 176 taken 395 times.
✗ Branch 175 → 535 not taken.
|
395 | sourceFile->runBackEnd(); |
| 225 | |||
| 226 | // Keep track of the opt level the IR in the module was generated with | ||
| 227 | 382 | OptLevel generatedOptLevel = cliOptions.optLevel; | |
| 228 | // Execute IR generator in normal or debug mode | ||
| 229 |
1/2✓ Branch 179 → 180 taken 382 times.
✗ Branch 179 → 706 not taken.
|
382 | mainSourceFile->runIRGenerator(); |
| 230 | |||
| 231 | // Check IR code | ||
| 232 |
2/2✓ Branch 191 → 181 taken 2292 times.
✓ Branch 191 → 192 taken 382 times.
|
2674 | for (uint8_t i = 0; i <= 5; i++) { |
| 233 |
1/2✓ Branch 185 → 186 taken 2292 times.
✗ Branch 185 → 536 not taken.
|
2292 | TestUtil::checkRefMatch( |
| 234 |
2/4✓ Branch 183 → 184 taken 2292 times.
✗ Branch 183 → 540 not taken.
✓ Branch 184 → 185 taken 2292 times.
✗ Branch 184 → 538 not taken.
|
4584 | testCase.testPath / REF_NAME_OPT_IR[i], |
| 235 |
1/2✓ Branch 182 → 183 taken 2292 times.
✗ Branch 182 → 544 not taken.
|
4584 | [&] { |
| 236 | 206 | cliOptions.optLevel = static_cast<OptLevel>(i); | |
| 237 | |||
| 238 | // The IR generator emits parts of the IR depending on the selected opt level, so the IR has to be | ||
| 239 | // generated from scratch whenever we check the dump of an opt level other than the one the current module | ||
| 240 | // was built for. Otherwise all dumps would show the IR for the opt level that was active when the IR | ||
| 241 | // generator ran for the first time. | ||
| 242 |
2/2✓ Branch 2 → 3 taken 36 times.
✓ Branch 2 → 13 taken 170 times.
|
206 | if (cliOptions.optLevel != generatedOptLevel) { |
| 243 |
2/2✓ Branch 3 → 4 taken 1 time.
✓ Branch 3 → 11 taken 35 times.
|
36 | if (cliOptions.useLTO) { |
| 244 | // The bitcode linker moves the module of every source file into the LTO module, so all of them have to | ||
| 245 | // be re-generated. The LTO module itself is started from scratch to not link the same symbols twice. | ||
| 246 |
1/2✓ Branch 4 → 5 taken 1 time.
✗ Branch 4 → 20 not taken.
|
1 | resourceManager.ltoModule = std::make_unique<llvm::Module>(LTO_FILE_NAME, resourceManager.ltoContext); |
| 247 | 1 | std::unordered_set<const SourceFile *> visitedSet; | |
| 248 |
1/2✓ Branch 8 → 9 taken 1 time.
✗ Branch 8 → 21 not taken.
|
1 | reGenerateIRForLTO(mainSourceFile, visitedSet); |
| 249 | 1 | } else { | |
| 250 | 35 | reGenerateIR(mainSourceFile); | |
| 251 | } | ||
| 252 | 36 | generatedOptLevel = cliOptions.optLevel; | |
| 253 | } | ||
| 254 | |||
| 255 |
2/2✓ Branch 13 → 14 taken 1 time.
✓ Branch 13 → 17 taken 205 times.
|
206 | if (cliOptions.useLTO) { |
| 256 | 1 | mainSourceFile->runPreLinkIROptimizer(); | |
| 257 | 1 | mainSourceFile->runBitcodeLinker(); | |
| 258 | 1 | mainSourceFile->runPostLinkIROptimizer(); | |
| 259 | } else { | ||
| 260 | 205 | mainSourceFile->runDefaultIROptimizer(); | |
| 261 | } | ||
| 262 | |||
| 263 | 206 | return mainSourceFile->compilerOutput.irOptString; | |
| 264 | }, | ||
| 265 | 4584 | [&](std::string &expectedOutput, std::string &actualOutput) { | |
| 266 |
2/2✓ Branch 2 → 3 taken 6 times.
✓ Branch 2 → 5 taken 200 times.
|
206 | if (cliOptions.instrumentation.generateDebugInfo) { |
| 267 | // Remove the lines, containing paths on the local file system | ||
| 268 | 6 | TestUtil::eraseLinesBySubstring(expectedOutput, " = !DIFile(filename:"); | |
| 269 | 6 | TestUtil::eraseLinesBySubstring(actualOutput, " = !DIFile(filename:"); | |
| 270 | } | ||
| 271 | 206 | }, | |
| 272 | true); | ||
| 273 | } | ||
| 274 | |||
| 275 | // Link the bitcode if not happened yet | ||
| 276 |
3/4✓ Branch 192 → 193 taken 1 time.
✓ Branch 192 → 195 taken 381 times.
✗ Branch 193 → 194 not taken.
✓ Branch 193 → 195 taken 1 time.
|
382 | if (cliOptions.useLTO && cliOptions.optLevel == OptLevel::O0) |
| 277 | ✗ | mainSourceFile->runBitcodeLinker(); | |
| 278 | |||
| 279 | // Check assembly code (only when not running test on GitHub Actions) | ||
| 280 | 382 | bool objectFilesEmitted = false; | |
| 281 | // GCOV_EXCL_START | ||
| 282 | − | if (!testDriverCliOptions.isGitHubActions) { | |
| 283 | − | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_ASM, [&] { | |
| 284 | − | mainSourceFile->runObjectEmitter(); | |
| 285 | − | objectFilesEmitted = true; | |
| 286 | |||
| 287 | − | return mainSourceFile->compilerOutput.asmString; | |
| 288 | }); | ||
| 289 | } | ||
| 290 | // GCOV_EXCL_STOP | ||
| 291 | |||
| 292 | // Check warnings | ||
| 293 | // The bootstrap compiler is still incomplete, so its sources emit huge amounts of unused-symbol warnings. Skip warning | ||
| 294 | // collection for the whole bootstrap-compiler suite to keep the test output readable. | ||
| 295 |
3/4✓ Branch 206 → 207 taken 382 times.
✗ Branch 206 → 706 not taken.
✓ Branch 207 → 208 taken 351 times.
✓ Branch 207 → 219 taken 31 times.
|
382 | if (testCase.testSuite != "bootstrapCompiler") { |
| 296 |
1/2✓ Branch 208 → 209 taken 351 times.
✗ Branch 208 → 706 not taken.
|
351 | mainSourceFile->collectAndPrintWarnings(); |
| 297 |
3/6✓ Branch 211 → 212 taken 351 times.
✗ Branch 211 → 569 not taken.
✓ Branch 212 → 213 taken 351 times.
✗ Branch 212 → 567 not taken.
✓ Branch 213 → 214 taken 351 times.
✗ Branch 213 → 565 not taken.
|
351 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_WARNING_OUTPUT, [&] { |
| 298 |
1/2✓ Branch 2 → 3 taken 23 times.
✗ Branch 2 → 27 not taken.
|
23 | std::stringstream actualWarningString; |
| 299 |
2/2✓ Branch 18 → 5 taken 24 times.
✓ Branch 18 → 19 taken 23 times.
|
70 | for (const CompilerWarning &warning : mainSourceFile->compilerOutput.warnings) |
| 300 |
2/4✓ Branch 7 → 8 taken 24 times.
✗ Branch 7 → 24 not taken.
✓ Branch 8 → 9 taken 24 times.
✗ Branch 8 → 24 not taken.
|
24 | actualWarningString << warning.warningMessage << "\n"; |
| 301 |
1/2✓ Branch 19 → 20 taken 23 times.
✗ Branch 19 → 25 not taken.
|
46 | return actualWarningString.str(); |
| 302 | 23 | }); | |
| 303 | } | ||
| 304 | |||
| 305 | // Do linking and conclude compilation | ||
| 306 |
3/6✓ Branch 219 → 220 taken 382 times.
✗ Branch 219 → 583 not taken.
✓ Branch 220 → 221 taken 382 times.
✗ Branch 220 → 581 not taken.
✓ Branch 221 → 222 taken 382 times.
✗ Branch 221 → 579 not taken.
|
382 | const bool needsNormalRunForOutput = TestUtil::doesRefExist(testCase.testPath / REF_NAME_EXECUTION_OUTPUT); |
| 307 |
3/6✓ Branch 224 → 225 taken 382 times.
✗ Branch 224 → 589 not taken.
✓ Branch 225 → 226 taken 382 times.
✗ Branch 225 → 587 not taken.
✓ Branch 226 → 227 taken 382 times.
✗ Branch 226 → 585 not taken.
|
382 | const bool needsNormalRunForExitCode = TestUtil::doesRefExist(testCase.testPath / REF_NAME_EXIT_CODE); |
| 308 |
3/6✓ Branch 229 → 230 taken 382 times.
✗ Branch 229 → 595 not taken.
✓ Branch 230 → 231 taken 382 times.
✗ Branch 230 → 593 not taken.
✓ Branch 231 → 232 taken 382 times.
✗ Branch 231 → 591 not taken.
|
382 | const bool needsDebuggerRun = TestUtil::doesRefExist(testCase.testPath / REF_NAME_GDB_OUTPUT); |
| 309 |
5/6✓ Branch 234 → 235 taken 63 times.
✓ Branch 234 → 237 taken 319 times.
✓ Branch 235 → 236 taken 49 times.
✓ Branch 235 → 237 taken 14 times.
✗ Branch 236 → 237 not taken.
✓ Branch 236 → 244 taken 49 times.
|
382 | if (needsNormalRunForOutput || needsNormalRunForExitCode || needsDebuggerRun) { |
| 310 | // Emit main source file object if not done already | ||
| 311 |
1/2✓ Branch 237 → 238 taken 333 times.
✗ Branch 237 → 239 not taken.
|
333 | if (!objectFilesEmitted) |
| 312 |
1/2✓ Branch 238 → 239 taken 333 times.
✗ Branch 238 → 706 not taken.
|
333 | mainSourceFile->runObjectEmitter(); |
| 313 | |||
| 314 | // Conclude the compilation | ||
| 315 |
1/2✓ Branch 239 → 240 taken 333 times.
✗ Branch 239 → 706 not taken.
|
333 | mainSourceFile->concludeCompilation(); |
| 316 | |||
| 317 | // Prepare linker | ||
| 318 |
1/2✓ Branch 240 → 241 taken 333 times.
✗ Branch 240 → 706 not taken.
|
333 | resourceManager.linker.outputPath = executablePath; |
| 319 | |||
| 320 | // Prepare and run linker | ||
| 321 |
1/2✓ Branch 241 → 242 taken 333 times.
✗ Branch 241 → 706 not taken.
|
333 | resourceManager.linker.prepare(); |
| 322 |
1/2✓ Branch 242 → 243 taken 333 times.
✗ Branch 242 → 706 not taken.
|
333 | resourceManager.linker.run(); |
| 323 |
1/2✓ Branch 243 → 244 taken 333 times.
✗ Branch 243 → 706 not taken.
|
333 | resourceManager.linker.cleanup(); |
| 324 | } | ||
| 325 | |||
| 326 | // Check type registry output | ||
| 327 |
3/6✓ Branch 246 → 247 taken 382 times.
✗ Branch 246 → 601 not taken.
✓ Branch 247 → 248 taken 382 times.
✗ Branch 247 → 599 not taken.
✓ Branch 248 → 249 taken 382 times.
✗ Branch 248 → 597 not taken.
|
388 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_TYPE_REGISTRY, [&] { return TypeRegistry::dump(); }); |
| 328 | |||
| 329 | // Check cache stats output | ||
| 330 |
3/6✓ Branch 255 → 256 taken 382 times.
✗ Branch 255 → 615 not taken.
✓ Branch 256 → 257 taken 382 times.
✗ Branch 256 → 613 not taken.
✓ Branch 257 → 258 taken 382 times.
✗ Branch 257 → 611 not taken.
|
382 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_CACHE_STATS, [&] { |
| 331 |
1/2✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 31 not taken.
|
1 | std::stringstream cacheStats; |
| 332 |
3/6✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 22 not taken.
✓ Branch 4 → 5 taken 1 time.
✗ Branch 4 → 20 not taken.
✓ Branch 5 → 6 taken 1 time.
✗ Branch 5 → 20 not taken.
|
1 | cacheStats << FunctionManager::dumpLookupCacheStatistics() << std::endl; |
| 333 |
3/6✓ Branch 7 → 8 taken 1 time.
✗ Branch 7 → 25 not taken.
✓ Branch 8 → 9 taken 1 time.
✗ Branch 8 → 23 not taken.
✓ Branch 9 → 10 taken 1 time.
✗ Branch 9 → 23 not taken.
|
1 | cacheStats << StructManager::dumpLookupCacheStatistics() << std::endl; |
| 334 |
3/6✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 28 not taken.
✓ Branch 12 → 13 taken 1 time.
✗ Branch 12 → 26 not taken.
✓ Branch 13 → 14 taken 1 time.
✗ Branch 13 → 26 not taken.
|
1 | cacheStats << InterfaceManager::dumpLookupCacheStatistics() << std::endl; |
| 335 |
1/2✓ Branch 15 → 16 taken 1 time.
✗ Branch 15 → 29 not taken.
|
2 | return cacheStats.str(); |
| 336 | 1 | }); | |
| 337 | |||
| 338 |
3/6✓ Branch 262 → 263 taken 382 times.
✗ Branch 262 → 629 not taken.
✓ Branch 263 → 264 taken 382 times.
✗ Branch 263 → 627 not taken.
✓ Branch 264 → 265 taken 382 times.
✗ Branch 264 → 625 not taken.
|
382 | const bool checkExecutionOutput = TestUtil::doesRefExist(testCase.testPath / REF_NAME_EXECUTION_OUTPUT); |
| 339 |
3/6✓ Branch 267 → 268 taken 382 times.
✗ Branch 267 → 635 not taken.
✓ Branch 268 → 269 taken 382 times.
✗ Branch 268 → 633 not taken.
✓ Branch 269 → 270 taken 382 times.
✗ Branch 269 → 631 not taken.
|
382 | const bool checkExecutionExitCode = TestUtil::doesRefExist(testCase.testPath / REF_NAME_EXIT_CODE); |
| 340 |
4/4✓ Branch 272 → 273 taken 63 times.
✓ Branch 272 → 274 taken 319 times.
✓ Branch 273 → 274 taken 14 times.
✓ Branch 273 → 330 taken 49 times.
|
382 | if (checkExecutionOutput || checkExecutionExitCode) { |
| 341 |
2/4✓ Branch 274 → 275 taken 333 times.
✗ Branch 274 → 639 not taken.
✓ Branch 275 → 276 taken 333 times.
✗ Branch 275 → 637 not taken.
|
333 | const std::filesystem::path cliFlagsFile = testCase.testPath / INPUT_NAME_CLI_FLAGS; |
| 342 | // Execute binary | ||
| 343 |
1/2✓ Branch 277 → 278 taken 333 times.
✗ Branch 277 → 689 not taken.
|
333 | std::stringstream cmd; |
| 344 |
1/2✗ Branch 278 → 279 not taken.
✓ Branch 278 → 280 taken 333 times.
|
333 | if (testDriverCliOptions.enableLeakDetection) |
| 345 | ✗ | cmd << "valgrind -q --leak-check=full --suppressions=../../valgrind.supp --num-callers=100 --error-exitcode=1 "; | |
| 346 |
2/4✓ Branch 280 → 281 taken 333 times.
✗ Branch 280 → 642 not taken.
✓ Branch 281 → 282 taken 333 times.
✗ Branch 281 → 640 not taken.
|
333 | cmd << executablePath.string(); |
| 347 |
3/4✓ Branch 283 → 284 taken 333 times.
✗ Branch 283 → 687 not taken.
✓ Branch 284 → 285 taken 3 times.
✓ Branch 284 → 291 taken 330 times.
|
333 | if (exists(cliFlagsFile)) |
| 348 |
4/8✓ Branch 285 → 286 taken 3 times.
✗ Branch 285 → 687 not taken.
✓ Branch 286 → 287 taken 3 times.
✗ Branch 286 → 645 not taken.
✓ Branch 287 → 288 taken 3 times.
✗ Branch 287 → 643 not taken.
✓ Branch 288 → 289 taken 3 times.
✗ Branch 288 → 643 not taken.
|
3 | cmd << " " << TestUtil::getFileContentLinesVector(cliFlagsFile).at(0); |
| 349 |
2/4✓ Branch 291 → 292 taken 333 times.
✗ Branch 291 → 648 not taken.
✓ Branch 292 → 293 taken 333 times.
✗ Branch 292 → 646 not taken.
|
333 | const auto [output, exitCode] = SystemUtil::exec(cmd.str(), checkExecutionOutput); |
| 350 | |||
| 351 | // Check if the execution output matches the expected output | ||
| 352 | 319 | const auto getActualOutput = [&] { return output; }; | |
| 353 |
3/6✓ Branch 296 → 297 taken 333 times.
✗ Branch 296 → 653 not taken.
✓ Branch 297 → 298 taken 333 times.
✗ Branch 297 → 651 not taken.
✓ Branch 298 → 299 taken 333 times.
✗ Branch 298 → 649 not taken.
|
333 | TestUtil::checkRefMatch(testCase.testPath / REF_NAME_EXECUTION_OUTPUT, getActualOutput); |
| 354 | |||
| 355 | #if not OS_WINDOWS // Windows does not give us the exit code, so we cannot check it on Windows | ||
| 356 | // Check if the exit code matches the expected one | ||
| 357 | // If no exit code ref file exists, check against 0 | ||
| 358 | 19 | const auto getActualExitCode = [&] { return std::to_string(exitCode); }; | |
| 359 |
3/6✓ Branch 305 → 306 taken 333 times.
✗ Branch 305 → 666 not taken.
✓ Branch 306 → 307 taken 333 times.
✗ Branch 306 → 664 not taken.
✓ Branch 307 → 308 taken 333 times.
✗ Branch 307 → 662 not taken.
|
333 | const bool refExists = TestUtil::checkRefMatch(testCase.testPath / REF_NAME_EXIT_CODE, getActualExitCode); |
| 360 |
2/2✓ Branch 312 → 313 taken 314 times.
✓ Branch 312 → 326 taken 19 times.
|
333 | if (!refExists) { |
| 361 |
2/12✓ Branch 313 → 314 taken 314 times.
✗ Branch 313 → 675 not taken.
✗ Branch 315 → 316 not taken.
✓ Branch 315 → 324 taken 314 times.
✗ Branch 316 → 317 not taken.
✗ Branch 316 → 681 not taken.
✗ Branch 317 → 318 not taken.
✗ Branch 317 → 679 not taken.
✗ Branch 319 → 320 not taken.
✗ Branch 319 → 678 not taken.
✗ Branch 320 → 321 not taken.
✗ Branch 320 → 676 not taken.
|
314 | EXPECT_EQ(0, exitCode) << "Program exited with non-zero exit code"; |
| 362 | } | ||
| 363 | #endif | ||
| 364 | 333 | } | |
| 365 | |||
| 366 | // Check if the debugger output matches the expected output | ||
| 367 | // GCOV_EXCL_START | ||
| 368 | − | if (!testDriverCliOptions.isGitHubActions) { // GDB tests are currently not support on GH actions | |
| 369 | − | TestUtil::checkRefMatch( | |
| 370 | − | testCase.testPath / REF_NAME_GDB_OUTPUT, | |
| 371 | − | [&] { | |
| 372 | // Execute debugger script | ||
| 373 | − | std::filesystem::path gdbScriptPath = testCase.testPath / CTL_DEBUG_SCRIPT; | |
| 374 | − | EXPECT_TRUE(std::filesystem::exists(gdbScriptPath)) << "Debug output requested, but debug script not found"; | |
| 375 | − | gdbScriptPath.make_preferred(); | |
| 376 | − | const std::string cmd = "gdb -x " + gdbScriptPath.string() + " " + executablePath.string(); | |
| 377 | − | const auto [output, exitCode] = SystemUtil::exec(cmd); | |
| 378 | |||
| 379 | #if not OS_WINDOWS // Windows does not give us the exit code, so we cannot check it on Windows | ||
| 380 | − | EXPECT_EQ(0, exitCode) << "GDB exited with non-zero exit code when running debug script"; | |
| 381 | #endif | ||
| 382 | |||
| 383 | − | return output; | |
| 384 | − | }, | |
| 385 | − | [&](std::string &expectedOutput, std::string &actualOutput) { | |
| 386 | // Do not compare against the GDB header | ||
| 387 | − | TestUtil::eraseGDBHeader(expectedOutput); | |
| 388 | − | TestUtil::eraseGDBHeader(actualOutput); | |
| 389 | − | }); | |
| 390 | } | ||
| 391 | // GCOV_EXCL_STOP | ||
| 392 |
4/7✗ Branch 707 → 708 not taken.
✓ Branch 707 → 709 taken 1 time.
✓ Branch 707 → 712 taken 8 times.
✓ Branch 707 → 715 taken 68 times.
✓ Branch 707 → 718 taken 118 times.
✗ Branch 707 → 721 not taken.
✗ Branch 707 → 724 not taken.
|
195 | } catch (LexerError &error) { |
| 393 |
1/2✓ Branch 710 → 711 taken 1 time.
✗ Branch 710 → 727 not taken.
|
1 | TestUtil::handleError(testCase, error); |
| 394 |
1/2✓ Branch 711 → 342 taken 1 time.
✗ Branch 711 → 745 not taken.
|
9 | } catch (ParserError &error) { |
| 395 |
1/2✓ Branch 713 → 714 taken 8 times.
✗ Branch 713 → 729 not taken.
|
8 | TestUtil::handleError(testCase, error); |
| 396 |
1/2✓ Branch 714 → 342 taken 8 times.
✗ Branch 714 → 745 not taken.
|
76 | } catch (SemanticError &error) { |
| 397 |
1/2✓ Branch 716 → 717 taken 68 times.
✗ Branch 716 → 731 not taken.
|
68 | TestUtil::handleError(testCase, error); |
| 398 |
1/2✓ Branch 717 → 342 taken 68 times.
✗ Branch 717 → 745 not taken.
|
186 | } catch (CompilerError &error) { |
| 399 |
1/2✓ Branch 719 → 720 taken 118 times.
✗ Branch 719 → 733 not taken.
|
118 | TestUtil::handleError(testCase, error); |
| 400 | 118 | } catch (LinkerError &error) { | |
| 401 | ✗ | TestUtil::handleError(testCase, error); | |
| 402 | − | } catch (std::exception &error) { // GCOV_EXCL_LINE | |
| 403 | − | TestUtil::handleError(testCase, error); // GCOV_EXCL_LINE | |
| 404 | − | } // GCOV_EXCL_LINE | |
| 405 | |||
| 406 |
3/6✓ Branch 342 → 343 taken 577 times.
✗ Branch 342 → 744 not taken.
✓ Branch 343 → 344 taken 577 times.
✗ Branch 343 → 741 not taken.
✓ Branch 344 → 345 taken 577 times.
✗ Branch 344 → 739 not taken.
|
577 | SUCCEED(); |
| 407 |
8/16✓ Branch 349 → 350 taken 577 times.
✗ Branch 349 → 351 not taken.
✓ Branch 354 → 355 taken 577 times.
✗ Branch 354 → 356 not taken.
✓ Branch 359 → 360 taken 577 times.
✗ Branch 359 → 361 not taken.
✓ Branch 364 → 365 taken 577 times.
✗ Branch 364 → 366 not taken.
✓ Branch 369 → 370 taken 577 times.
✗ Branch 369 → 371 not taken.
✓ Branch 374 → 375 taken 577 times.
✗ Branch 374 → 376 not taken.
✓ Branch 379 → 380 taken 577 times.
✗ Branch 379 → 381 not taken.
✓ Branch 384 → 385 taken 577 times.
✗ Branch 384 → 387 not taken.
|
4616 | } |
| 408 | |||
| 409 | class CommonTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 410 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
29 | TEST_P(CommonTests, ) { execTestCase(GetParam()); } |
| 411 |
4/14spice::testing::gtest_CommonTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_CommonTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 11 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 11 times.
✗ Branch 12 → 24 not taken.
|
24 | INSTANTIATE_TEST_SUITE_P(, CommonTests, ::testing::ValuesIn(TestUtil::collectTestCases("common", false)), |
| 412 | TestUtil::NameResolver()); | ||
| 413 | |||
| 414 | class LexerTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 415 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
9 | TEST_P(LexerTests, ) { execTestCase(GetParam()); } |
| 416 |
4/14spice::testing::gtest_LexerTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_LexerTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 1 time.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 1 time.
✗ Branch 12 → 24 not taken.
|
4 | INSTANTIATE_TEST_SUITE_P(, LexerTests, ::testing::ValuesIn(TestUtil::collectTestCases("lexer", false)), TestUtil::NameResolver()); |
| 417 | |||
| 418 | class ParserTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 419 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
23 | TEST_P(ParserTests, ) { execTestCase(GetParam()); } |
| 420 |
4/14spice::testing::gtest_ParserTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_ParserTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 8 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 8 times.
✗ Branch 12 → 24 not taken.
|
18 | INSTANTIATE_TEST_SUITE_P(, ParserTests, ::testing::ValuesIn(TestUtil::collectTestCases("parser", false)), |
| 421 | TestUtil::NameResolver()); | ||
| 422 | |||
| 423 | class SymbolTableBuilderTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 424 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
51 | TEST_P(SymbolTableBuilderTests, ) { execTestCase(GetParam()); } |
| 425 |
4/14spice::testing::gtest_SymbolTableBuilderTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_SymbolTableBuilderTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 22 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 22 times.
✗ Branch 12 → 24 not taken.
|
46 | INSTANTIATE_TEST_SUITE_P(, SymbolTableBuilderTests, ::testing::ValuesIn(TestUtil::collectTestCases("symboltablebuilder", true)), |
| 426 | TestUtil::NameResolver()); | ||
| 427 | |||
| 428 | class TypeCheckerTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 429 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
413 | TEST_P(TypeCheckerTests, ) { execTestCase(GetParam()); } |
| 430 |
4/14spice::testing::gtest_TypeCheckerTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_TypeCheckerTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 203 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 203 times.
✗ Branch 12 → 24 not taken.
|
408 | INSTANTIATE_TEST_SUITE_P(, TypeCheckerTests, ::testing::ValuesIn(TestUtil::collectTestCases("typechecker", true)), |
| 431 | TestUtil::NameResolver()); | ||
| 432 | |||
| 433 | class IRGeneratorTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 434 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
377 | TEST_P(IRGeneratorTests, ) { execTestCase(GetParam()); } |
| 435 |
4/14spice::testing::gtest_IRGeneratorTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_IRGeneratorTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 185 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 185 times.
✗ Branch 12 → 24 not taken.
|
372 | INSTANTIATE_TEST_SUITE_P(, IRGeneratorTests, ::testing::ValuesIn(TestUtil::collectTestCases("irgenerator", true)), |
| 436 | TestUtil::NameResolver()); | ||
| 437 | |||
| 438 | class StdTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 439 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
221 | TEST_P(StdTests, ) { execTestCase(GetParam()); } |
| 440 |
4/14spice::testing::gtest_StdTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_StdTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 107 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 107 times.
✗ Branch 12 → 24 not taken.
|
216 | INSTANTIATE_TEST_SUITE_P(, StdTests, ::testing::ValuesIn(TestUtil::collectTestCases("std", true)), TestUtil::NameResolver()); |
| 441 | |||
| 442 | class BenchmarkTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 443 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
21 | TEST_P(BenchmarkTests, ) { execTestCase(GetParam()); } |
| 444 |
4/14spice::testing::gtest_BenchmarkTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_BenchmarkTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 7 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 7 times.
✗ Branch 12 → 24 not taken.
|
16 | INSTANTIATE_TEST_SUITE_P(, BenchmarkTests, ::testing::ValuesIn(TestUtil::collectTestCases("benchmark", false)), |
| 445 | TestUtil::NameResolver()); | ||
| 446 | |||
| 447 | class ExampleTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 448 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
17 | TEST_P(ExampleTests, ) { execTestCase(GetParam()); } |
| 449 |
4/14spice::testing::gtest_ExampleTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_ExampleTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 5 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 5 times.
✗ Branch 12 → 24 not taken.
|
12 | INSTANTIATE_TEST_SUITE_P(, ExampleTests, ::testing::ValuesIn(TestUtil::collectTestCases("examples", false)), |
| 450 | TestUtil::NameResolver()); | ||
| 451 | |||
| 452 | class BootstrapCompilerTests : public ::testing::TestWithParam<TestCase> {}; | ||
| 453 |
7/16✓ Branch 6 → 7 taken 1 time.
✗ Branch 6 → 53 not taken.
✓ Branch 10 → 11 taken 1 time.
✗ Branch 10 → 45 not taken.
✓ Branch 11 → 12 taken 1 time.
✗ Branch 11 → 43 not taken.
✓ Branch 14 → 15 taken 1 time.
✗ Branch 14 → 38 not taken.
✓ Branch 16 → 17 taken 1 time.
✗ Branch 16 → 34 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 31 not taken.
✗ Branch 19 → 20 not taken.
✓ Branch 19 → 21 taken 1 time.
✗ Branch 31 → 32 not taken.
✗ Branch 31 → 33 not taken.
|
69 | TEST_P(BootstrapCompilerTests, ) { execTestCase(GetParam()); } |
| 454 |
4/14spice::testing::gtest_BootstrapCompilerTests_EvalGenerator_():
✓ Branch 2 → 3 taken 1 time.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 1 time.
✗ Branch 3 → 8 not taken.
spice::testing::gtest_BootstrapCompilerTests_EvalGenerateName_(testing::TestParamInfo<spice::testing::TestCase> const&):
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 12 taken 31 times.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 20 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 18 not taken.
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 16 not taken.
✓ Branch 12 → 13 taken 31 times.
✗ Branch 12 → 24 not taken.
|
64 | INSTANTIATE_TEST_SUITE_P(, BootstrapCompilerTests, ::testing::ValuesIn(TestUtil::collectTestCases("bootstrap-compiler", false)), |
| 455 | TestUtil::NameResolver()); | ||
| 456 | |||
| 457 | } // namespace spice::testing | ||
| 458 |