[clang] 1800038 - [clang] Fix ClangScanDeps test for #61006.

Ingo Müller via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 13 11:23:39 PDT 2023


Author: Ingo Müller
Date: 2023-08-13T18:23:34Z
New Revision: 1800038fba42741c4013c64ee307611251118ee3

URL: https://github.com/llvm/llvm-project/commit/1800038fba42741c4013c64ee307611251118ee3
DIFF: https://github.com/llvm/llvm-project/commit/1800038fba42741c4013c64ee307611251118ee3.diff

LOG: [clang] Fix ClangScanDeps test for #61006.

This patch solves two problems with the recently added test, which
caused CI failure in an internal downstream system:

1. It connects subsequent `RUN` statements with `&&` into a single
   statement; otherwise, the variable defined in the first of them is
   out of scope in the subsequent ones where it is used.
2. In our hermetic testing environment, the clang++ binary under test
   does not have access to standard include paths (`/usr/include` etc.),
   so the test fails because it does not find `stddef.h`. The patch thus
   changes the test to use a locally created `a.h` header file.

Differential Revision: https://reviews.llvm.org/D157817

Added: 
    

Modified: 
    clang/test/ClangScanDeps/pr61006.cppm

Removed: 
    


################################################################################
diff  --git a/clang/test/ClangScanDeps/pr61006.cppm b/clang/test/ClangScanDeps/pr61006.cppm
index 13cfe385be2e2d..f75edd38c81ba9 100644
--- a/clang/test/ClangScanDeps/pr61006.cppm
+++ b/clang/test/ClangScanDeps/pr61006.cppm
@@ -6,10 +6,10 @@
 // RUN: mkdir -p %t
 // RUN: split-file %s %t
 //
-// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir`
-// RUN: ln -s %clang++ %t/clang++
-// RUN: sed "s|EXPECTED_RESOURCE_DIR|$EXPECTED_RESOURCE_DIR|g; s|DIR|%/t|g" %t/P1689.json.in > %t/P1689.json
-// RUN: clang-scan-deps -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/a.cpp -DPREFIX=%/t
+// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir` && \
+// RUN: ln -s %clang++ %t/clang++ && \
+// RUN: sed "s|EXPECTED_RESOURCE_DIR|$EXPECTED_RESOURCE_DIR|g; s|DIR|%/t|g" %t/P1689.json.in > %t/P1689.json && \
+// RUN: clang-scan-deps -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/a.cpp -DPREFIX=%/t && \
 // RUN: clang-scan-deps -format=p1689 \
 // RUN:   -- %t/clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/a.cpp -o %t/a.o \
 // RUN:      -resource-dir $EXPECTED_RESOURCE_DIR | FileCheck %t/a.cpp -DPREFIX=%/t
@@ -25,7 +25,7 @@
 ]
 
 //--- a.cpp
-#include <stddef.h>
+#include "a.h"
 import b;
 
 // CHECK: {
@@ -42,3 +42,5 @@ import b;
 // CHECK-NEXT:   ],
 // CHECK-NEXT:   "version": 1
 // CHECK-NEXT: }
+
+//--- a.h


        


More information about the cfe-commits mailing list