From cc871cf6b50f6a76f2083d192e2254a16832224b Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Thu, 26 May 2022 15:38:04 -0500 Subject: [PATCH] [Polly][Test] Fix race condition while printing dot files. The tests dot-scops.ll and dot-scops-npm.ll both wrote to the same file scops.func.dot. If they are executed in parallel they will race for the file. Fix by renaming func to func_npm in dot-scops-npm.ll so this test writes dot scops.func_npm.dot. Long-term, we will probably pass a file name (prefix) to the printer pass such that we can use the guaranteed-unique LIT %t placeholder in tests. --- polly/test/ScopDetect/dot-scops-npm.ll | 13 +++++++++---- polly/test/ScopDetect/dot-scops.ll | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/polly/test/ScopDetect/dot-scops-npm.ll b/polly/test/ScopDetect/dot-scops-npm.ll index 3911d0fb97cf..c426d0209694 100644 --- a/polly/test/ScopDetect/dot-scops-npm.ll +++ b/polly/test/ScopDetect/dot-scops-npm.ll @@ -1,15 +1,20 @@ ; RUN: opt %loadNPMPolly "-passes=polly-scop-printer" -disable-output < %s -; RUN: FileCheck %s -input-file=scops.func.dot +; RUN: FileCheck %s -input-file=scops.func_npm.dot ; ; Check that the ScopPrinter does not crash. ; ScopPrinter needs the ScopDetection pass, which should depend on ; ScalarEvolution transitively. +; +; FIXME: polly-scop-printer always prints to the same hardcoded filename +; scops..dot. If there is another test with the same +; function name and printing a dot file there will be a race condition +; when running tests in parallel. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -define void @func(i32 %n, i32 %m, double* noalias nonnull %A) { -; CHECK: digraph "Scop Graph for 'func' function" -; CHECK-NEXT: label="Scop Graph for 'func' function" +define void @func_npm(i32 %n, i32 %m, double* noalias nonnull %A) { +; CHECK: digraph "Scop Graph for 'func_npm' function" +; CHECK-NEXT: label="Scop Graph for 'func_npm' function" ; CHECK: Node0x[[EntryID:.*]] [shape=record,label="{entry:\l br label %outer.for\l}"]; ; CHECK-NEXT: Node0x[[EntryID]] -> Node0x[[OUTER_FOR_ID:.*]]; ; CHECK-NEXT: Node0x[[OUTER_FOR_ID]] [shape=record,label="{outer.for: diff --git a/polly/test/ScopDetect/dot-scops.ll b/polly/test/ScopDetect/dot-scops.ll index 3b26d6c9464e..590f222c4690 100644 --- a/polly/test/ScopDetect/dot-scops.ll +++ b/polly/test/ScopDetect/dot-scops.ll @@ -3,6 +3,11 @@ ; Check that the ScopPrinter does not crash. ; ScopPrinter needs the ScopDetection pass, which should depend on ; ScalarEvolution transitively. +; +; FIXME: -dot-scops always prints to the same hardcoded filename +; scops..dot. If there is another test with the same +; function name and printing a dot file there will be a race condition +; when running tests in parallel. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"