spirv-reader: update tests to use valid SPIR-V

This CL: all SPIR-V modules in parser_impl_module_var_test.cc

Bug: tint:765
Change-Id: I2e8427aea729793a4e34e2ac0c6fc689f65bda04
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49645
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
This commit is contained in:
David Neto 2021-05-05 20:54:02 +00:00 committed by Commit Bot service account
parent 202d97d846
commit ba08d7bca3
3 changed files with 361 additions and 388 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,8 +27,8 @@ ParserImplWrapperForTest::ParserImplWrapperForTest(
: impl_(input) {}
ParserImplWrapperForTest::~ParserImplWrapperForTest() {
if (dump_successfully_converted_spirv_ && !impl_.spv_binary().empty() &&
impl_.success()) {
if (dump_successfully_converted_spirv_ && !deliberately_invalid_spirv_ &&
!impl_.spv_binary().empty() && impl_.success()) {
std::string disassembly = Disassemble(impl_.spv_binary());
std::cout << "BEGIN ConvertedOk:\n"
<< disassembly << "\nEND ConvertedOk" << std::endl;

View File

@ -49,6 +49,7 @@ class ParserImplWrapperForTest {
static void DumpSuccessfullyConvertedSpirv() {
dump_successfully_converted_spirv_ = true;
}
void DeliberatelyInvalidSpirv() { deliberately_invalid_spirv_ = true; }
// Returns a new function emitter for the given function ID.
// Assumes ParserImpl::BuildInternalRepresentation has been run and
@ -123,6 +124,9 @@ class ParserImplWrapperForTest {
private:
ParserImpl impl_;
// When true, indicates the input SPIR-V module is expected to fail
// validation, but the SPIR-V reader parser is permissive and lets it through.
bool deliberately_invalid_spirv_ = false;
static bool dump_successfully_converted_spirv_;
};