summaryrefslogtreecommitdiff
path: root/test/rename
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2012-09-11 22:19:08 +0000
committerthakis@chromium.org <thakis@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2012-09-11 22:19:08 +0000
commit986c94a9dbf47043bb0d346fb5cde86ab10feea6 (patch)
tree1e44749dec443e247dac9740773b5cd0683a9836 /test/rename
parent7fd6d6348eda44586628799a31fa6620aa47b124 (diff)
downloadgyp-986c94a9dbf47043bb0d346fb5cde86ab10feea6.tar.gz
ninja: Survive case-only file renames on case-insensitive filesystems.
See https://github.com/martine/ninja/issues/402 for more information. Review URL: https://chromiumcodereview.appspot.com/10907140 git-svn-id: http://gyp.googlecode.com/svn/trunk@1494 78cadc50-ecff-11dd-a971-7dbc132099af
Diffstat (limited to 'test/rename')
-rw-r--r--test/rename/extension/file.c2
-rw-r--r--test/rename/extension/file.cc2
-rw-r--r--test/rename/extension/test.gyp13
-rw-r--r--test/rename/filecase/file.c1
-rw-r--r--test/rename/filecase/test-casesensitive.gyp15
-rw-r--r--test/rename/filecase/test.gyp14
-rw-r--r--test/rename/gyptest-extension.py28
-rw-r--r--test/rename/gyptest-filecase.py35
8 files changed, 110 insertions, 0 deletions
diff --git a/test/rename/extension/file.c b/test/rename/extension/file.c
new file mode 100644
index 00000000..5241aebb
--- /dev/null
+++ b/test/rename/extension/file.c
@@ -0,0 +1,2 @@
+#include <stdio.h>
+int main() { printf("C\n"); return 0; }
diff --git a/test/rename/extension/file.cc b/test/rename/extension/file.cc
new file mode 100644
index 00000000..e6c50f7d
--- /dev/null
+++ b/test/rename/extension/file.cc
@@ -0,0 +1,2 @@
+#include <stdio.h>
+int main() { printf("C++\n"); }
diff --git a/test/rename/extension/test.gyp b/test/rename/extension/test.gyp
new file mode 100644
index 00000000..16acdfb2
--- /dev/null
+++ b/test/rename/extension/test.gyp
@@ -0,0 +1,13 @@
+# 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.
+{
+ 'targets': [
+ {
+ 'target_name': 'extrename',
+ 'type': 'executable',
+ 'sources': [ 'file.c', ],
+ },
+ ],
+}
+
diff --git a/test/rename/filecase/file.c b/test/rename/filecase/file.c
new file mode 100644
index 00000000..237c8ce1
--- /dev/null
+++ b/test/rename/filecase/file.c
@@ -0,0 +1 @@
+int main() {}
diff --git a/test/rename/filecase/test-casesensitive.gyp b/test/rename/filecase/test-casesensitive.gyp
new file mode 100644
index 00000000..48eaa6eb
--- /dev/null
+++ b/test/rename/filecase/test-casesensitive.gyp
@@ -0,0 +1,15 @@
+# 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.
+{
+ 'targets': [
+ {
+ 'target_name': 'filecaserename_sensitive',
+ 'type': 'executable',
+ 'sources': [
+ 'FiLe.c',
+ 'fIlE.c',
+ ],
+ },
+ ],
+}
diff --git a/test/rename/filecase/test.gyp b/test/rename/filecase/test.gyp
new file mode 100644
index 00000000..eaee9337
--- /dev/null
+++ b/test/rename/filecase/test.gyp
@@ -0,0 +1,14 @@
+# 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.
+{
+ 'targets': [
+ {
+ 'target_name': 'filecaserename',
+ 'type': 'executable',
+ 'sources': [
+ 'file.c',
+ ],
+ },
+ ],
+}
diff --git a/test/rename/gyptest-extension.py b/test/rename/gyptest-extension.py
new file mode 100644
index 00000000..03b7e1c7
--- /dev/null
+++ b/test/rename/gyptest-extension.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2010 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.
+
+"""
+Checks that files whose extension changes get rebuilt correctly.
+"""
+
+import os
+import TestGyp
+
+# .c -> .cc renames don't work with make. # XXX
+test = TestGyp.TestGyp()#formats=['!make'])
+CHDIR = 'extension'
+test.run_gyp('test.gyp', chdir=CHDIR)
+test.build('test.gyp', test.ALL, chdir=CHDIR)
+test.run_built_executable('extrename', stdout="C\n", chdir=CHDIR)
+
+test.write('extension/test.gyp',
+ test.read('extension/test.gyp').replace('file.c', 'file.cc'))
+test.run_gyp('test.gyp', chdir=CHDIR)
+test.build('test.gyp', test.ALL, chdir=CHDIR)
+test.run_built_executable('extrename', stdout="C++\n", chdir=CHDIR)
+
+test.pass_test()
+
diff --git a/test/rename/gyptest-filecase.py b/test/rename/gyptest-filecase.py
new file mode 100644
index 00000000..daed5180
--- /dev/null
+++ b/test/rename/gyptest-filecase.py
@@ -0,0 +1,35 @@
+#!/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.
+
+"""
+Checks that files whose file case changes get rebuilt correctly.
+"""
+
+import os
+import TestGyp
+
+test = TestGyp.TestGyp()
+CHDIR = 'filecase'
+test.run_gyp('test.gyp', chdir=CHDIR)
+test.build('test.gyp', test.ALL, chdir=CHDIR)
+
+os.rename('filecase/file.c', 'filecase/fIlE.c')
+test.write('filecase/test.gyp',
+ test.read('filecase/test.gyp').replace('file.c', 'fIlE.c'))
+test.run_gyp('test.gyp', chdir=CHDIR)
+test.build('test.gyp', test.ALL, chdir=CHDIR)
+
+
+# Check that having files that differ just in their case still work on
+# case-sensitive file systems.
+test.write('filecase/FiLe.c', 'int f(); int main() { return f(); }')
+test.write('filecase/fIlE.c', 'int f() { return 42; }')
+is_case_sensitive = test.read('filecase/FiLe.c') != test.read('filecase/fIlE.c')
+if is_case_sensitive:
+ test.run_gyp('test-casesensitive.gyp', chdir=CHDIR)
+ test.build('test-casesensitive.gyp', test.ALL, chdir=CHDIR)
+
+test.pass_test()