From 968bad96c56c9b97afe6007c8349d2dec49aa012 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Tue, 8 Oct 2024 08:29:17 -0700 Subject: [PATCH] Skip new checks when compiling certain source files including: + Source 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 --- backends/p4test/run-p4-sample.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/backends/p4test/run-p4-sample.py b/backends/p4test/run-p4-sample.py index ae0a89e2d73..5ab0fa373c6 100755 --- a/backends/p4test/run-p4-sample.py +++ b/backends/p4test/run-p4-sample.py @@ -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 = [ @@ -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 @@ -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: @@ -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)