[test] Add %target-run-simple-swiftgyb

* Utilize %target-run-simple-swiftgyb where possible
This commit is contained in:
rintaro ishizaki
2016-06-14 13:26:01 +09:00
parent 6e4792cb5b
commit 4b51d85abb
26 changed files with 57 additions and 119 deletions

View File

@@ -15,9 +15,7 @@
// distinguish these cases efficiently.
//
//===----------------------------------------------------------------------===//
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/out.swift
// RUN: %line-directive %t/out.swift -- %target-build-swift -parse-stdlib %t/out.swift -o %t/a.out
// RUN: %line-directive %t/out.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
// REQUIRES: objc_interop

View File

@@ -1,8 +1,5 @@
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/CastTraps.swift
// RUN: %line-directive %t/CastTraps.swift -- %target-build-swift %t/CastTraps.swift -o %t/a.out
// RUN: %line-directive %t/CastTraps.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
// FIXME: Casting.cpp has dozens of places to fail a cast. This test does not
@@ -20,17 +17,17 @@ import Foundation
% objectTypes = []
% protocolTypes = []
% types.append(['a.Class1', 'a.Class2'])
% objectTypes.append(['a.Class1', 'a.Class2'])
% types.append(['main.Class1', 'main.Class2'])
% objectTypes.append(['main.Class1', 'main.Class2'])
class Class1 { }
class Class2 { }
% types.append(['a.Struct1', 'a.Struct2'])
% types.append(['main.Struct1', 'main.Struct2'])
struct Struct1 { }
struct Struct2 { }
% types.append(['a.ObjCClass1', 'a.ObjCClass2'])
% objectTypes.append(['a.ObjCClass1', 'a.ObjCClass2'])
% types.append(['main.ObjCClass1', 'main.ObjCClass2'])
% objectTypes.append(['main.ObjCClass1', 'main.ObjCClass2'])
class ObjCClass1 : NSObject { }
class ObjCClass2 : NSObject { }
@@ -38,8 +35,8 @@ class ObjCClass2 : NSObject { }
% objectTypes.append(['DateFormatter', 'NumberFormatter'])
// non-Swift Objective-C class
% protocolTypes.append('a.Proto1')
% protocolTypes.append('a.Proto2')
% protocolTypes.append('main.Proto1')
% protocolTypes.append('main.Proto2')
protocol Proto1 { }
protocol Proto2 { }
% protocolTypes.append('URLSessionDelegate')

View File

@@ -10,10 +10,7 @@
//
//===----------------------------------------------------------------------===//
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/InputStream.swift
// RUN: %line-directive %t/InputStream.swift -- %target-build-swift %t/InputStream.swift -o %t/a.out
// RUN: %line-directive %t/InputStream.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
// FIXME: The Android test runner is incapable of running this test, which

View File

@@ -1,8 +1,3 @@
%import inspect
%import os.path
%import sys
%sys.path = [os.path.split(inspect.getframeinfo(inspect.currentframe()).filename)[0] or '.'] + sys.path
% for Kind in Kinds:
%Minimal = 'Minimal' + Kind

View File

@@ -1,8 +1,4 @@
// RUN: rm -f %t.swift %t.out
// RUN: %gyb %s -o %t.swift
// RUN: %line-directive %t.swift -- %target-build-swift %t.swift -o %t.out
// RUN: %line-directive %t.swift -- %target-run %t.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,6 +1,4 @@
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/UnsafePointer.swift
// RUN: %line-directive %t/UnsafePointer.swift -- %target-build-swift %t/UnsafePointer.swift -o %t/a.out
// RUN: %line-directive %t/UnsafePointer.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,8 +1,4 @@
// RUN: rm -f %t.swift %t.out
// RUN: %gyb %s -o %t.swift
// RUN: %line-directive %t.swift -- %target-build-swift %t.swift -o %t.out
// RUN: %line-directive %t.swift -- %target-run %t.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
// FIXME: No simd module on linux rdar://problem/20795411

View File

@@ -641,6 +641,11 @@ if run_vendor == 'apple':
"%s %%s" % (target_run_base))
config.target_run_stdlib_swift = (
"%s -Xfrontend -disable-access-control %%s" % (target_run_base))
config.target_run_simple_swiftgyb = (
'rm -rf %%t && mkdir -p %%t && '
'%%gyb %%s -o %%t/main.swift && '
'%%line-directive %%t/main.swift -- %s %%t/main.swift'
% (target_run_base))
config.available_features.add('interpret')
config.environment['SWIFT_INTERPRETER'] = config.swift
@@ -721,6 +726,11 @@ elif run_os == 'linux-gnu' or run_os == 'linux-gnueabihf' or run_os == 'freebsd'
'%s %%s' % (target_run_base))
config.target_run_stdlib_swift = (
'%s -Xfrontend -disable-access-control %%s' % (target_run_base))
config.target_run_simple_swiftgyb = (
'rm -rf %%t && mkdir -p %%t && '
'%%gyb %%s -o %%t/main.swift && '
'%%line-directive %%t/main.swift -- %s %%t/main.swift'
% (target_run_base))
config.available_features.add('interpret')
config.environment['SWIFT_INTERPRETER'] = config.swift
config.target_sil_opt = (
@@ -860,6 +870,14 @@ if not getattr(config, 'target_run_simple_swift', None):
'-Xfrontend -disable-access-control && '
'%s %%t/a.out'
% (config.target_build_swift, mcp_opt, config.target_run))
config.target_run_simple_swiftgyb = (
'rm -rf %%t && mkdir -p %%t && '
'%%gyb %%s -o %%t/main.swift && '
'%%line-directive %%t/main.swift -- '
'%s %s %%t/main.swift -o %%t/a.out -module-name main && '
'%%line-directive %%t/main.swift -- '
'%s %%t/a.out'
% (config.target_build_swift, mcp_opt, config.target_run))
subst_target_jit_run = ""
if 'swift_interpreter' in config.available_features:
@@ -906,6 +924,7 @@ config.substitutions.append(
config.substitutions.append(('%target-swift-frontend', config.target_swift_frontend))
config.substitutions.append(('%target-run-simple-swiftgyb', config.target_run_simple_swiftgyb))
config.substitutions.append(('%target-run-simple-swift', config.target_run_simple_swift))
config.substitutions.append(('%target-run-stdlib-swift', config.target_run_stdlib_swift))
config.substitutions.append(('%target-repl-run-simple-swift', subst_target_repl_run_simple_swift))

View File

@@ -1,9 +1,4 @@
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %gyb %s -o %t/Assertions.swift
// RUN: %line-directive %t/Assertions.swift -- %target-build-swift %t/Assertions.swift -o %t/a.out
//
// RUN: %line-directive %t/Assertions.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,8 +1,5 @@
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/StdlibUnittestSequencesCollections.swift
// RUN: %line-directive %t/StdlibUnittestSequencesCollections.swift -- %target-build-swift %t/StdlibUnittestSequencesCollections.swift -o %t/a.out
// RUN: %line-directive %t/StdlibUnittestSequencesCollections.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
%{

View File

@@ -1,9 +1,4 @@
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %gyb %s -o %t/ArrayTraps.swift
// RUN: %line-directive %t/ArrayTraps.swift -- %target-build-swift %t/ArrayTraps.swift -o %t/a.out
//
// RUN: %line-directive %t/ArrayTraps.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,10 +1,5 @@
// -*- swift -*-
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %gyb %s -o %t/main.swift
// RUN: %line-directive %t/main.swift -- %target-build-swift %t/main.swift -o %t/LazyFilterCollection.swift.a.out
// RUN: %line-directive %t/main.swift -- %target-run %t/LazyFilterCollection.swift.a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import SwiftPrivate

View File

@@ -1,10 +1,5 @@
// -*- swift -*-
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %gyb %s -o %t/main.swift
// RUN: %line-directive %t/main.swift -- %target-build-swift %t/main.swift -o %t/LazyMapCollection.swift.a.out
// RUN: %line-directive %t/main.swift -- %target-run %t/LazyMapCollection.swift.a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,17 +1,13 @@
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/Collection.swift -D test_path="%S"
// RUN: %line-directive %t/Collection.swift -- %target-build-swift %t/Collection.swift -o %t/a.out
// RUN: %line-directive %t/Collection.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
// <rdar://problem/24357067> The compiler never finishes compiling validation-test/stdlib/CollectionType.swift.gyb in -O
// REQUIRES: swift_test_mode_optimize_none
%{
import gyb
from gyb_stdlib_support import TRAVERSALS, collectionForTraversal
}%
% import os.path
% import gyb
% from gyb_stdlib_support import TRAVERSALS, collectionForTraversal
import StdlibUnittest
import StdlibCollectionUnittest
@@ -342,7 +338,7 @@ CollectionTypeTests.test(
// flatMap()
//===----------------------------------------------------------------------===//
% TLazyFlatMapTest = gyb.parse_template("{}/Inputs/flatMap.gyb".format(test_path))
% TLazyFlatMapTest = gyb.parse_template(os.path.join(os.path.dirname(__file__), "Inputs/flatMap.gyb"))
% LazyFlatMapTest = gyb.execute_template(TLazyFlatMapTest, Test='CollectionTypeTests', Kinds=['Collection', 'BidirectionalCollection'])
${LazyFlatMapTest}

View File

@@ -9,9 +9,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/ExistentialCollection.swift
// RUN: %line-directive %t/ExistentialCollection.swift -- %target-build-swift %t/ExistentialCollection.swift -o %t/a.out
// RUN: %line-directive %t/ExistentialCollection.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
%{

View File

@@ -1,6 +1,4 @@
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/FixedPoint.swift
// RUN: %line-directive %t/FixedPoint.swift -- %target-build-swift %t/FixedPoint.swift -o %t/a.out
// RUN: %line-directive %t/FixedPoint.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest
@@ -433,4 +431,4 @@ BoolTestSuite.test("||") {
expectFalse(getBool(false) || getBool(false))
}
runAllTests()
runAllTests()

View File

@@ -11,10 +11,7 @@
//
//===----------------------------------------------------------------------===//
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/Index.swift
// RUN: %line-directive %t/Index.swift -- %target-build-swift %t/Index.swift -o %t/a.out
// RUN: %line-directive %t/Index.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -10,9 +10,7 @@
//
//===----------------------------------------------------------------------===//
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/Join.swift
// RUN: %line-directive %t/Join.swift -- %target-build-swift %t/Join.swift -o %t/a.out
// RUN: %line-directive %t/Join.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -9,11 +9,7 @@
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %gyb %s -o %t/Lazy.swift
// RUN: %line-directive %t/Lazy.swift -- %target-build-swift %t/Lazy.swift -o %t/a.out
// RUN: %line-directive %t/Lazy.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,6 +1,4 @@
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/out.swift
// RUN: %line-directive %t/out.swift -- %target-build-swift %t/out.swift -o %t/a.out
// RUN: %line-directive %t/out.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,8 +1,5 @@
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/RangeReplaceable.swift
// RUN: %line-directive %t/RangeReplaceable.swift -- %target-build-swift %t/RangeReplaceable.swift -o %t/a.out
// RUN: %line-directive %t/RangeReplaceable.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,10 +1,8 @@
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/Sequence.swift -D test_path="%S"
// RUN: %line-directive %t/Sequence.swift -- %target-build-swift %t/Sequence.swift -o %t/a.out
// RUN: %line-directive %t/Sequence.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
% import os.path
% import gyb
import StdlibUnittest
@@ -896,7 +894,7 @@ SequenceTypeTests.test("flatMap/Sequence") {
}
}
% TLazyFlatMapTest = gyb.parse_template("{}/Inputs/flatMap.gyb".format(test_path))
% TLazyFlatMapTest = gyb.parse_template(os.path.join(os.path.dirname(__file__), "Inputs/flatMap.gyb"))
% LazyFlatMapTest = gyb.execute_template(TLazyFlatMapTest, Test='SequenceTypeTests', Kinds=['Sequence'])
${LazyFlatMapTest}

View File

@@ -1,8 +1,5 @@
// -*- swift -*-
// RUN: rm -rf %t ; mkdir -p %t
// RUN: %gyb %s -o %t/Slice.swift
// RUN: %line-directive %t/Slice.swift -- %target-build-swift %t/Slice.swift -o %t/a.out
// RUN: %line-directive %t/Slice.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
%{

View File

@@ -1,8 +1,4 @@
// RUN: rm -f %t.swift %t.out
// RUN: %gyb %s -o %t.swift
// RUN: %line-directive %t.swift -- %target-build-swift %t.swift -o %t.out
// RUN: %line-directive %t.swift -- %target-run %t.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest

View File

@@ -1,6 +1,4 @@
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/Unicode.swift
// RUN: %line-directive %t/Unicode.swift -- %target-build-swift %t/Unicode.swift -o %t/a.out -Xfrontend -disable-objc-attr-requires-foundation-module
// RUN: %line-directive %t/Unicode.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import SwiftPrivate

View File

@@ -1,6 +1,4 @@
// RUN: rm -rf %t && mkdir -p %t && %gyb %s -o %t/UnsafeBufferPointer.swift
// RUN: %line-directive %t/UnsafeBufferPointer.swift -- %target-build-swift %t/UnsafeBufferPointer.swift -o %t/a.out
// RUN: %line-directive %t/UnsafeBufferPointer.swift -- %target-run %t/a.out
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test
import StdlibUnittest