Skip to content

Commit 1800038

Browse files
[clang] Fix ClangScanDeps test for llvm#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
1 parent 65a8448 commit 1800038

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

clang/test/ClangScanDeps/pr61006.cppm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
// RUN: mkdir -p %t
77
// RUN: split-file %s %t
88
//
9-
// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir`
10-
// RUN: ln -s %clang++ %t/clang++
11-
// RUN: sed "s|EXPECTED_RESOURCE_DIR|$EXPECTED_RESOURCE_DIR|g; s|DIR|%/t|g" %t/P1689.json.in > %t/P1689.json
12-
// RUN: clang-scan-deps -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/a.cpp -DPREFIX=%/t
9+
// RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir` && \
10+
// RUN: ln -s %clang++ %t/clang++ && \
11+
// RUN: sed "s|EXPECTED_RESOURCE_DIR|$EXPECTED_RESOURCE_DIR|g; s|DIR|%/t|g" %t/P1689.json.in > %t/P1689.json && \
12+
// RUN: clang-scan-deps -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/a.cpp -DPREFIX=%/t && \
1313
// RUN: clang-scan-deps -format=p1689 \
1414
// RUN: -- %t/clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/a.cpp -o %t/a.o \
1515
// RUN: -resource-dir $EXPECTED_RESOURCE_DIR | FileCheck %t/a.cpp -DPREFIX=%/t
@@ -25,7 +25,7 @@
2525
]
2626

2727
//--- a.cpp
28-
#include <stddef.h>
28+
#include "a.h"
2929
import b;
3030

3131
// CHECK: {
@@ -42,3 +42,5 @@ import b;
4242
// CHECK-NEXT: ],
4343
// CHECK-NEXT: "version": 1
4444
// CHECK-NEXT: }
45+
46+
//--- a.h

0 commit comments

Comments
 (0)