From 79561e5715f1365884cfb9eb9b547b871e56b314 Mon Sep 17 00:00:00 2001 From: Gabor Marton Date: Wed, 22 Aug 2018 15:33:03 +0200 Subject: [PATCH] Eliminate race condition in CTU lit tests --- test/Analysis/ctu-different-triples.c | 9 ++- test/Analysis/ctu-main.c | 9 ++- test/Analysis/ctu-main.cpp | 13 +-- test/Analysis/ctu-unknown-parts-in-triples.c | 9 ++- test/Analysis/ctu-va_list.cpp | 85 ++++++++++---------- 5 files changed, 65 insertions(+), 60 deletions(-) diff --git a/test/Analysis/ctu-different-triples.c b/test/Analysis/ctu-different-triples.c index 2857666b7b69..487843df8d9a 100644 --- a/test/Analysis/ctu-different-triples.c +++ b/test/Analysis/ctu-different-triples.c @@ -1,7 +1,8 @@ -// RUN: mkdir -p %T/ctudir3 -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %T/ctudir3/ctu-other.c.ast %S/Inputs/ctu-other.c -// RUN: cp %S/Inputs/externalFnMap2.txt %T/ctudir3/externalFnMap.txt -// RUN: %clang_cc1 -triple powerpc64-montavista-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir3 -verify %s +// RUN: rm -rf %t && mkdir %t +// RUN: mkdir -p %t/ctudir3 +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir3/ctu-other.c.ast %S/Inputs/ctu-other.c +// RUN: cp %S/Inputs/externalFnMap2.txt %t/ctudir3/externalFnMap.txt +// RUN: %clang_cc1 -triple powerpc64-montavista-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir3 -verify %s // We expect an error in this file, but without a location. // expected-error-re@./ctu-different-triples.c:*{{imported AST from {{.*}} had been generated for a different target, current: powerpc64-montavista-linux-gnu, imported: x86_64-pc-linux-gnu}} diff --git a/test/Analysis/ctu-main.c b/test/Analysis/ctu-main.c index ba2581bca341..7c266f1e8de2 100644 --- a/test/Analysis/ctu-main.c +++ b/test/Analysis/ctu-main.c @@ -1,7 +1,8 @@ -// RUN: mkdir -p %T/ctudir2 -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %T/ctudir2/ctu-other.c.ast %S/Inputs/ctu-other.c -// RUN: cp %S/Inputs/externalFnMap2.txt %T/ctudir2/externalFnMap.txt -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir2 -verify %s +// RUN: rm -rf %t && mkdir %t +// RUN: mkdir -p %t/ctudir2 +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir2/ctu-other.c.ast %S/Inputs/ctu-other.c +// RUN: cp %S/Inputs/externalFnMap2.txt %t/ctudir2/externalFnMap.txt +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir2 -verify %s void clang_analyzer_eval(int); diff --git a/test/Analysis/ctu-main.cpp b/test/Analysis/ctu-main.cpp index f13970f9cf0a..7ff256d6d69d 100644 --- a/test/Analysis/ctu-main.cpp +++ b/test/Analysis/ctu-main.cpp @@ -1,9 +1,10 @@ -// RUN: mkdir -p %T/ctudir -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %T/ctudir/ctu-other.cpp.ast %S/Inputs/ctu-other.cpp -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %T/ctudir/ctu-chain.cpp.ast %S/Inputs/ctu-chain.cpp -// RUN: cp %S/Inputs/externalFnMap.txt %T/ctudir/ -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir -verify %s -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir -std=c++11 -analyzer-display-ctu-progress 2>&1 %s | FileCheck %s +// RUN: rm -rf %t && mkdir %t +// RUN: mkdir -p %t/ctudir +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir/ctu-other.cpp.ast %S/Inputs/ctu-other.cpp +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir/ctu-chain.cpp.ast %S/Inputs/ctu-chain.cpp +// RUN: cp %S/Inputs/externalFnMap.txt %t/ctudir/ +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir -verify %s +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir -std=c++11 -analyzer-display-ctu-progress 2>&1 %s | FileCheck %s // CHECK: ANALYZE (CTU loaded AST for source file): {{.*}}/ctu-other.cpp // CHECK: ANALYZE (CTU loaded AST for source file): {{.*}}/ctu-chain.cpp diff --git a/test/Analysis/ctu-unknown-parts-in-triples.c b/test/Analysis/ctu-unknown-parts-in-triples.c index bd2061a8a911..24692048bcdd 100644 --- a/test/Analysis/ctu-unknown-parts-in-triples.c +++ b/test/Analysis/ctu-unknown-parts-in-triples.c @@ -1,10 +1,11 @@ // We do not expect any error when one part of the triple is unknown, but other // known parts are equal. -// RUN: mkdir -p %T/ctudir3 -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %T/ctudir3/ctu-other.c.ast %S/Inputs/ctu-other.c -// RUN: cp %S/Inputs/externalFnMap2.txt %T/ctudir3/externalFnMap.txt -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir3 -verify %s +// RUN: rm -rf %t && mkdir %t +// RUN: mkdir -p %t/ctudir3 +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir3/ctu-other.c.ast %S/Inputs/ctu-other.c +// RUN: cp %S/Inputs/externalFnMap2.txt %t/ctudir3/externalFnMap.txt +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir3 -verify %s // expected-no-diagnostics diff --git a/test/Analysis/ctu-va_list.cpp b/test/Analysis/ctu-va_list.cpp index 01d31ab9d1dc..09c19956f47c 100644 --- a/test/Analysis/ctu-va_list.cpp +++ b/test/Analysis/ctu-va_list.cpp @@ -1,45 +1,46 @@ -// RUN: mkdir -p %T/ctudir4 -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s - -// RUN: %clang_cc1 -triple powerpc-montavista-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple powerpc-montavista-pc-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple powerpc-montavista-pc-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s - -// RUN: %clang_cc1 -triple powerpc64-montavista-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple powerpc64-montavista-pc-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple powerpc64-montavista-pc-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s - -// RUN: %clang_cc1 -triple arm64-linux-android -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple arm64-linux-android -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple arm64-linux-android -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s - -// RUN: %clang_cc1 -triple le32-unknown-nacl -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple le32-unknown-nacl -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple le32-unknown-nacl -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s - -// RUN: %clang_cc1 -triple arm-linux-androideabi -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple arm-linux-androideabi -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple arm-linux-androideabi -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s - -// RUN: mkdir -p %T/ctudir4 -// RUN: %clang_cc1 -triple systemz-unknown-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple systemz-unknown-linux-gnu -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple systemz-unknown-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s - -// RUN: mkdir -p %T/ctudir4 -// RUN: %clang_cc1 -triple lanai-unknown-unknown -emit-pch -o %T/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c -// RUN: %clang_cc1 -triple lanai-unknown-unknown -emit-pch -o %T/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp -// RUN: cp %S/Inputs/externalFnMap_va_list.txt %T/ctudir4/externalFnMap.txt -// RUN: %clang_analyze_cc1 -triple lanai-unknown-unknown -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir4 -verify %s +// RUN: rm -rf %t && mkdir %t +// RUN: mkdir -p %t/ctudir4 +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s + +// RUN: %clang_cc1 -triple powerpc-montavista-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple powerpc-montavista-pc-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple powerpc-montavista-pc-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s + +// RUN: %clang_cc1 -triple powerpc64-montavista-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple powerpc64-montavista-pc-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple powerpc64-montavista-pc-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s + +// RUN: %clang_cc1 -triple arm64-linux-android -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple arm64-linux-android -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple arm64-linux-android -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s + +// RUN: %clang_cc1 -triple le32-unknown-nacl -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple le32-unknown-nacl -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple le32-unknown-nacl -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s + +// RUN: %clang_cc1 -triple arm-linux-androideabi -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple arm-linux-androideabi -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple arm-linux-androideabi -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s + +// RUN: mkdir -p %t/ctudir4 +// RUN: %clang_cc1 -triple systemz-unknown-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple systemz-unknown-linux-gnu -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple systemz-unknown-linux-gnu -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s + +// RUN: mkdir -p %t/ctudir4 +// RUN: %clang_cc1 -triple lanai-unknown-unknown -emit-pch -o %t/ctudir4/ctu-va_list-first.c.ast %S/Inputs/ctu-va_list-first.c +// RUN: %clang_cc1 -triple lanai-unknown-unknown -emit-pch -o %t/ctudir4/ctu-va_list-second.cpp.ast %S/Inputs/ctu-va_list-second.cpp +// RUN: cp %S/Inputs/externalFnMap_va_list.txt %t/ctudir4/externalFnMap.txt +// RUN: %clang_analyze_cc1 -triple lanai-unknown-unknown -analyzer-checker=core -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir4 -verify %s // expected-no-diagnostics