MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / TEST_P

Function TEST_P

gtests/Link.FromFile.cpp:47–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 ::testing::TestWithParam<std::vector<std::string>>>;
46
47TEST_P(LinkTest, FromFile)
48{
49 const auto& fileNames = GetParam();
50 const size_t fileCount = fileNames.size();
51 const EShMessages controls = DeriveOptions(Source::GLSL, Semantics::OpenGL, Target::AST);
52 GlslangResult result;
53 result.validationResult = true;
54
55 // Compile each input shader file.
56 std::vector<std::unique_ptr<glslang::TShader>> shaders;
57 for (size_t i = 0; i < fileCount; ++i) {
58 std::string contents;
59 tryLoadFile(GlobalTestSettings.testRoot + "/" + fileNames[i],
60 "input", &contents);
61 shaders.emplace_back(
62 new glslang::TShader(GetShaderStage(GetSuffix(fileNames[i]))));
63 auto* shader = shaders.back().get();
64 compile(shader, contents, "", controls);
65 result.shaderResults.push_back(
66 {fileNames[i], shader->getInfoLog(), shader->getInfoDebugLog()});
67 }
68
69 // Link all of them.
70 glslang::TProgram program;
71 for (const auto& shader : shaders) program.addShader(shader.get());
72 program.link(controls);
73 result.linkingOutput = program.getInfoLog();
74 result.linkingError = program.getInfoDebugLog();
75
76 std::ostringstream stream;
77 outputResultToStream(&stream, result, controls);
78
79 // Check with expected results.
80 const std::string expectedOutputFname =
81 GlobalTestSettings.testRoot + "/baseResults/" + fileNames.front() + ".out";
82 std::string expectedOutput;
83 tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
84
85 checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname);
86}
87
88// clang-format off
89INSTANTIATE_TEST_SUITE_P(

Callers

nothing calls this directly

Calls 9

DeriveOptionsFunction · 0.85
GetShaderStageFunction · 0.85
GetSuffixFunction · 0.85
getInfoLogMethod · 0.80
getInfoDebugLogMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45
linkMethod · 0.45

Tested by

no test coverage detected