Chromium Code Reviews| Index: test/ninja/normalize-paths-win/gyptest-normalize-paths.py |
| diff --git a/test/ninja/normalize-paths-win/gyptest-normalize-paths.py b/test/ninja/normalize-paths-win/gyptest-normalize-paths.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e17bb9d1d287964f52f5a46ef8b115656e7d94ae |
| --- /dev/null |
| +++ b/test/ninja/normalize-paths-win/gyptest-normalize-paths.py |
| @@ -0,0 +1,65 @@ |
| +#!/usr/bin/env python |
| + |
| +# Copyright (c) 2012 Google Inc. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +""" |
| +Make sure paths are normalized properly on Windows. |
| +""" |
| + |
| +import TestGyp |
| + |
| +import sys |
| + |
| +if sys.platform == 'win32': |
| + # This is ninja-specific because ninja is more fussy about paths matching in |
| + # 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
|
| + # to make sure that case matches. We also confirm the paths are fully |
| + # relativized (not having redundant xyz/../ for example) which is necessary |
| + # 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.
|
| + test = TestGyp.TestGyp(formats=['ninja']) |
| + |
| + test.run_gyp('normalize-paths.gyp') |
| + |
| + # We can't use existence tests because any case will pass, so we check the |
| + # contents of ninja files directly since that's what we're most concerned |
| + # with anyway. |
| + rootninja = open(test.built_file_path('build.ninja')).read() |
| + if 'microsoft visual studio' not in rootninja: |
| + test.fail_test() |
| + if 'some_target.ninja' not in rootninja or 'Some_Target.ninja' in rootninja: |
| + test.fail_test() |
| + if 'Some_Target' in rootninja or 'AnotherName' in rootninja: |
| + test.fail_test() |
| + |
| + subninja = open(test.built_file_path('obj/some_target.ninja')).read() |
| + if 'AnotherName' in subninja or 'anothername' not in subninja: |
| + test.fail_test() |
| + if ('Some_Target.exe' in subninja or 'Some_Target.pdb' in subninja or |
| + 'some_target.pdb' not in subninja): |
| + test.fail_test() |
| + if 'HeLLo' in subninja or 'hello' not in subninja: |
| + test.fail_test() |
| + if 'blOrP' in subninja or 'blorp' not in subninja: |
| + test.fail_test() |
| + if '$!product_dir' in subninja: |
| + test.fail_test() |
| + |
| + second = open(test.built_file_path('obj/second.ninja')).read() |
| + if 'AnotherName' in second or 'anothername' not in second: |
| + test.fail_test() |
| + if 'HeLLo' in second or 'hello' not in second: |
| + test.fail_test() |
| + |
| + action = open(test.built_file_path('obj/action.ninja')).read() |
| + if 'TempFile' in action or 'tempfile' not in action: |
| + test.fail_test() |
| + if 'TempFILE' in action: |
| + test.fail_test() |
| + if 'ReSuLt' in action or 'result' not in action: |
| + test.fail_test() |
| + if 'SomeInput' in action or 'someinput' not in action: |
| + test.fail_test() |
| + |
| + test.pass_test() |