Skip to content

Commit 545334c

Browse files
authored
Merge pull request #66510 from tristanlabelle/fix-tests-windows-vs2022
Fix tests on Windows CI with VS2022
2 parents 7cb1e0d + 11f34b7 commit 545334c

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

test/Driver/Dependencies/Inputs/touch.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#
1616
# ----------------------------------------------------------------------------
1717

18+
import glob
1819
import os
1920
import sys
2021

@@ -23,6 +24,14 @@
2324

2425
# Update the output file mtime, or create it if necessary.
2526
# From http://stackoverflow.com/a/1160227.
26-
for outputFile in sys.argv[2:]:
27-
with open(outputFile, 'a'):
28-
os.utime(outputFile, (timeVal, timeVal))
27+
for filePathPattern in sys.argv[2:]:
28+
# Support glob patterns if the shell did not expand them (like cmd.exe)
29+
if glob.escape(filePathPattern) == filePathPattern:
30+
# Not a glob pattern. We should touch that specific file.
31+
filePaths = [filePathPattern]
32+
else:
33+
filePaths = glob.glob(filePathPattern)
34+
35+
for filePath in filePaths:
36+
with open(filePath, 'a'):
37+
os.utime(filePath, (timeVal, timeVal))

test/Driver/Dependencies/one-way-merge-module-fine.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: %empty-directory(%t)
44
// RUN: cp -r %S/Inputs/one-way-fine/* %t
5-
// RUN: touch -t 201401240005 %t/*
5+
// RUN: %{python} %S/Inputs/touch.py 201401240005 %t/*
66

77
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python.unquoted};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-FIRST %s
88

@@ -12,7 +12,9 @@
1212
// CHECK-FIRST-DAG: Produced master.swiftmodule
1313

1414
// swift-driver checks existence of all outputs
15-
// RUN: touch -t 201401240006 %t/{main,other,master}.swift{module,doc,sourceinfo}
15+
// RUN: %{python} %S/Inputs/touch.py 201401240006 %t/*.swiftmodule
16+
// RUN: %{python} %S/Inputs/touch.py 201401240006 %t/*.swiftdoc
17+
// RUN: %{python} %S/Inputs/touch.py 201401240006 %t/*.swiftsourceinfo
1618

1719
// RUN: cd %t && %swiftc_driver -driver-use-frontend-path "%{python.unquoted};%S/Inputs/update-dependencies.py;%swift-dependency-tool" -output-file-map %t/output.json -incremental -driver-always-rebuild-dependents ./main.swift ./other.swift -emit-module-path %t/master.swiftmodule -module-name main -j1 -v 2>&1 | %FileCheck -check-prefix=CHECK-SECOND %s
1820

test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
// RUN: %empty-directory(%t/BuildDir/Lib.framework/Modules/Lib.swiftmodule)
2-
// RUN: %empty-directory(%t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule)
1+
// RUN: %empty-directory(%t/Build1/Lib.framework/Modules/Lib.swiftmodule)
2+
// RUN: %empty-directory(%t/Build2/Lib.framework/Modules/Lib.swiftmodule)
33
// RUN: %empty-directory(%t/ModuleCache)
44

55
// RUN: echo 'public func showsUpInBothPlaces() {}' > %t/Lib.swift
66

77
// 1. Create a .swiftinterface file containing just one API, and put it inside a second build dir (without a .swiftmodule)
8-
// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib
8+
// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/Build2/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib
99

1010
// 2. Add a new API to the module, and compile just the serialized version in the build dir.
1111
// RUN: echo 'public func onlyInTheCompiledModule() {}' >> %t/Lib.swift
12-
// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftmodule-name -emit-module-interface-path %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib
12+
// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/Build1/Lib.framework/Modules/Lib.swiftmodule/%target-swiftmodule-name -emit-module-interface-path %t/Build1/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib
1313

1414
// 3. Make sure when we compile this test file, we can access both APIs since we'll
1515
// load the compiled .swiftmodule instead of the .swiftinterface in the SDK.
16-
// RUN: %target-swift-frontend -typecheck %s -F %t/BuildDir -F %t/SecondBuildDir -module-cache-path %t/ModuleCache
16+
// RUN: %target-swift-frontend -typecheck %s -F %t/Build1 -F %t/Build2 -module-cache-path %t/ModuleCache
1717

1818
// 4. Make sure we didn't compile any .swiftinterfaces into the module cache.
1919
// RUN: ls %t/ModuleCache | not grep 'swiftmodule'
2020

2121
// 5. This should also work if the swiftinterface isn't present in the first build dir.
22-
// RUN: rm %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name
23-
// RUN: %target-swift-frontend -typecheck %s -F %t/BuildDir -F %t/SecondBuildDir -module-cache-path %t/ModuleCache
22+
// RUN: rm %t/Build1/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name
23+
// RUN: %target-swift-frontend -typecheck %s -F %t/Build1 -F %t/Build2 -module-cache-path %t/ModuleCache
2424

2525
// 6. Make sure we /still/ didn't compile any .swiftinterfaces into the module cache.
2626
// RUN: ls %t/ModuleCache | not grep 'swiftmodule'

0 commit comments

Comments
 (0)