Skip to content

Commit 6351b6c

Browse files
committed
[build_script.py] Provide default temp build dir
If a user doesn't care about where the built products are located, they may omit the "--build-dir" flag, and the build script will generate a temporary directory for them. This allows the tests to be run on Linux with a very simple command: ``` $ ./build_script.py --swiftc `which swiftc` --test ```
1 parent f6fe5e3 commit 6351b6c

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ If your install of Swift is located at `/swift` and you wish to install XCTest i
4545
To run the tests on Linux, use the `--test` option:
4646

4747
```sh
48-
./build_script.py \
49-
--swiftc="/swift/usr/bin/swiftc" \
50-
--build-dir="/tmp/XCTest_build" \
51-
--test
48+
./build_script.py --swiftc="/swift/usr/bin/swiftc" --test
5249
```
5350

5451
To run the tests on OS X, build and run the `SwiftXCTestFunctionalTests` target in the Xcode project. You may also run them via the command line:

build_script.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
#
1111

12-
import os, subprocess, argparse
12+
import argparse
13+
import os
14+
import subprocess
15+
import tempfile
1316

1417
SOURCE_DIR = os.path.dirname(os.path.abspath(__file__))
1518

@@ -28,9 +31,10 @@ def main():
2831
metavar="PATH",
2932
required=True)
3033
parser.add_argument("--build-dir",
31-
help="path to the output build directory",
34+
help="path to the output build directory. If not "
35+
"specified, a temporary directory is used",
3236
metavar="PATH",
33-
required=True)
37+
default=tempfile.mkdtemp())
3438
parser.add_argument("--swift-build-dir", help="deprecated, do not use")
3539
parser.add_argument("--arch", help="deprecated, do not use")
3640
parser.add_argument("--module-install-path",

0 commit comments

Comments
 (0)