Skip to content

Commit 0cdc614

Browse files
authored
Merge pull request swiftlang#21210 from compnerd/ill-replace-you-with-a-tiny-python-script
stdlib: replace shell script with python
2 parents b5aa391 + 6618ec1 commit 0cdc614

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

test/stdlib/Reflection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -parse-stdlib %s -module-name Reflection -o %t/a.out
33
// RUN: %target-codesign %t/a.out
4-
// RUN: %S/timeout.sh 360 %target-run %t/a.out | %FileCheck %s
4+
// RUN: %{python} %S/timeout.py 360 %target-run %t/a.out | %FileCheck %s
55
// REQUIRES: executable_test
66
// FIXME: timeout wrapper is necessary because the ASan test runs for hours
77

test/stdlib/Reflection_objc.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
// RUN: %target-clang %S/Inputs/Mirror/Mirror.mm -c -o %t/Mirror.mm.o -g
44
// RUN: %target-build-swift -parse-stdlib %s -module-name Reflection -I %S/Inputs/Mirror/ -Xlinker %t/Mirror.mm.o -o %t/a.out
55
// RUN: %target-codesign %t/a.out
6-
// RUN: %S/timeout.sh 360 %target-run %t/a.out %S/Inputs/shuffle.jpg | %FileCheck %s
7-
// REQUIRES: executable_test
6+
// RUN: %{python} %S/timeout.py 360 %target-run %t/a.out %S/Inputs/shuffle.jpg | %FileCheck %s
87
// FIXME: timeout wrapper is necessary because the ASan test runs for hours
98

9+
// REQUIRES: executable_test
10+
// REQUIRES: objc_interop
11+
1012
//
1113
// DO NOT add more tests to this file. Add them to test/1_stdlib/Runtime.swift.
1214
//
1315

14-
// XFAIL: linux
1516

1617
import Swift
1718
import Foundation

test/stdlib/timeout.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/uar/bin/env python
2+
3+
import subprocess
4+
import sys
5+
import threading
6+
7+
8+
def watchdog(command, timeout=None):
9+
process = subprocess.Popen(command)
10+
timer = threading.Timer(timeout, process.kill)
11+
try:
12+
timer.start()
13+
process.communicate()
14+
finally:
15+
timer.cancel()
16+
17+
18+
if __name__ == '__main__':
19+
watchdog(sys.argv[2:], timeout=sys.argv[1])

test/stdlib/timeout.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)