From f72d7b5a79a815a1b383d62547f9ed6c655971f7 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 3 Dec 2015 03:07:43 +0100 Subject: Supporting Msys2's python. --- tools/run_tests/jobset.py | 18 +++++++++++++++--- tools/run_tests/run_tests.py | 13 +++---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py index 88d95027e2..5a26bff709 100755 --- a/tools/run_tests/jobset.py +++ b/tools/run_tests/jobset.py @@ -43,11 +43,23 @@ import time _DEFAULT_MAX_JOBS = 16 * multiprocessing.cpu_count() _MAX_RESULT_SIZE = 8192 +def platform_string(): + if platform.system() == 'Windows': + return 'windows' + elif platform.system()[:7] == 'MSYS_NT': + return 'windows' + elif platform.system() == 'Darwin': + return 'mac' + elif platform.system() == 'Linux': + return 'linux' + else: + return 'posix' + # setup a signal handler so that signal.pause registers 'something' # when a child finishes # not using futures and threading to avoid a dependency on subprocess32 -if platform.system() == 'Windows': +if platform_string() == 'windows': pass else: have_alarm = False @@ -99,7 +111,7 @@ def message(tag, msg, explanatory_text=None, do_newline=False): message.old_tag = tag message.old_msg = msg try: - if platform.system() == 'Windows' or not sys.stdout.isatty(): + if platform_string() == 'windows' or not sys.stdout.isatty(): if explanatory_text: print explanatory_text print '%s: %s' % (tag, msg) @@ -359,7 +371,7 @@ class Jobset(object): if (not self._travis): message('WAITING', '%d jobs running, %d complete, %d failed' % ( len(self._running), self._completed, self._failures)) - if platform.system() == 'Windows': + if platform_string() == 'windows': time.sleep(0.1) else: global have_alarm diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index f1595ac98f..4c85f202f4 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -60,14 +60,7 @@ _FORCE_ENVIRON_FOR_WRAPPERS = {} def platform_string(): - if platform.system() == 'Windows': - return 'windows' - elif platform.system() == 'Darwin': - return 'mac' - elif platform.system() == 'Linux': - return 'linux' - else: - return 'posix' + return jobset.platform_string() # SimpleConfig: just compile with CONFIG=config, and run the binary to test @@ -640,7 +633,7 @@ if len(build_configs) > 1: print language, 'does not support multiple build configurations' sys.exit(1) -if platform.system() == 'Windows': +if platform_string() == 'windows': def make_jobspec(cfg, targets, makefile='Makefile'): extra_args = [] # better do parallel compilation @@ -770,7 +763,7 @@ def _start_port_server(port_server_port): '-p', '%d' % port_server_port, '-l', logfile] env = dict(os.environ) env['BUILD_ID'] = 'pleaseDontKillMeJenkins' - if platform.system() == 'Windows': + if platform_string() == 'windows': # Working directory of port server needs to be outside of Jenkins # workspace to prevent file lock issues. tempdir = tempfile.mkdtemp() -- cgit v1.2.3