1 # Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
15 # msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
16 # `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
17 # the value is list of paths.
18 # (if there is only one path, it becomes `c:/real/abs/path`.)
19 # this causes great confusion and error: shell and Makefile doesn't like
20 # windows paths so it is really error-prone. revert it for peace.
21 def normalize_path(v):
22 v = v.replace('\\', '/')
25 v = '/' + v.replace(':/', '/')
29 def putenv(name, value):
31 value = normalize_path(value)
32 os.putenv(name, value)
34 def convert_path_spec(name, value):
35 if os.name == 'nt' and name != 'PATH':
36 value = ":".join(normalize_path(v) for v in value.split(";"))
40 putenv('RUSTC', os.path.abspath(sys.argv[3]))
41 putenv('TMPDIR', os.path.abspath(sys.argv[4]))
42 putenv('CC', sys.argv[5])
43 putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
45 putenv('LD_LIB_PATH_ENVVAR', sys.argv[8]);
46 putenv('HOST_RPATH_DIR', os.path.abspath(sys.argv[9]));
47 putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[10]));
48 putenv('RUST_BUILD_STAGE', sys.argv[11])
49 putenv('S', os.path.abspath(sys.argv[12]))
50 putenv('PYTHON', sys.executable)
52 if not filt in sys.argv[1]:
54 print('maketest: ' + os.path.basename(os.path.dirname(sys.argv[1])))
58 # msys1 has a bug that `make` fails to include `../tools.mk` (parent dir)
59 # if `-C path` option is given and `path` is absolute directory with
60 # trailing slash (`c:/path/to/test/`).
61 # the easist workaround is to remove the slash (`c:/path/to/test`).
62 # msys2 seems to fix this problem.
65 proc = subprocess.Popen([make, '-C', path],
66 stdout = subprocess.PIPE,
67 stderr = subprocess.PIPE)
68 out, err = proc.communicate()
73 print '----- ' + sys.argv[1] + """ --------------------
74 ------ stdout ---------------------------------------------
76 ------ stderr ---------------------------------------------
78 ------ ---------------------------------------------