MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / TEST_P

Function TEST_P

test/val/val_layout_test.cpp:177–208  ·  view source on GitHub ↗

This test will check the logical layout of a binary by removing each instruction in the pair of the INSTANTIATE_TEST_SUITE_P call and moving it in the SPIRV source formed by combining the vector "instructions".

Source from the content-addressed store, hash-verified

175// instruction in the pair of the INSTANTIATE_TEST_SUITE_P call and moving it in
176// the SPIRV source formed by combining the vector "instructions".
177TEST_P(ValidateLayout, Layout) {
178 int order;
179 std::string instruction;
180 pred_type pred;
181 pred_type test_pred; // Predicate to determine if the test should be build
182 std::tuple<std::string, pred_type, pred_type> testCase;
183
184 std::tie(order, testCase) = GetParam();
185 std::tie(instruction, pred, test_pred) = testCase;
186
187 // Skip test which break the code generation
188 if (test_pred(order)) return;
189
190 std::vector<std::string> code = GenerateCode(instruction, order);
191
192 std::stringstream ss;
193 std::copy(std::begin(code), std::end(code),
194 std::ostream_iterator<std::string>(ss, "\n"));
195
196 const auto env = SPV_ENV_UNIVERSAL_1_3;
197 // printf("code: \n%s\n", ss.str().c_str());
198 CompileSuccessfully(ss.str(), env);
199 spv_result_t result;
200 // clang-format off
201 ASSERT_EQ(pred(order), result = ValidateInstructions(env))
202 << "Actual: " << spvResultToString(result)
203 << "\nExpected: " << spvResultToString(pred(order))
204 << "\nOrder: " << order
205 << "\nInstruction: " << instruction
206 << "\nCode: \n" << ss.str();
207 // clang-format on
208}
209
210TEST_F(ValidateLayout, MemoryModelMissingBeforeEntryPoint) {
211 std::string str = R"(

Callers

nothing calls this directly

Calls 3

spvResultToStringFunction · 0.85
GenerateCodeFunction · 0.70
strMethod · 0.45

Tested by

no test coverage detected