From c4b13f7a2f7f74006f2436ef431093d13d94f1f3 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Sat, 12 Mar 2022 16:44:29 +0100 Subject: [PATCH] [clang][deps] Simplify PREFIX definitions in tests 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 do with `sed 's:\\\\\?:/:g'`. Differential Revision: https://reviews.llvm.org/D121516 --- clang/test/ClangScanDeps/diagnostics.c | 8 ++-- clang/test/ClangScanDeps/modules-context-hash.c | 8 ++-- .../modules-fmodule-name-no-module-built.m | 8 ++-- .../ClangScanDeps/modules-full-by-mod-name.cpp | 13 +++---- clang/test/ClangScanDeps/modules-full.cpp | 23 +++++------- clang/test/ClangScanDeps/modules-inferred.m | 10 ++--- .../ClangScanDeps/modules-pch-common-submodule.c | 26 +++++-------- .../modules-pch-common-via-submodule.c | 26 +++++-------- clang/test/ClangScanDeps/modules-pch.c | 43 +++++++++------------- clang/test/ClangScanDeps/preserved-args.c | 8 ++-- clang/test/ClangScanDeps/removed-args.c | 8 ++-- 11 files changed, 69 insertions(+), 112 deletions(-) diff --git a/clang/test/ClangScanDeps/diagnostics.c b/clang/test/ClangScanDeps/diagnostics.c index 0dcac47..0b36abc 100644 --- a/clang/test/ClangScanDeps/diagnostics.c +++ b/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": [], diff --git a/clang/test/ClangScanDeps/modules-context-hash.c b/clang/test/ClangScanDeps/modules-context-hash.c index 10c7d18..7968e02 100644 --- a/clang/test/ClangScanDeps/modules-context-hash.c +++ b/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": [], diff --git a/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m b/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m index 8469b49..518d704 100644 --- a/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m +++ b/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": [] diff --git a/clang/test/ClangScanDeps/modules-full-by-mod-name.cpp b/clang/test/ClangScanDeps/modules-full-by-mod-name.cpp index e8a067a..f5d957ff 100644 --- a/clang/test/ClangScanDeps/modules-full-by-mod-name.cpp +++ b/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": [ diff --git a/clang/test/ClangScanDeps/modules-full.cpp b/clang/test/ClangScanDeps/modules-full.cpp index 1881053..e628a5f 100644 --- a/clang/test/ClangScanDeps/modules-full.cpp +++ b/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": [ diff --git a/clang/test/ClangScanDeps/modules-inferred.m b/clang/test/ClangScanDeps/modules-inferred.m index 1725b14..d1e028d 100644 --- a/clang/test/ClangScanDeps/modules-inferred.m +++ b/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 a = 0; -// CHECK: -[[PREFIX:.*]] -// CHECK-NEXT: -[[SOURCEDIR:.*]] -// CHECK-NEXT: { +// CHECK: { // CHECK-NEXT: "modules": [ // CHECK-NEXT: { // CHECK-NEXT: "clang-module-deps": [], diff --git a/clang/test/ClangScanDeps/modules-pch-common-submodule.c b/clang/test/ClangScanDeps/modules-pch-common-submodule.c index 574100d..d478a2f 100644 --- a/clang/test/ClangScanDeps/modules-pch-common-submodule.c +++ b/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 diff --git a/clang/test/ClangScanDeps/modules-pch-common-via-submodule.c b/clang/test/ClangScanDeps/modules-pch-common-via-submodule.c index 4d1a702..d332187 100644 --- a/clang/test/ClangScanDeps/modules-pch-common-via-submodule.c +++ b/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 diff --git a/clang/test/ClangScanDeps/modules-pch.c b/clang/test/ClangScanDeps/modules-pch.c index 7258d36..09da6b0 100644 --- a/clang/test/ClangScanDeps/modules-pch.c +++ b/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 diff --git a/clang/test/ClangScanDeps/preserved-args.c b/clang/test/ClangScanDeps/preserved-args.c index 740cbc3..a1f0a5c 100644 --- a/clang/test/ClangScanDeps/preserved-args.c +++ b/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": [ diff --git a/clang/test/ClangScanDeps/removed-args.c b/clang/test/ClangScanDeps/removed-args.c index 6404e6d..2867c66 100644 --- a/clang/test/ClangScanDeps/removed-args.c +++ b/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": [], -- 2.7.4