Skip to content

Commit

Permalink
[clang] Fix ClangScanDeps test for #61006.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ingomueller-net committed Aug 13, 2023
1 parent 65a8448 commit 1800038
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions clang/test/ClangScanDeps/pr61006.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,7 +25,7 @@
]

//--- a.cpp
#include <stddef.h>
#include "a.h"
import b;

// CHECK: {
Expand All @@ -42,3 +42,5 @@ import b;
// CHECK-NEXT: ],
// CHECK-NEXT: "version": 1
// CHECK-NEXT: }

//--- a.h

0 comments on commit 1800038

Please sign in to comment.