Skip to content

Commit 83bfc69

Browse files
author
Ross Bayer
committed
[Build System: update-checkout] Added a new run_test.py script to utils/update_checkout which is used to run the validation test.
1 parent de1759c commit 83bfc69

File tree

4 files changed

+60
-25
lines changed

4 files changed

+60
-25
lines changed

utils/update_checkout/run_tests.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python
2+
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See https://swift.org/LICENSE.txt for license information
9+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
11+
12+
"""
13+
Small script used to easily run the update_checkout module unit tests.
14+
"""
15+
16+
17+
from __future__ import absolute_import, unicode_literals
18+
19+
import os
20+
import shutil
21+
import sys
22+
import tempfile
23+
import unittest
24+
25+
26+
MODULE_DIR = os.path.abspath(os.path.dirname(__file__))
27+
UTILS_DIR = os.path.abspath(os.path.join(MODULE_DIR, os.pardir))
28+
29+
30+
if __name__ == '__main__':
31+
# Add the swift/utils directory to the Python path.
32+
sys.path.append(UTILS_DIR)
33+
34+
# Create temp directory and export it for the test suite.
35+
temp_dir = tempfile.mkdtemp()
36+
os.environ['UPDATECHECKOUT_TEST_WORKSPACE_DIR'] = temp_dir
37+
38+
# Discover all tests for the module.
39+
module_tests = unittest.defaultTestLoader.discover(MODULE_DIR)
40+
41+
# Create and run test suite.
42+
suite = unittest.TestSuite()
43+
suite.addTests(module_tests)
44+
45+
runner = unittest.TextTestRunner()
46+
try:
47+
result = runner.run(suite)
48+
finally:
49+
# Ensure the temp directory is removed
50+
shutil.rmtree(temp_dir, ignore_errors=True)
51+
52+
sys.exit(not result.wasSuccessful())

utils/update_checkout/test_update_checkout.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Continuous integration for the OS X Platform also runs the tests in the
2+
// iPhone, Apple TV and Apple Watch simulators. We only need to run the
3+
// update_checkout module unit-tests once per OSX Platform test run, rather
4+
// than once for each supported Apple device.
5+
6+
// REQUIRES: OS=macosx
7+
8+
// RUN: %{python} %utils/update_checkout/run_tests.py

validation-test/Python/update_checkout.test-sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)