StdlibUnittest: run tests out of process

The test harness now can recover after test crashes, allowing:

- check for crashes themselves (without reporting them to the Python lit driver,
  which is about 10x slower -- even if CrashTracer is disabled);

- recover from unexpected test crashes and run the rest of the tests;

- this lays the groundwork for assertions that end the test execution, but
  allow the rest of the tests to run (rdar://17906801).

Note that we don't spawn a fresh process for every test.  We create a child
process and reuse it until it crashes.


Swift SVN r21090
This commit is contained in:
Dmitri Hrybenko
2014-08-07 15:14:57 +00:00
parent 44444107c9
commit f2436065db
32 changed files with 1850 additions and 1682 deletions

View File

@@ -1,7 +1,7 @@
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: %target-build-swift -module-cache-path %t/clang-module-cache %s -o %t/a.out
// RUN: %target-run %t/a.out %S/Inputs/NSStringAPI_test.txt | FileCheck %s
// RUN: %target-run %t/a.out
//
// Tests for the NSString APIs as exposed by String
@@ -72,7 +72,8 @@ NSStringAPIs.test("pathWithComponents(_:)") {
String.pathWithComponents(["flugelhorn", "baritone", "bass"]))
}
var existingPath = Process.arguments[1]
// FIXME: creating a temporary file would be better.
var existingPath = (String(__FILE__) + "/../Inputs/NSStringAPI_test.txt").stringByStandardizingPath
var nonExistentPath = existingPath + "-NoNeXiStEnT"
NSStringAPIs.test("stringWithContentsOfFile(_:encoding:error:)") {
@@ -1594,9 +1595,6 @@ NSStringAPIs.test("uppercaseString") {
expectEqual("\u{0046}\u{0049}", "\u{fb01}".uppercaseString)
}
NSStringAPIs.run()
// CHECK: NSStringAPIs: All tests passed
var CStringTests = TestCase("CStringTests")
func getNullCString() -> UnsafeMutablePointer<CChar> {
@@ -1699,5 +1697,5 @@ CStringTests.test("String.fromCStringRepairingIllFormedUTF8") {
}
}
CStringTests.run()
// CHECK: {{^}}CStringTests: All tests passed
runAllTests()