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

Function DoErrorMessageCheck

test/opt/ir_loader_test.cpp:1399–1412  ·  view source on GitHub ↗

Checks the given |error_message| is reported when trying to build a module from the given |assembly|.

Source from the content-addressed store, hash-verified

1397// Checks the given |error_message| is reported when trying to build a module
1398// from the given |assembly|.
1399void DoErrorMessageCheck(const std::string& assembly,
1400 const std::string& error_message, uint32_t line_num) {
1401 auto consumer = [error_message, line_num](spv_message_level_t, const char*,
1402 const spv_position_t& position,
1403 const char* m) {
1404 EXPECT_EQ(error_message, m);
1405 EXPECT_EQ(line_num, position.line);
1406 };
1407
1408 SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
1409 std::unique_ptr<IRContext> context =
1410 BuildModule(SPV_ENV_UNIVERSAL_1_1, std::move(consumer), assembly);
1411 EXPECT_EQ(nullptr, context);
1412}
1413
1414TEST(IrBuilder, FunctionInsideFunction) {
1415 DoErrorMessageCheck("%2 = OpFunction %1 None %3\n%5 = OpFunction %4 None %6",

Callers 1

TESTFunction · 0.85

Calls 1

BuildModuleFunction · 0.70

Tested by

no test coverage detected