summaryrefslogtreecommitdiff
path: root/test/CPPPATH
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2009-02-09 21:09:43 +0000
committerSteven Knight <knight@baldmt.com>2009-02-09 21:09:43 +0000
commit7a1bf7cff5914b5bb26be38e7a4a27c4fd8b2d79 (patch)
tree7ba7fa02e39ea084fd4ebe450a58639c3a871214 /test/CPPPATH
parentd0babf0088ed94e39ee70169f5f2678822072405 (diff)
downloadscons-7a1bf7cff5914b5bb26be38e7a4a27c4fd8b2d79.tar.gz
Handle finding implicit dependents defined with doubled path
separators, as can happen on Windows systems when the backslashes in the path name are escaped (e.g. "C:\\some\\include.h").
Diffstat (limited to 'test/CPPPATH')
-rw-r--r--test/CPPPATH/absolute-path.py41
1 files changed, 28 insertions, 13 deletions
diff --git a/test/CPPPATH/absolute-path.py b/test/CPPPATH/absolute-path.py
index 5c60de19..1912f4f6 100644
--- a/test/CPPPATH/absolute-path.py
+++ b/test/CPPPATH/absolute-path.py
@@ -29,22 +29,32 @@ Verify the ability to #include a file with an absolute path name. (Which
is not strictly a test of using $CPPPATH, but it's in the ball park...)
"""
+import os
+import string
+
import TestSCons
test = TestSCons.TestSCons()
test.subdir('include', 'work')
-inc_h = test.workpath('include', 'inc.h')
+inc1_h = test.workpath('include', 'inc1.h')
+inc2_h = test.workpath('include', 'inc2.h')
does_not_exist_h = test.workpath('include', 'does_not_exist.h')
+# Verify that including an absolute path still works even if they
+# double the separators in the input file. This can happen especially
+# on Windows if they use \\ to represent an escaped backslash.
+inc2_h = string.replace(inc2_h, os.sep, os.sep+os.sep)
+
test.write(['work', 'SConstruct'], """\
Program('prog.c')
""")
test.write(['work', 'prog.c'], """\
#include <stdio.h>
-#include "%(inc_h)s"
+#include "%(inc1_h)s"
+#include "%(inc2_h)s"
#if 0
#include "%(does_not_exist_h)s"
#endif
@@ -53,29 +63,34 @@ int
main(int argc, char *argv[])
{
argv[argc++] = "--";
- printf("%%s\\n", STRING);
+ printf("%%s\\n", STRING1);
+ printf("%%s\\n", STRING2);
return 0;
}
""" % locals())
-test.write(['include', 'inc.h'], """\
-#define STRING "include/inc.h 1\\n"
+test.write(['include', 'inc1.h'], """\
+#define STRING1 "include/inc1.h A\\n"
+""")
+
+test.write(['include', 'inc2.h'], """\
+#define STRING2 "include/inc2.h A\\n"
""")
test.run(chdir = 'work', arguments = '.')
test.up_to_date(chdir = 'work', arguments = '.')
-test.write(['include', 'inc.h'], """\
-#define STRING "include/inc.h 2\\n"
+test.write(['include', 'inc1.h'], """\
+#define STRING1 "include/inc1.h B\\n"
""")
test.not_up_to_date(chdir = 'work', arguments = '.')
-test.pass_test()
+test.write(['include', 'inc2.h'], """\
+#define STRING2 "include/inc2.h B\\n"
+""")
+
+test.not_up_to_date(chdir = 'work', arguments = '.')
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
+test.pass_test()