Skip to content

Commit

Permalink
Skip new checks when compiling certain source files including: + Sour…
Browse files Browse the repository at this point in the history
…ce files that are the output of the midend pass of the compiler, because they can include intentional name duplication created in the LocalizeActions pass. + P4-16 source files created by translating a P4-14 source file to P4-16.

Signed-off-by: Andy Fingerhut <[email protected]>
  • Loading branch information
jafingerhut committed Oct 8, 2024
1 parent 99b93d4 commit 968bad9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions backends/p4test/run-p4-sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def compare_files(options, produced, expected, ignore_case):
return FAILURE


def recompile_file(options, produced, mustBeIdentical):
def recompile_file(options, produced, mustBeIdentical, origFileP414=False):
# Compile the generated file a second time
secondFile = produced + "-x"
args = [
Expand All @@ -174,8 +174,10 @@ def recompile_file(options, produced, mustBeIdentical):
secondFile,
"--std",
"p4-16",
produced,
] + options.compilerOptions
]
if origFileP414 or ('-midend' in produced):
args += ["--excludeFrontendPasses", "DuplicateHierarchicalNameCheck"]
args += [produced] + options.compilerOptions
if options.runDebugger:
if options.runDebugger_skip > 0:
options.runDebugger_skip = options.runDebugger_skip - 1
Expand Down Expand Up @@ -314,7 +316,10 @@ def getArch(path):
args.extend(["--p4runtime-files", p4runtimeFile])
args.extend(["--p4runtime-entries-files", p4runtimeEntriesFile])

origFileP414 = False
if "p4_14" in options.p4filename or "v1_samples" in options.p4filename:
origFileP414 = True
args.extend(["--excludeFrontendPasses", "DuplicateHierarchicalNameCheck"])
args.extend(["--std", "p4-14"])
args.extend(argv)
if options.runDebugger:
Expand Down Expand Up @@ -357,7 +362,9 @@ def getArch(path):
if result == SUCCESS:
result = check_generated_files(options, tmpdir, expected_dirname)
if (result == SUCCESS) and (not expected_error):
result = recompile_file(options, ppfile, False)
print("jaf dbg just before recompile_file")
result = recompile_file(options, ppfile, False, origFileP414)
print("jaf dbg just after recompile_file")
if (
(result == SUCCESS)
and (not expected_error)
Expand Down

0 comments on commit 968bad9

Please sign in to comment.