jansvoboda11 created this revision.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Instead of outputting the test directory into the JSON result file, parsing it 
with `FileCheck` and then potentially stripping it, simply use `FileCheck`'s 
`-D` option.

Note that we use `%/t` instead of `%t` in order to normalize to forward slashes 
on Windows, which matches what we print in the scanner.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121516

Files:
  clang/test/ClangScanDeps/diagnostics.c
  clang/test/ClangScanDeps/modules-context-hash.c
  clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
  clang/test/ClangScanDeps/modules-full-by-mod-name.cpp
  clang/test/ClangScanDeps/modules-full.cpp
  clang/test/ClangScanDeps/modules-inferred.m
  clang/test/ClangScanDeps/modules-pch-common-submodule.c
  clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
  clang/test/ClangScanDeps/modules-pch.c
  clang/test/ClangScanDeps/preserved-args.c
  clang/test/ClangScanDeps/removed-args.c

Index: clang/test/ClangScanDeps/removed-args.c
===================================================================
--- clang/test/ClangScanDeps/removed-args.c
+++ clang/test/ClangScanDeps/removed-args.c
@@ -8,12 +8,10 @@
 // RUN: cp %S/Inputs/removed-args/* %t
 
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/removed-args/cdb.json.template > %t/cdb.json
-// RUN: echo -%t > %t/result.json
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full >> %t/result.json
-// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
+// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
 //
-// CHECK:      -[[PREFIX:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK-NEXT:       "clang-module-deps": [],
Index: clang/test/ClangScanDeps/preserved-args.c
===================================================================
--- clang/test/ClangScanDeps/preserved-args.c
+++ clang/test/ClangScanDeps/preserved-args.c
@@ -2,12 +2,10 @@
 // RUN: cp -r %S/Inputs/preserved-args/* %t
 // RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
 
-// RUN: echo -%t > %t/result.json
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full >> %t/result.json
-// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
+// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
 
-// CHECK:      -[[PREFIX:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK:            "command-line": [
Index: clang/test/ClangScanDeps/modules-pch.c
===================================================================
--- clang/test/ClangScanDeps/modules-pch.c
+++ clang/test/ClangScanDeps/modules-pch.c
@@ -8,16 +8,14 @@
 // Scan dependencies of the PCH:
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_pch.json > %t/cdb.json
-// RUN: echo -%t > %t/result_pch.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build >> %t/result_pch.json
-// RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK-PCH
+// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-PCH
 //
 // Check we didn't build the PCH during dependency scanning.
 // RUN: not cat %/t/pch.h.gch
 //
-// CHECK-PCH:      -[[PREFIX:.*]]
-// CHECK-PCH-NEXT: {
+// CHECK-PCH:      {
 // CHECK-PCH-NEXT:   "modules": [
 // CHECK-PCH-NEXT:     {
 // CHECK-PCH-NEXT:       "clang-module-deps": [],
@@ -109,14 +107,13 @@
 
 // Explicitly build the PCH:
 //
-// RUN: tail -n +2 %t/result_pch.json > %t/result_pch_stripped.json
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --module-name=ModCommon1 > %t/mod_common_1.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --module-name=ModCommon2 > %t/mod_common_2.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --module-name=ModPCH > %t/mod_pch.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --tu-index=0 > %t/pch.rsp
 //
 // RUN: %clang @%t/mod_common_1.cc1.rsp
@@ -127,13 +124,11 @@
 // Scan dependencies of the TU:
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu.json > %t/cdb.json
-// RUN: echo -%t > %t/result_tu.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build >> %t/result_tu.json
-// RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK-TU
+// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu.json
+// RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU
 //
-// CHECK-TU:      -[[PREFIX:.*]]
-// CHECK-TU-NEXT: {
+// CHECK-TU:      {
 // CHECK-TU-NEXT:   "modules": [
 // CHECK-TU-NEXT:     {
 // CHECK-TU-NEXT:       "clang-module-deps": [],
@@ -178,10 +173,9 @@
 
 // Explicitly build the TU:
 //
-// RUN: tail -n +2 %t/result_tu.json > %t/result_tu_stripped.json
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu.json \
 // RUN:   --module-name=ModTU > %t/mod_tu.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu.json \
 // RUN:   --tu-index=0 > %t/tu.rsp
 //
 // RUN: %clang @%t/mod_tu.cc1.rsp
@@ -190,13 +184,11 @@
 // Scan dependencies of the TU that has common modules with the PCH:
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu_with_common.json > %t/cdb.json
-// RUN: echo -%t > %t/result_tu_with_common.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build >> %t/result_tu_with_common.json
-// RUN: cat %t/result_tu_with_common.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK-TU-WITH-COMMON
+// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu_with_common.json
+// RUN: cat %t/result_tu_with_common.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU-WITH-COMMON
 //
-// CHECK-TU-WITH-COMMON:      -[[PREFIX:.*]]
-// CHECK-TU-WITH-COMMON-NEXT: {
+// CHECK-TU-WITH-COMMON:      {
 // CHECK-TU-WITH-COMMON-NEXT:   "modules": [
 // CHECK-TU-WITH-COMMON-NEXT:     {
 // CHECK-TU-WITH-COMMON-NEXT:       "clang-module-deps": [],
@@ -243,10 +235,9 @@
 
 // Explicitly build the TU that has common modules with the PCH:
 //
-// RUN: tail -n +2 %t/result_tu_with_common.json > %t/result_tu_with_common_stripped.json
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_with_common_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_with_common.json \
 // RUN:   --module-name=ModTUWithCommon > %t/mod_tu_with_common.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_with_common_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_with_common.json \
 // RUN:   --tu-index=0 > %t/tu_with_common.rsp
 //
 // RUN: %clang @%t/mod_tu_with_common.cc1.rsp
Index: clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
===================================================================
--- clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
+++ clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
@@ -12,13 +12,11 @@
 // Scan dependencies of the PCH:
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-via-submodule/cdb_pch.json > %t/cdb.json
-// RUN: echo -%t > %t/result_pch.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build >> %t/result_pch.json
-// RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK-PCH
+// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-PCH
 //
-// CHECK-PCH:      -[[PREFIX:.*]]
-// CHECK-PCH-NEXT: {
+// CHECK-PCH:      {
 // CHECK-PCH-NEXT:   "modules": [
 // CHECK-PCH-NEXT:     {
 // CHECK-PCH-NEXT:       "clang-module-deps": [],
@@ -62,10 +60,9 @@
 
 // Explicitly build the PCH:
 //
-// RUN: tail -n +2 %t/result_pch.json > %t/result_pch_stripped.json
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --module-name=ModCommon > %t/mod_common.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --tu-index=0 > %t/pch.rsp
 //
 // RUN: %clang @%t/mod_common.cc1.rsp
@@ -74,13 +71,11 @@
 // Scan dependencies of the TU:
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-via-submodule/cdb_tu.json > %t/cdb.json
-// RUN: echo -%t > %t/result_tu.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build >> %t/result_tu.json
-// RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK-TU
+// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu.json
+// RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU
 //
-// CHECK-TU:      -[[PREFIX:.*]]
-// CHECK-TU-NEXT: {
+// CHECK-TU:      {
 // CHECK-TU-NEXT:   "modules": [
 // CHECK-TU-NEXT:     {
 // CHECK-TU-NEXT:       "clang-module-deps": [],
@@ -127,10 +122,9 @@
 
 // Explicitly build the TU:
 //
-// RUN: tail -n +2 %t/result_tu.json > %t/result_tu_stripped.json
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu.json \
 // RUN:   --module-name=ModTU > %t/mod_tu.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu.json \
 // RUN:   --tu-index=0 > %t/tu.rsp
 //
 // RUN: %clang @%t/mod_tu.cc1.rsp
Index: clang/test/ClangScanDeps/modules-pch-common-submodule.c
===================================================================
--- clang/test/ClangScanDeps/modules-pch-common-submodule.c
+++ clang/test/ClangScanDeps/modules-pch-common-submodule.c
@@ -14,13 +14,11 @@
 // Scan dependencies of the PCH:
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-submodule/cdb_pch.json > %t/cdb.json
-// RUN: echo -%t > %t/result_pch.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build >> %t/result_pch.json
-// RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK-PCH
+// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-PCH
 //
-// CHECK-PCH:      -[[PREFIX:.*]]
-// CHECK-PCH-NEXT: {
+// CHECK-PCH:      {
 // CHECK-PCH-NEXT:   "modules": [
 // CHECK-PCH-NEXT:     {
 // CHECK-PCH-NEXT:       "clang-module-deps": [],
@@ -65,10 +63,9 @@
 
 // Explicitly build the PCH:
 //
-// RUN: tail -n +2 %t/result_pch.json > %t/result_pch_stripped.json
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --module-name=ModCommon > %t/mod_common.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_pch.json \
 // RUN:   --tu-index=0 > %t/pch.rsp
 //
 // RUN: %clang @%t/mod_common.cc1.rsp
@@ -77,13 +74,11 @@
 // Scan dependencies of the TU:
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-submodule/cdb_tu.json > %t/cdb.json
-// RUN: echo -%t > %t/result_tu.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build >> %t/result_tu.json
-// RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK-TU
+// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu.json
+// RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU
 //
-// CHECK-TU:      -[[PREFIX:.*]]
-// CHECK-TU-NEXT: {
+// CHECK-TU:      {
 // CHECK-TU-NEXT:   "modules": [
 // CHECK-TU-NEXT:     {
 // CHECK-TU-NEXT:       "clang-module-deps": [],
@@ -129,10 +124,9 @@
 
 // Explicitly build the TU:
 //
-// RUN: tail -n +2 %t/result_tu.json > %t/result_tu_stripped.json
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu.json \
 // RUN:   --module-name=ModTU > %t/mod_tu.cc1.rsp
-// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu_stripped.json \
+// RUN: %python %S/../../utils/module-deps-to-rsp.py %t/result_tu.json \
 // RUN:   --tu-index=0 > %t/tu.rsp
 //
 // RUN: %clang @%t/mod_tu.cc1.rsp
Index: clang/test/ClangScanDeps/modules-inferred.m
===================================================================
--- clang/test/ClangScanDeps/modules-inferred.m
+++ clang/test/ClangScanDeps/modules-inferred.m
@@ -5,19 +5,15 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" -e "s|FRAMEWORKS|%/S/Inputs/frameworks|g" \
 // RUN:   %/S/Inputs/modules_inferred_cdb.json > %t.cdb
 //
-// RUN: echo -%t.dir > %t.result
-// RUN: echo -%S >> %t.result
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -format experimental-full \
-// RUN:   -generate-modules-path-args -mode preprocess-minimized-sources >> %t.result
-// RUN: cat %t.result | sed -e 's/\\\\/\//g' -e 's/\\/\//g' | FileCheck --check-prefixes=CHECK %s
+// RUN:   -generate-modules-path-args -mode preprocess-minimized-sources > %t.result
+// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t.dir -DSOURCEDIR=%/S --check-prefixes=CHECK
 
 #include <Inferred/Inferred.h>
 
 inferred a = 0;
 
-// CHECK: -[[PREFIX:.*]]
-// CHECK-NEXT: -[[SOURCEDIR:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK-NEXT:       "clang-module-deps": [],
Index: clang/test/ClangScanDeps/modules-full.cpp
===================================================================
--- clang/test/ClangScanDeps/modules-full.cpp
+++ clang/test/ClangScanDeps/modules-full.cpp
@@ -10,31 +10,26 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb.json > %t.cdb
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl.json > %t_clangcl.cdb
 //
-// RUN: echo %t.dir > %t.result
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
-// RUN:   -mode preprocess-minimized-sources >> %t.result
-// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK,CHECK-NO-ABS %s
+// RUN:   -mode preprocess-minimized-sources > %t.result
+// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-NO-ABS %s
 //
-// RUN: echo %t.dir > %t.result
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
-// RUN:   -generate-modules-path-args -mode preprocess-minimized-sources >> %t.result
-// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK,CHECK-ABS %s
+// RUN:   -generate-modules-path-args -mode preprocess-minimized-sources > %t.result
+// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-ABS %s
 //
-// RUN: echo %t.dir > %t.result
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
 // RUN:   -generate-modules-path-args -module-files-dir %t.dir/custom \
-// RUN:   -mode preprocess-minimized-sources >> %t.result
-// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK,CHECK-CUSTOM %s
+// RUN:   -mode preprocess-minimized-sources > %t.result
+// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-CUSTOM %s
 //
-// RUN: echo %t.dir > %t_clangcl.result
 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \
-// RUN:   -mode preprocess-minimized-sources >> %t_clangcl.result
-// RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK,CHECK-NO-ABS %s
+// RUN:   -mode preprocess-minimized-sources > %t_clangcl.result
+// RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-NO-ABS %s
 
 #include "header.h"
 
-// CHECK: [[PREFIX:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK-NEXT:       "clang-module-deps": [
Index: clang/test/ClangScanDeps/modules-full-by-mod-name.cpp
===================================================================
--- clang/test/ClangScanDeps/modules-full-by-mod-name.cpp
+++ clang/test/ClangScanDeps/modules-full-by-mod-name.cpp
@@ -11,18 +11,15 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_by_mod_name.json > %t.cdb
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl_by_mod_name.json > %t_clangcl.cdb
 //
-// RUN: echo %t.dir > %t.result
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
-// RUN:   -mode preprocess-minimized-sources -module-name=header1 >> %t.result
-// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK %s
+// RUN:   -mode preprocess-minimized-sources -module-name=header1 > %t.result
+// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
 //
-// RUN: echo %t.dir > %t_clangcl.result
 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \
-// RUN:   -mode preprocess-minimized-sources -module-name=header1 >> %t_clangcl.result
-// RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK %s
+// RUN:   -mode preprocess-minimized-sources -module-name=header1 > %t_clangcl.result
+// RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
 
-// CHECK: [[PREFIX:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK-NEXT:       "clang-module-deps": [
Index: clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
===================================================================
--- clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
+++ clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
@@ -9,16 +9,14 @@
 // RUN: cp %S/Inputs/module.modulemap %t.dir/Inputs/module.modulemap
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/module_fmodule_name_cdb.json > %t.cdb
 
-// RUN: echo %t.dir > %t.result
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -format experimental-full \
-// RUN:   -generate-modules-path-args -mode preprocess-minimized-sources >> %t.result
-// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck --check-prefixes=CHECK %s
+// RUN:   -generate-modules-path-args -mode preprocess-minimized-sources > %t.result
+// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
 
 #import "header3.h"
 #import "header.h"
 
-// CHECK: [[PREFIX:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK-NEXT:       "clang-module-deps": []
Index: clang/test/ClangScanDeps/modules-context-hash.c
===================================================================
--- clang/test/ClangScanDeps/modules-context-hash.c
+++ clang/test/ClangScanDeps/modules-context-hash.c
@@ -13,13 +13,11 @@
 // entities would be non-deterministic. To prevent this, run the scans separately
 // and verify that the context hashes differ with a single FileCheck invocation.
 //
-// RUN: echo -%t > %t/result.json
-// RUN: clang-scan-deps -compilation-database %t/cdb_a.json -format experimental-full -j 1 >> %t/result.json
+// RUN: clang-scan-deps -compilation-database %t/cdb_a.json -format experimental-full -j 1 >  %t/result.json
 // RUN: clang-scan-deps -compilation-database %t/cdb_b.json -format experimental-full -j 1 >> %t/result.json
-// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -check-prefix=CHECK
+// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK
 
-// CHECK:      -[[PREFIX:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK-NEXT:       "clang-module-deps": [],
Index: clang/test/ClangScanDeps/diagnostics.c
===================================================================
--- clang/test/ClangScanDeps/diagnostics.c
+++ clang/test/ClangScanDeps/diagnostics.c
@@ -2,17 +2,15 @@
 // RUN: cp %S/Inputs/diagnostics/* %t
 
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/diagnostics/cdb.json.template > %t/cdb.json
-// RUN: echo -%t > %t/result.json
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full 2>&1 >> %t/result.json
-// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full 2>&1 > %t/result.json
+// RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
 
 // Check that the '-Wno-error=invalid-ios-deployment-target' option is being
 // respected and invalid arguments like '-target i386-apple-ios14.0-simulator'
 // do not result in an error.
 
 // CHECK-NOT:  error:
-// CHECK:      -[[PREFIX:.*]]
-// CHECK-NEXT: {
+// CHECK:      {
 // CHECK-NEXT:   "modules": [
 // CHECK-NEXT:     {
 // CHECK-NEXT:       "clang-module-deps": [],
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to