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 Checks that files whose file case changes get rebuilt correctly. 9 """ 10 11 import os 12 import TestGyp 13 14 test = TestGyp.TestGyp() 15 CHDIR = 'filecase' 16 test.run_gyp('test.gyp', chdir=CHDIR) 17 test.build('test.gyp', test.ALL, chdir=CHDIR) 18 19 os.rename('filecase/file.c', 'filecase/fIlE.c') 20 test.write('filecase/test.gyp', 21 test.read('filecase/test.gyp').replace('file.c', 'fIlE.c')) 22 test.run_gyp('test.gyp', chdir=CHDIR) 23 test.build('test.gyp', test.ALL, chdir=CHDIR) 24 25 26 # Check that having files that differ just in their case still work on 27 # case-sensitive file systems. 28 test.write('filecase/FiLe.c', 'int f(); int main() { return f(); }') 29 test.write('filecase/fIlE.c', 'int f() { return 42; }') 30 is_case_sensitive = test.read('filecase/FiLe.c') != test.read('filecase/fIlE.c') 31 if is_case_sensitive: 32 test.run_gyp('test-casesensitive.gyp', chdir=CHDIR) 33 test.build('test-casesensitive.gyp', test.ALL, chdir=CHDIR) 34 35 test.pass_test() 36