Skip to content

Commit 70376a1

Browse files
authored
[ScanDependencies] Fix JSON generation under certain circunstances. (#67246)
The code of `ScanDependencies.cpp` was creating invalid JSON since #66031 because in the case of having `extraPcmArgs` and `swiftOverlayDependencies`, but not `bridgingHeader`, a comma will not be added at the end of `extraPcmArgs`, creating an invalid JSON file. Additionally that same PR added a trailing comma at the end of the `swiftOverlayDependencies`, which valid JSON does not allow, but that bug was removed in #66366. Both problems are, however, present in the 5.9 branch, because #66936 included #66031, but not #66366. Besides fixing the problem in `ScanDependencies.cpp` I modified every test that uses `--scan-dependencies` to pass the produced JSON through Python's `json.tool` in order to validate proper JSON is produced. In most cases I was able to pipe the output of the tool into `FileCheck`, but in some cases the validation is done by itself because the checks depend on the exact format generated by `--scan-dependencies`. In a couple of tests I added a call to `FileCheck` that seemed to be missing. Without these changes, two tests seems to be generating invalid JSON in my machine: - `ScanDependencies/local_cache_consistency.swift` (which outputs `Expecting ',' delimiter: line 525 column 11 (char 22799)`) - `ScanDependencies/placholder_overlay_deps.swift`
1 parent 6e93ac1 commit 70376a1

File tree

54 files changed

+82
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+82
-57
lines changed

Diff for: lib/DependencyScan/ScanDependencies.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,11 @@ static void writeJSON(llvm::raw_ostream &out,
10611061
bool hasOverlayDependencies =
10621062
swiftTextualDeps->swift_overlay_module_dependencies &&
10631063
swiftTextualDeps->swift_overlay_module_dependencies->count > 0;
1064+
bool commaAfterBridgingHeaderPath = hasOverlayDependencies;
1065+
bool commaAfterExtraPcmArgs =
1066+
hasBridgingHeaderPath || commaAfterBridgingHeaderPath;
10641067
bool commaAfterFramework =
1065-
swiftTextualDeps->extra_pcm_args->count != 0 || hasBridgingHeaderPath;
1068+
swiftTextualDeps->extra_pcm_args->count != 0 || commaAfterExtraPcmArgs;
10661069

10671070
if (swiftTextualDeps->cas_fs_root_id.length != 0) {
10681071
writeJSONSingleField(out, "casFSRootID",
@@ -1090,7 +1093,7 @@ static void writeJSON(llvm::raw_ostream &out,
10901093
out << "\n";
10911094
}
10921095
out.indent(5 * 2);
1093-
out << (hasBridgingHeaderPath ? "],\n" : "]\n");
1096+
out << (commaAfterExtraPcmArgs ? "],\n" : "]\n");
10941097
}
10951098
/// Bridging header and its source file dependencies, if any.
10961099
if (hasBridgingHeaderPath) {
@@ -1126,7 +1129,7 @@ static void writeJSON(llvm::raw_ostream &out,
11261129
out.indent(6 * 2);
11271130
out << "]\n";
11281131
out.indent(5 * 2);
1129-
out << (hasOverlayDependencies ? "},\n" : "}\n");
1132+
out << (commaAfterBridgingHeaderPath ? "},\n" : "}\n");
11301133
}
11311134
if (hasOverlayDependencies) {
11321135
writeDependencies(out, swiftTextualDeps->swift_overlay_module_dependencies,

Diff for: test/CAS/binary_module_deps.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %S/../ScanDependencies/Inputs/Swift/E.swiftinterface -o %t/E.swiftmodule -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -swift-version 4
88
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %S/../ScanDependencies/Inputs/Swift/A.swiftinterface -o %t/A.swiftmodule -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -swift-version 4
99
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %t -swift-version 4 -cache-compile-job -cas-path %t/cas
10-
// RUN: %FileCheck %s -DTEMP=%t < %t/deps.json
10+
// RUN: %validate-json %t/deps.json | %FileCheck %s -DTEMP=%t
1111

1212
/// Test binary module key: binary module key is the CASID of itself.
1313
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey > %t/A.key.casid

Diff for: test/CAS/cas-explicit-module-map.swift

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %t/A.swift -o %t/A.swiftmodule -swift-version 5
77
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %t/B.swift -o %t/B.swiftmodule -I %t -swift-version 5
88
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %t/Test.swift -o %t/deps.json -I %t -swift-version 5 -cache-compile-job -cas-path %t/cas
9+
// RUN: %validate-json %t/deps.json &>/dev/null
910

1011
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey | tr -d '\n' > %t/A.key
1112
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:B moduleCacheKey | tr -d '\n' > %t/B.key

Diff for: test/CAS/module_deps.swift

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job -cas-path %t/cas
88
// Check the contents of the JSON output
9+
// RUN: %validate-json %t/deps.json &>/dev/null
910
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json
1011

1112
// Check the contents of the JSON output
@@ -15,11 +16,13 @@
1516
// RUN: %FileCheck %s -check-prefix CHECK-MAKE-DEPS < %t/deps.d
1617

1718
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job -cas-path %t/cas
19+
// RUN: %validate-json %t/deps.json &>/dev/null
1820
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json
1921

2022
// Ensure that scanning with `-clang-target` makes sure that Swift modules' respective PCM-dependency-build-argument sets do not contain target triples.
2123
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps_clang_target.json -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -clang-target %target-cpu-apple-macosx10.14 -cache-compile-job -cas-path %t/cas
2224
// Check the contents of the JSON output
25+
// RUN: %validate-json %t/deps_clang_target.json &>/dev/null
2326
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json
2427

2528
/// check cas-fs content

Diff for: test/CAS/module_deps_clang_extras.swift

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// RUN: %t/Test.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas -clang-include-tree \
1111
// RUN: -Xcc -fmodule-map-file=%t/module.modulemap -Xcc -ivfsoverlay -Xcc %t/empty.yaml \
1212
// RUN: -Xcc -I%t/empty.hmap
13+
// RUN: %validate-json %t/deps.json &>/dev/null
1314

1415
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps casFSRootID > %t/fs.casid
1516
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/fs.casid | %FileCheck %s -DDIR=%basename_t -check-prefix FS_ROOT

Diff for: test/CAS/module_deps_include_tree.swift

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job -cas-path %t/cas -clang-include-tree
88
// Check the contents of the JSON output
9+
// RUN: %validate-json %t/deps.json &>/dev/null
910
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json
1011

1112
// Check the contents of the JSON output
@@ -15,11 +16,13 @@
1516
// RUN: %FileCheck %s -check-prefix CHECK-MAKE-DEPS < %t/deps.d
1617

1718
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job -cas-path %t/cas -clang-include-tree
19+
// RUN: %validate-json %t/deps.json &>/dev/null
1820
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json
1921

2022
// Ensure that scanning with `-clang-target` makes sure that Swift modules' respective PCM-dependency-build-argument sets do not contain target triples.
2123
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps_clang_target.json -I %S/../ScanDependencies/Inputs/CHeaders -I %S/../ScanDependencies/Inputs/Swift -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -clang-target %target-cpu-apple-macosx10.14 -cache-compile-job -cas-path %t/cas -clang-include-tree
2224
// Check the contents of the JSON output
25+
// RUN: %validate-json %t/deps_clang_target.json &>/dev/null
2326
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json
2427

2528
/// check cas-fs content

Diff for: test/CAS/plugin_cas.swift

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// RUN: -cas-plugin-option first-prefix=myfirst- -cas-plugin-option second-prefix=mysecond- \
1414
// RUN: -cas-plugin-option upstream-path=%t/cas-upstream
1515
// Check the contents of the JSON output
16+
// RUN: %validate-json %t/deps.json &>/dev/null
1617
// RUN: %FileCheck -check-prefix CHECK -check-prefix CHECK_NO_CLANG_TARGET %s < %t/deps.json
1718

1819
// Check the contents of the JSON output
@@ -31,6 +32,7 @@
3132
// RUN: -cas-plugin-option first-prefix=myfirst- -cas-plugin-option second-prefix=mysecond- \
3233
// RUN: -cas-plugin-option upstream-path=%t/cas-upstream
3334
// Check the contents of the JSON output
35+
// RUN: %validate-json %t/deps_clang_target.json &>/dev/null
3436
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json
3537

3638
import C

Diff for: test/Frontend/module-alias-scan-deps.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/// Scanned dependencies should contain real name AppleLogging
1414
// RUN: %target-swift-frontend -scan-dependencies %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t > %t/scandump.output
15-
// RUN: %FileCheck %s -check-prefix=CHECK-REAL-NAME -input-file %t/scandump.output
15+
// RUN: %validate-json %t/scandump.output | %FileCheck %s -check-prefix=CHECK-REAL-NAME
1616
// CHECK-REAL-NAME-NOT: "swiftPrebuiltExternal": "XLogging"
1717
// CHECK-REAL-NAME-NOT: "compiledModulePath":{{.*}}XLogging.swiftmodule",
1818
// CHECK-REAL-NAME: "swiftPrebuiltExternal": "AppleLogging"
@@ -25,7 +25,7 @@
2525

2626
/// Scanned dependencies should contain real name AppleLoggingIF
2727
// RUN: %target-swift-frontend -scan-dependencies %t/FileLib.swift -module-alias XLogging=AppleLoggingIF -I %t > %t/scandumpIF.output
28-
// RUN: %FileCheck %s -check-prefix=CHECK-REAL-NAME-IF -input-file %t/scandumpIF.output
28+
// RUN: %validate-json %t/scandumpIF.output | %FileCheck %s -check-prefix=CHECK-REAL-NAME-IF
2929
// CHECK-REAL-NAME-IF-NOT: "swift": "XLogging"
3030
// CHECK-REAL-NAME-IF-NOT: "moduleInterfacePath":{{.*}}XLogging.swiftinterface
3131
// CHECK-REAL-NAME-IF: "swift": "AppleLoggingIF"

Diff for: test/ModuleInterface/clang-args-transitive-availability.swift

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: %target-swift-frontend -typecheck -strict-implicit-module-context %s -I %S/Inputs/macro-only-module -Xcc -DTANGERINE=1 -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
77

88
// RUN: %target-swift-frontend -scan-dependencies -strict-implicit-module-context %s -o %t/deps.json -I %S/Inputs/macro-only-module -Xcc -DTANGERINE=1 -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
9+
// RUN: %validate-json %t/deps.json &>/dev/null
910
// RUN: %FileCheck %s < %t/deps.json
1011

1112
import ImportsMacroSpecificClangModule

Diff for: test/ModuleInterface/clang-session-transitive.swift

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// RUN: %target-build-swift -module-name TestModule -module-link-name TestModule %S/Inputs/TestModule.swift -enable-library-evolution -emit-module-interface -o %t/TestModule.swiftmodule -swift-version 5 -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import
66

77
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I%t -validate-clang-modules-once -clang-build-session-file %t/Build.session -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
8+
// RUN: %validate-json %t/deps.json &>/dev/null
89
// RUN: %FileCheck %s < %t/deps.json
910

1011
import TestModule

Diff for: test/ModuleInterface/extension-transitive-availability.swift

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// RUN: %target-swift-emit-module-interface(%t/ExtensionAvailable.swiftinterface) %S/Inputs/extension-available.swift -module-name ExtensionAvailable -I%t -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
55

66
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I%t -application-extension -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
7+
// RUN: %validate-json %t/deps.json &>/dev/null
78
// RUN: %FileCheck %s < %t/deps.json
89

910
import ExtensionAvailable

Diff for: test/ModuleInterface/infer-arch-from-file.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
import arm64
77

88
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t -target arm64-apple-macos11.0
9-
// RUN: %FileCheck %s < %t/deps.json
9+
// RUN: %validate-json %t/deps.json | %FileCheck %s
1010

1111
// CHECK-NOT: arm64e-apple-macos11.0

Diff for: test/ScanDependencies/batch_module_scan.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json
1818

1919
// Check the contents of the JSON output
20-
// RUN: %FileCheck %s -check-prefix=CHECK-PCM < %t/outputs/F.pcm.json
21-
// RUN: %FileCheck %s -check-prefix=CHECK-SWIFT < %t/outputs/F.swiftmodule.json
20+
// RUN: %validate-json %t/outputs/F.pcm.json | %FileCheck %s -check-prefix=CHECK-PCM
21+
// RUN: %validate-json %t/outputs/F.swiftmodule.json | %FileCheck %s -check-prefix=CHECK-SWIFT
2222

2323
// CHECK-PCM: {
2424
// CHECK-PCM-NEXT: "mainModuleName": "F",

Diff for: test/ScanDependencies/batch_module_scan_arguments.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json
1818

1919
// Check the contents of the JSON output
20-
// RUN: %FileCheck %s -check-prefix=CHECK-TEN < %t/outputs/H.10.9.pcm.json
21-
// RUN: %FileCheck %s -check-prefix=CHECK-ELEVEN < %t/outputs/H.11.0.pcm.json
20+
// RUN: %validate-json %t/outputs/H.10.9.pcm.json | %FileCheck %s -check-prefix=CHECK-TEN
21+
// RUN: %validate-json %t/outputs/H.11.0.pcm.json | %FileCheck %s -check-prefix=CHECK-ELEVEN
2222

2323
// CHECK-TEN: "clang": "I"
2424
// CHECK-ELEVEN-NOT: "clang": "I"

Diff for: test/ScanDependencies/batch_module_scan_versioned.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
// RUN: %target-swift-frontend -scan-dependencies -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -target %target-cpu-apple-macosx11.0 -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json
1818

1919
// Check the contents of the JSON output
20-
// RUN: %FileCheck %s -check-prefix=CHECK-PCM109 < %t/outputs/G_109.pcm.json
20+
// RUN: %validate-json %t/outputs/G_109.pcm.json | %FileCheck %s -check-prefix=CHECK-PCM109
21+
// RUN: %validate-json %t/outputs/G_110.pcm.json &>/dev/null
2122
// RUN: %FileCheck %s -check-prefix=CHECK-PCM110 < %t/outputs/G_110.pcm.json
2223

2324
// CHECK-PCM109: {

Diff for: test/ScanDependencies/batch_prescan.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// RUN: %target-swift-frontend -scan-dependencies -import-prescan -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 -batch-scan-input-file %/t/inputs/input.json
1313

1414
// Check the contents of the JSON output
15-
// RUN: %FileCheck %s -check-prefix=CHECK-SWIFT < %t/outputs/F.swiftmodule.json
15+
// RUN: %validate-json %t/outputs/F.swiftmodule.json | %FileCheck %s -check-prefix=CHECK-SWIFT
1616

1717
// CHECK-SWIFT: {
1818
// CHECK-SWIFT-NEXT:"imports": [

Diff for: test/ScanDependencies/bin_mod_import.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import EWrapper
88
// RUN: %target-swift-frontend -compile-module-from-interface %S/Inputs/Swift/EWrapper.swiftinterface -o %t/EWrapper.swiftmodule -I %t
99
// Step 3: scan dependency should give us the binary module and a textual swift dependency from it
1010
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t
11-
// RUN: %FileCheck %s < %t/deps.json
11+
// RUN: %validate-json %t/deps.json | %FileCheck %s
1212

1313
// Step 4: Ensure that round-trip serialization does not affect result
1414
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization %s -o %t/deps.json -I %t
15-
// RUN: %FileCheck %s < %t/deps.json
15+
// RUN: %validate-json %t/deps.json | %FileCheck %s
1616

1717
// CHECK: "modulePath": "{{.*}}EWrapper.swiftmodule"
1818
// CHECK-NEXT: "directDependencies": [

Diff for: test/ScanDependencies/binary_framework_dependency.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
// Run the scan
1313
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -F %t/Frameworks/ -sdk %t
14-
// RUN: %FileCheck %s < %t/deps.json
14+
// RUN: %validate-json %t/deps.json | %FileCheck %s
1515

1616
import Foo
1717

Diff for: test/ScanDependencies/binary_module_only.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import Foo
2222

2323
// Step 3: scan dependencies, pointed only at the binary module file should detect it as a swiftBinaryModule kind of dependency
2424
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I %t/binaryModuleOnly -emit-dependencies -emit-dependencies-path %t/deps.d -sdk %t -prebuilt-module-cache-path %t/ResourceDir/%target-sdk-name/prebuilt-modules
25-
// RUN: %FileCheck %s -check-prefix=BINARY_MODULE_ONLY < %t/deps.json
25+
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=BINARY_MODULE_ONLY
2626

2727
// Step 4: Ensure that round-trip serialization does not affect result
2828
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization %s -o %t/deps.json -I %t/binaryModuleOnly -emit-dependencies -emit-dependencies-path %t/deps.d -sdk %t -prebuilt-module-cache-path %t/ResourceDir/%target-sdk-name/prebuilt-modules
29-
// RUN: %FileCheck %s -check-prefix=BINARY_MODULE_ONLY < %t/deps.json
29+
// RUN: %validate-json %t/deps.json | %FileCheck %s -check-prefix=BINARY_MODULE_ONLY

Diff for: test/ScanDependencies/blocklist-path-pass-down.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
// Run the scan
1717
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -F %t/Frameworks/ -sdk %t -blocklist-file %t/blocklist.yml
18-
// RUN: %FileCheck %s < %t/deps.json
18+
// RUN: %validate-json %t/deps.json | %FileCheck %s
1919

2020
import E
2121

Diff for: test/ScanDependencies/can_import_placeholder.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
// RUN: echo "}]" >> %/t/inputs/map.json
1212

1313
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -placeholder-dependency-module-map-file %t/inputs/map.json -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
14-
// RUN: %FileCheck %s < %t/deps.json
14+
// RUN: %validate-json %t/deps.json | %FileCheck %s
1515

1616
// Ensure that round-trip serialization does not affect result
1717
// RUN: %target-swift-frontend -scan-dependencies -test-dependency-scan-cache-serialization -module-cache-path %t/clang-module-cache %s -placeholder-dependency-module-map-file %t/inputs/map.json -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4
18-
// RUN: %FileCheck %s < %t/deps.json
18+
// RUN: %validate-json %t/deps.json | %FileCheck %s
1919

2020
// REQUIRES: executable_test
2121
// REQUIRES: objc_interop

Diff for: test/ScanDependencies/clang-target.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// RUN: find %t.module-cache -name "X-*.pcm" | count 1
1515
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t.module-cache %s -o %t.deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -target %target-cpu-apple-macosx10.14 -clang-target %target-cpu-apple-macosx10.14
1616

17-
// RUN: %FileCheck %s < %t.deps.json
17+
// RUN: %validate-json %t.deps.json | %FileCheck %s
1818

1919
// CHECK: "-clang-target"
2020
// CHECK-NEXT: "{{.*}}-apple-macosx10.14"

0 commit comments

Comments
 (0)