OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 | |
3 # Copyright (c) 2012 Google Inc. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 """ | |
8 Make sure paths are normalized properly on Windows. | |
9 """ | |
10 | |
11 import TestGyp | |
12 | |
13 import sys | |
14 | |
15 if sys.platform == 'win32': | |
16 # This is ninja-specific because ninja is more fussy about paths matching in | |
17 # case. Because the file system is case-preserving, but insensitive, we have | |
Nico
2012/04/25 23:18:23
This is true on Mac too. Why is this a problem on
scottmg
2012/04/26 03:06:46
Good question. I guess tools are generally more se
| |
18 # to make sure that case matches. We also confirm the paths are fully | |
19 # relativized (not having redundant xyz/../ for example) which is necessary | |
20 # for efficient stating on Windows. | |
Nico
2012/04/25 23:18:23
Does windows have directory symlinks?
scottmg
2012/04/26 03:06:46
Yes.
| |
21 test = TestGyp.TestGyp(formats=['ninja']) | |
22 | |
23 test.run_gyp('normalize-paths.gyp') | |
24 | |
25 # We can't use existence tests because any case will pass, so we check the | |
26 # contents of ninja files directly since that's what we're most concerned | |
27 # with anyway. | |
28 rootninja = open(test.built_file_path('build.ninja')).read() | |
29 if 'microsoft visual studio' not in rootninja: | |
30 test.fail_test() | |
31 if 'some_target.ninja' not in rootninja or 'Some_Target.ninja' in rootninja: | |
32 test.fail_test() | |
33 if 'Some_Target' in rootninja or 'AnotherName' in rootninja: | |
34 test.fail_test() | |
35 | |
36 subninja = open(test.built_file_path('obj/some_target.ninja')).read() | |
37 if 'AnotherName' in subninja or 'anothername' not in subninja: | |
38 test.fail_test() | |
39 if ('Some_Target.exe' in subninja or 'Some_Target.pdb' in subninja or | |
40 'some_target.pdb' not in subninja): | |
41 test.fail_test() | |
42 if 'HeLLo' in subninja or 'hello' not in subninja: | |
43 test.fail_test() | |
44 if 'blOrP' in subninja or 'blorp' not in subninja: | |
45 test.fail_test() | |
46 if '$!product_dir' in subninja: | |
47 test.fail_test() | |
48 | |
49 second = open(test.built_file_path('obj/second.ninja')).read() | |
50 if 'AnotherName' in second or 'anothername' not in second: | |
51 test.fail_test() | |
52 if 'HeLLo' in second or 'hello' not in second: | |
53 test.fail_test() | |
54 | |
55 action = open(test.built_file_path('obj/action.ninja')).read() | |
56 if 'TempFile' in action or 'tempfile' not in action: | |
57 test.fail_test() | |
58 if 'TempFILE' in action: | |
59 test.fail_test() | |
60 if 'ReSuLt' in action or 'result' not in action: | |
61 test.fail_test() | |
62 if 'SomeInput' in action or 'someinput' not in action: | |
63 test.fail_test() | |
64 | |
65 test.pass_test() | |
OLD | NEW |