Skip to content

Commit ec898a8

Browse files
committed
[Test] Upgrade the all backtrace tests to use not.py and %target-run.
rdar://problem/50863395
1 parent 99728a9 commit ec898a8

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed

test/Inputs/not.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import shlex
2+
import subprocess
3+
import sys
4+
5+
if len(sys.argv) < 2:
6+
print("Too few args to " + sys.argv[0])
7+
sys.exit(0)
8+
9+
try:
10+
isPosix = (sys.platform != "win32")
11+
subprocess.check_call(shlex.split(sys.argv[1], posix=isPosix))
12+
sys.exit(1)
13+
except subprocess.CalledProcessError as e:
14+
sys.exit(0)

test/Runtime/backtrace.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift %s -o %t/a.out
3-
// RUN: not --crash %target-run %t/a.out 2>&1 | %{python} %utils/backtrace-check
3+
// RUN: %{python} %S/../Inputs/not.py "%target-run %t/a.out" 2>&1 | %{python} %utils/backtrace-check
4+
5+
// NOTE: not.py is used above instead of "not --crash" because %target-run
6+
// doesn't pass through the crash, and `not` may not be available when running
7+
// on a remote host.
48

59
// This is not supported on watchos, ios, or tvos
610
// UNSUPPORTED: OS=watchos

test/Runtime/crash_without_backtrace.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift %s -o %t/out
3-
// RUN: not --crash %t/out 2>&1 | %FileCheck %s
3+
// RUN: %{python} %S/../Inputs/not.py "%target-run %t/out" 2>&1 | %FileCheck %s
4+
5+
// NOTE: not.py is used above instead of "not --crash" because %target-run
6+
// doesn't pass through the crash, and `not` may not be available when running
7+
// on a remote host.
48

59
// UNSUPPORTED: OS=watchos
610
// UNSUPPORTED: OS=ios

test/Runtime/crash_without_backtrace_optimized.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -O %s -o %t/out
3-
// RUN: not --crash %t/out 2>&1 | %FileCheck %s
3+
// RUN: %{python} %S/../Inputs/not.py "%target-run %t/out" 2>&1 | %FileCheck %s
4+
5+
// NOTE: not.py is used above instead of "not --crash" because %target-run
6+
// doesn't pass through the crash, and `not` may not be available when running
7+
// on a remote host.
48

59
// UNSUPPORTED: OS=watchos
610
// UNSUPPORTED: OS=ios

test/Runtime/linux-fatal-backtrace.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift %s -o %t/a.out
3-
// RUN: not --crash %t/a.out 2>&1 | PYTHONPATH=%lldb-python-path %{python} %utils/symbolicate-linux-fatal %t/a.out - | %{python} %utils/backtrace-check -u
3+
// RUN: %{python} %S/../Inputs/not.py "%target-run %t/a.out" 2>&1 | PYTHONPATH=%lldb-python-path %{python} %utils/symbolicate-linux-fatal %t/a.out - | %{python} %utils/backtrace-check -u
44
// REQUIRES: executable_test
55
// REQUIRES: OS=linux-gnu
66
// REQUIRES: lldb
77

8+
// NOTE: not.py is used above instead of "not --crash" because %target-run
9+
// doesn't pass through the crash, and `not` may not be available when running
10+
// on a remote host.
11+
812
// Backtraces are not emitted when optimizations are enabled. This test can not
913
// run when optimizations are enabled.
1014
// REQUIRES: swift_test_mode_optimize_none

0 commit comments

Comments
 (0)