Skip to content

Commit 4b51d85

Browse files
committed
[test] Add %target-run-simple-swiftgyb
* Utilize %target-run-simple-swiftgyb where possible
1 parent 6e4792c commit 4b51d85

26 files changed

+57
-119
lines changed

test/1_stdlib/BridgeStorage.swift.gyb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
// distinguish these cases efficiently.
1616
//
1717
//===----------------------------------------------------------------------===//
18-
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/out.swift
19-
// RUN: %line-directive %t/out.swift -- %target-build-swift -parse-stdlib %t/out.swift -o %t/a.out
20-
// RUN: %line-directive %t/out.swift -- %target-run %t/a.out
18+
// RUN: %target-run-simple-swiftgyb
2119
// REQUIRES: executable_test
2220

2321
// REQUIRES: objc_interop

test/1_stdlib/CastTraps.swift.gyb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// -*- swift -*-
2-
// RUN: rm -rf %t ; mkdir -p %t
3-
// RUN: %gyb %s -o %t/CastTraps.swift
4-
// RUN: %line-directive %t/CastTraps.swift -- %target-build-swift %t/CastTraps.swift -o %t/a.out
5-
// RUN: %line-directive %t/CastTraps.swift -- %target-run %t/a.out
2+
// RUN: %target-run-simple-swiftgyb
63
// REQUIRES: executable_test
74

85
// FIXME: Casting.cpp has dozens of places to fail a cast. This test does not
@@ -20,26 +17,26 @@ import Foundation
2017
% objectTypes = []
2118
% protocolTypes = []
2219

23-
% types.append(['a.Class1', 'a.Class2'])
24-
% objectTypes.append(['a.Class1', 'a.Class2'])
20+
% types.append(['main.Class1', 'main.Class2'])
21+
% objectTypes.append(['main.Class1', 'main.Class2'])
2522
class Class1 { }
2623
class Class2 { }
2724

28-
% types.append(['a.Struct1', 'a.Struct2'])
25+
% types.append(['main.Struct1', 'main.Struct2'])
2926
struct Struct1 { }
3027
struct Struct2 { }
3128

32-
% types.append(['a.ObjCClass1', 'a.ObjCClass2'])
33-
% objectTypes.append(['a.ObjCClass1', 'a.ObjCClass2'])
29+
% types.append(['main.ObjCClass1', 'main.ObjCClass2'])
30+
% objectTypes.append(['main.ObjCClass1', 'main.ObjCClass2'])
3431
class ObjCClass1 : NSObject { }
3532
class ObjCClass2 : NSObject { }
3633

3734
% types.append(['DateFormatter', 'NumberFormatter'])
3835
% objectTypes.append(['DateFormatter', 'NumberFormatter'])
3936
// non-Swift Objective-C class
4037

41-
% protocolTypes.append('a.Proto1')
42-
% protocolTypes.append('a.Proto2')
38+
% protocolTypes.append('main.Proto1')
39+
% protocolTypes.append('main.Proto2')
4340
protocol Proto1 { }
4441
protocol Proto2 { }
4542
% protocolTypes.append('URLSessionDelegate')

test/1_stdlib/InputStream.swift.gyb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
// -*- swift -*-
13-
// RUN: rm -rf %t ; mkdir -p %t
14-
// RUN: %gyb %s -o %t/InputStream.swift
15-
// RUN: %line-directive %t/InputStream.swift -- %target-build-swift %t/InputStream.swift -o %t/a.out
16-
// RUN: %line-directive %t/InputStream.swift -- %target-run %t/a.out
13+
// RUN: %target-run-simple-swiftgyb
1714
// REQUIRES: executable_test
1815

1916
// FIXME: The Android test runner is incapable of running this test, which

test/1_stdlib/Inputs/flatMap.gyb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
%import inspect
2-
%import os.path
3-
%import sys
4-
%sys.path = [os.path.split(inspect.getframeinfo(inspect.currentframe()).filename)[0] or '.'] + sys.path
5-
61
% for Kind in Kinds:
72
%Minimal = 'Minimal' + Kind
83

test/1_stdlib/Tuple.swift.gyb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// RUN: rm -f %t.swift %t.out
2-
3-
// RUN: %gyb %s -o %t.swift
4-
// RUN: %line-directive %t.swift -- %target-build-swift %t.swift -o %t.out
5-
// RUN: %line-directive %t.swift -- %target-run %t.out
1+
// RUN: %target-run-simple-swiftgyb
62
// REQUIRES: executable_test
73

84
import StdlibUnittest

test/1_stdlib/UnsafePointer.swift.gyb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/UnsafePointer.swift
2-
// RUN: %line-directive %t/UnsafePointer.swift -- %target-build-swift %t/UnsafePointer.swift -o %t/a.out
3-
// RUN: %line-directive %t/UnsafePointer.swift -- %target-run %t/a.out
1+
// RUN: %target-run-simple-swiftgyb
42
// REQUIRES: executable_test
53

64
import StdlibUnittest

test/1_stdlib/simd.swift.gyb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// RUN: rm -f %t.swift %t.out
2-
3-
// RUN: %gyb %s -o %t.swift
4-
// RUN: %line-directive %t.swift -- %target-build-swift %t.swift -o %t.out
5-
// RUN: %line-directive %t.swift -- %target-run %t.out
1+
// RUN: %target-run-simple-swiftgyb
62
// REQUIRES: executable_test
73

84
// FIXME: No simd module on linux rdar://problem/20795411

test/lit.cfg

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,11 @@ if run_vendor == 'apple':
641641
"%s %%s" % (target_run_base))
642642
config.target_run_stdlib_swift = (
643643
"%s -Xfrontend -disable-access-control %%s" % (target_run_base))
644+
config.target_run_simple_swiftgyb = (
645+
'rm -rf %%t && mkdir -p %%t && '
646+
'%%gyb %%s -o %%t/main.swift && '
647+
'%%line-directive %%t/main.swift -- %s %%t/main.swift'
648+
% (target_run_base))
644649
config.available_features.add('interpret')
645650
config.environment['SWIFT_INTERPRETER'] = config.swift
646651

@@ -721,6 +726,11 @@ elif run_os == 'linux-gnu' or run_os == 'linux-gnueabihf' or run_os == 'freebsd'
721726
'%s %%s' % (target_run_base))
722727
config.target_run_stdlib_swift = (
723728
'%s -Xfrontend -disable-access-control %%s' % (target_run_base))
729+
config.target_run_simple_swiftgyb = (
730+
'rm -rf %%t && mkdir -p %%t && '
731+
'%%gyb %%s -o %%t/main.swift && '
732+
'%%line-directive %%t/main.swift -- %s %%t/main.swift'
733+
% (target_run_base))
724734
config.available_features.add('interpret')
725735
config.environment['SWIFT_INTERPRETER'] = config.swift
726736
config.target_sil_opt = (
@@ -860,6 +870,14 @@ if not getattr(config, 'target_run_simple_swift', None):
860870
'-Xfrontend -disable-access-control && '
861871
'%s %%t/a.out'
862872
% (config.target_build_swift, mcp_opt, config.target_run))
873+
config.target_run_simple_swiftgyb = (
874+
'rm -rf %%t && mkdir -p %%t && '
875+
'%%gyb %%s -o %%t/main.swift && '
876+
'%%line-directive %%t/main.swift -- '
877+
'%s %s %%t/main.swift -o %%t/a.out -module-name main && '
878+
'%%line-directive %%t/main.swift -- '
879+
'%s %%t/a.out'
880+
% (config.target_build_swift, mcp_opt, config.target_run))
863881

864882
subst_target_jit_run = ""
865883
if 'swift_interpreter' in config.available_features:
@@ -906,6 +924,7 @@ config.substitutions.append(
906924
config.substitutions.append(('%target-swift-frontend', config.target_swift_frontend))
907925

908926

927+
config.substitutions.append(('%target-run-simple-swiftgyb', config.target_run_simple_swiftgyb))
909928
config.substitutions.append(('%target-run-simple-swift', config.target_run_simple_swift))
910929
config.substitutions.append(('%target-run-stdlib-swift', config.target_run_stdlib_swift))
911930
config.substitutions.append(('%target-repl-run-simple-swift', subst_target_repl_run_simple_swift))

validation-test/StdlibUnittest/Assertions.swift.gyb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// RUN: rm -rf %t
2-
// RUN: mkdir -p %t
3-
// RUN: %gyb %s -o %t/Assertions.swift
4-
// RUN: %line-directive %t/Assertions.swift -- %target-build-swift %t/Assertions.swift -o %t/a.out
5-
//
6-
// RUN: %line-directive %t/Assertions.swift -- %target-run %t/a.out
1+
// RUN: %target-run-simple-swiftgyb
72
// REQUIRES: executable_test
83

94
import StdlibUnittest

validation-test/StdlibUnittest/SequencesCollections.swift.gyb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// -*- swift -*-
2-
// RUN: rm -rf %t ; mkdir -p %t
3-
// RUN: %gyb %s -o %t/StdlibUnittestSequencesCollections.swift
4-
// RUN: %line-directive %t/StdlibUnittestSequencesCollections.swift -- %target-build-swift %t/StdlibUnittestSequencesCollections.swift -o %t/a.out
5-
// RUN: %line-directive %t/StdlibUnittestSequencesCollections.swift -- %target-run %t/a.out
2+
// RUN: %target-run-simple-swiftgyb
63
// REQUIRES: executable_test
74

85
%{

0 commit comments

Comments
 (0)