@@ -242,7 +242,7 @@ def verify_assembly_file_preamble(self, filename):
242242 line3 = assembly_file .readline ()
243243
244244 if (line1 != '; SPIR-V\n ' or
245- line2 != '; Version: 1.0 \n ' or
245+ ( not line2 . startswith ( '; Version: 1.' )) or
246246 (not line3 .startswith ('; Generator: Google Shaderc over Glslang;' ))):
247247 return False , 'Incorrect SPV assembly'
248248
@@ -427,10 +427,13 @@ class ValidAssemblyFileWithSubstr(ValidAssemblyFile):
427427 """Mixin class for checking that every input file generates a valid assembly
428428 file following the assembly file naming rule, there is no output on
429429 stdout/stderr, and all assembly files have the given substring specified
430- by expected_assembly_substr.
430+ as self.expected_assembly_substr (if present) and substrings specified
431+ by the list strings in self.expected_assembly_substrings (if present).
432+ At least one string must be specified.
431433
432- To mix in this class, subclasses need to provde expected_assembly_substr
433- as the expected substring.
434+ To mix in this class, subclasses need to provide
435+ self.expected_assembly_substr as the expected substring, or a list of
436+ strings in self.expected_assembly_substrings.
434437 """
435438
436439 def check_assembly_with_substr (self , status ):
@@ -441,11 +444,24 @@ def check_assembly_with_substr(self, status):
441444 if not success :
442445 return False , message
443446 with open (assembly_filename , 'r' ) as f :
444- content = f .read ()
445- if self .expected_assembly_substr not in convert_to_unix_line_endings (content ):
446- return False , ('Incorrect assembly output:\n {asm}\n '
447- 'Expected substring not found:\n {exp}' .format (
448- asm = content , exp = self .expected_assembly_substr ))
447+ content = convert_to_unix_line_endings (f .read ())
448+ expected_strs = []
449+ if 'expected_assembly_substrings' in dir (self ):
450+ expected_strs .extend (self .expected_assembly_substrings )
451+ if 'expected_assembly_substr' in dir (self ):
452+ expected_strs .append (self .expected_assembly_substr )
453+ assert (type (expected_strs ) is list )
454+ assert (len (expected_strs ) > 0 )
455+ for es in expected_strs :
456+ assert (type (es ) is str )
457+ print (f"=: es { es } " )
458+
459+ for es in expected_strs :
460+ print (f"= es { es } " )
461+ if es not in content :
462+ return False , ('Incorrect assembly output:\n {asm}\n '
463+ 'Expected substring not found:\n {exp}' .format (
464+ asm = content , exp = es ))
449465 return True , ''
450466
451467
0 commit comments