4
4
# can run it "fast": spawning zillions of windows processes is our major build
5
5
# bottleneck (and it doesn't hurt to run faster on other platforms as well).
6
6
7
- import sys , os , re
7
+ import sys , os , re , codecs
8
8
9
9
def scrub (b ):
10
10
if sys .version_info >= (3 ,) and type (b ) == bytes :
@@ -23,7 +23,7 @@ def scrub(b):
23
23
24
24
for t in os .listdir (run_pass ):
25
25
if t .endswith (".rs" ):
26
- f = open (os .path .join (run_pass , t ))
26
+ f = codecs . open (os .path .join (run_pass , t ), "r" , "utf8" )
27
27
s = f .read ()
28
28
if not ("xfail-stage2" in s ):
29
29
stage2_tests .append (t )
@@ -38,8 +38,9 @@ def scrub(b):
38
38
c .write ("// AUTO-GENERATED FILE: DO NOT EDIT\n " )
39
39
c .write ("#[link(name=\" run_pass_stage2\" , vers=\" 0.1\" )];\n " )
40
40
for t in stage2_tests :
41
- c .write ("mod t_%d = \" %s\" ;\n "
42
- % (i , os .path .join (run_pass , t )))
41
+ p = os .path .join (run_pass , t )
42
+ p = p .replace ("\\ " , "\\ \\ " )
43
+ c .write ("mod t_%d = \" %s\" ;\n " % (i , p ))
43
44
i += 1
44
45
c .close ()
45
46
@@ -53,8 +54,9 @@ def scrub(b):
53
54
d .write (" auto out = std::io::stdout();\n " );
54
55
i = 0
55
56
for t in stage2_tests :
56
- d .write (" out.write_str(\" run-pass [stage2]: %s\\ n\" );\n "
57
- % os .path .join ("test" , "run-pass" , t ))
57
+ p = os .path .join ("test" , "run-pass" , t )
58
+ p = p .replace ("\\ " , "\\ \\ " )
59
+ d .write (" out.write_str(\" run-pass [stage2]: %s\\ n\" );\n " % p )
58
60
if t in take_args :
59
61
d .write (" t_%d::main([\" arg0\" ]);\n " % i )
60
62
else :
0 commit comments