Skip to content

Commit d588342

Browse files
committed
Add support for comments in match files
These have a variety of uses. For example, by documenting the reasons for known failures inside the match files themselves, we can keep all relevant information in one place and help direct developers towards known reproducers, areas of code to investigate, etc. The comment character is '#' which is fairly common and intuitive, especially in conf-style file types. Also no GTest tests should ever be named with that character. Also strip out empty lines
1 parent 7a6622f commit d588342

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

cmake/match.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def check_status(input_lines, match_lines):
6363
class Tag(Enum):
6464
OPT = "{{OPT}}" # makes the line optional
6565
IGNORE = "{{IGNORE}}" # ignores all input until next match or end of input file
66+
COMMENT = "#" # comment - line ignored
6667

6768

6869
## @brief main function for the match file processing script
@@ -76,7 +77,15 @@ def main():
7677

7778
with open(input_file, 'r') as input, open(match_file, 'r') as match:
7879
input_lines = input.readlines()
79-
match_lines = match.readlines()
80+
# Filter out empty lines and comments (lines beginning with the comment
81+
# character, ignoring leading whitespace)
82+
match_lines = list(
83+
filter(
84+
lambda line: line.strip()
85+
and not line.lstrip().startswith(Tag.COMMENT.value),
86+
match.readlines(),
87+
)
88+
)
8089

8190
ignored_lines = []
8291

test/conformance/enqueue/enqueue_adapter_hip.match

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# HIP can't check kernel arguments
12
urEnqueueKernelLaunchTest.InvalidKernelArgs/AMD_HIP_BACKEND___{{.*}}_
23
urEnqueueKernelLaunchKernelWgSizeTest.NonMatchingLocalSize/AMD_HIP_BACKEND___{{.*}}_
34
urEnqueueKernelLaunchKernelSubGroupTest.Success/AMD_HIP_BACKEND___{{.*}}_

test/conformance/program/program_adapter_hip.match

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ urProgramBuildTest.BuildFailure/AMD_HIP_BACKEND___{{.*}}_
1313
{{OPT}}urProgramGetBuildInfoTest.InvalidNullHandleDevice/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE
1414
{{OPT}}urProgramGetBuildInfoSingleTest.LogIsNullTerminated/AMD_HIP_BACKEND___{{.*}}_
1515
{{OPT}}urProgramGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS
16+
17+
# HIP doesn't expose kernel names
1618
{{OPT}}urProgramGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES
19+
1720
{{OPT}}urProgramGetInfoTest.InvalidNullHandleProgram/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_REFERENCE_COUNT
1821
{{OPT}}urProgramGetInfoTest.InvalidNullHandleProgram/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_CONTEXT
1922
{{OPT}}urProgramGetInfoTest.InvalidNullHandleProgram/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_NUM_DEVICES
@@ -23,7 +26,10 @@ urProgramBuildTest.BuildFailure/AMD_HIP_BACKEND___{{.*}}_
2326
{{OPT}}urProgramGetInfoTest.InvalidNullHandleProgram/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_BINARIES
2427
{{OPT}}urProgramGetInfoTest.InvalidNullHandleProgram/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS
2528
{{OPT}}urProgramGetInfoTest.InvalidNullHandleProgram/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES
29+
30+
# HIP hasn't implemented urProgramLink
2631
{{OPT}}urProgramLinkTest.Success/AMD_HIP_BACKEND___{{.*}}_
32+
2733
{{OPT}}urProgramSetSpecializationConstantsTest.Success/AMD_HIP_BACKEND___{{.*}}_
2834
{{OPT}}urProgramSetSpecializationConstantsTest.UseDefaultValue/AMD_HIP_BACKEND___{{.*}}_
2935
{{OPT}}urProgramSetMultipleSpecializationConstantsTest.MultipleCalls/AMD_HIP_BACKEND___{{.*}}_

0 commit comments

Comments
 (0)