Skip to content

Commit 6308cd0

Browse files
Migrate test to touch.py
1 parent 3c51106 commit 6308cd0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

test/Driver/Dependencies/Inputs/touch.py

Lines changed: 6 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,8 @@
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+
for filePath in glob.glob(filePathPattern):
30+
with open(filePath, 'a'):
31+
os.utime(filePath, (timeVal, timeVal))

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

Lines changed: 4 additions & 4 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,9 +12,9 @@
1212
// CHECK-FIRST-DAG: Produced master.swiftmodule
1313

1414
// swift-driver checks existence of all outputs
15-
// RUN: touch -t 201401240006 %t/*.swiftmodule
16-
// RUN: touch -t 201401240006 %t/*.swiftdoc
17-
// RUN: touch -t 201401240006 %t/*.swiftsourceinfo
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
1818

1919
// 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
2020

0 commit comments

Comments
 (0)