Added fix for TeX includes with same name as subdirs.
[scons.git] / test / Program.py
index 25da84e38f8ea0e9e1181d5abdec70d1cf46da26..15fd0c342f9017b4d811ab8de0e73fd4e0bdc796 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2001, 2002, 2003 Steven Knight
+# __COPYRIGHT__
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import os.path
-import sys
 import time
+
 import TestSCons
 
-if sys.platform == 'win32':
-    _exe = '.exe'
-else:
-    _exe = ''
+_exe = TestSCons._exe
 
 test = TestSCons.TestSCons()
 
@@ -47,98 +44,115 @@ test.write('SConstruct', """
 env = Environment()
 env.Program(target = 'foo1', source = 'f1.c')
 env.Program(target = 'foo2', source = Split('f2a.c f2b.c f2c.c'))
-env.Program(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'])
+f3a = File('f3a.c')
+f3b = File('f3b.c')
+Program(target = 'foo3', source = [f3a, [f3b, 'f3c.c']])
 env.Program('foo4', 'f4.c')
 env.Program('foo5.c')
 """)
 
 test.write('f1.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f1.c\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f1.c\n");
+        exit (0);
 }
 """)
 
 test.write('f2a.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 void
 f2a(void)
 {
-       printf("f2a.c\n");
+        printf("f2a.c\n");
 }
 """)
 
 test.write('f2b.c', r"""
+#include <stdio.h>
 void
 f2b(void)
 {
-       printf("f2b.c\n");
+        printf("f2b.c\n");
 }
 """)
 
 test.write('f2c.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 extern void f2a(void);
 extern void f2b(void);
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       f2a();
-       f2b();
-       printf("f2c.c\n");
-       exit (0);
+        argv[argc++] = "--";
+        f2a();
+        f2b();
+        printf("f2c.c\n");
+        exit (0);
 }
 """)
 
 test.write('f3a.c', r"""
+#include <stdio.h>
 void
 f3a(void)
 {
-       printf("f3a.c\n");
+        printf("f3a.c\n");
 }
 """)
 
 test.write('f3b.c', r"""
+#include <stdio.h>
 void
 f3b(void)
 {
-       printf("f3b.c\n");
+        printf("f3b.c\n");
 }
 """)
 
 test.write('f3c.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 extern void f3a(void);
 extern void f3b(void);
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       f3a();
-       f3b();
-       printf("f3c.c\n");
-       exit (0);
+        argv[argc++] = "--";
+        f3a();
+        f3b();
+        printf("f3c.c\n");
+        exit (0);
 }
 """)
 
 test.write('f4.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f4.c\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f4.c\n");
+        exit (0);
 }
 """)
 
 test.write('foo5.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("foo5.c\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("foo5.c\n");
+        exit (0);
 }
 """)
 
@@ -153,40 +167,47 @@ test.run(program = foo5, stdout = "foo5.c\n")
 test.up_to_date(arguments = '.')
 
 test.write('f1.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f1.c X\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f1.c X\n");
+        exit (0);
 }
 """)
 
 test.write('f3b.c', r"""
+#include <stdio.h>
 void
 f3b(void)
 {
-       printf("f3b.c X\n");
+        printf("f3b.c X\n");
 }
 """)
 
 test.write('f4.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f4.c X\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f4.c X\n");
+        exit (0);
 }
 """)
 
 test.write('foo5.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("foo5.c X\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("foo5.c X\n");
+        exit (0);
 }
 """)
 
@@ -218,40 +239,48 @@ test.fail_test(oldtime4 != os.path.getmtime(foo4))
 test.fail_test(oldtime5 != os.path.getmtime(foo5))
 
 test.write('f1.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f1.c Y\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f1.c Y\n");
+        exit (0);
 }
 """)
 
 test.write('f3b.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 void
 f3b(void)
 {
-       printf("f3b.c Y\n");
+        printf("f3b.c Y\n");
 }
 """)
 
 test.write('f4.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f4.c Y\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f4.c Y\n");
+        exit (0);
 }
 """)
 
 test.write('foo5.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("foo5.c Y\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("foo5.c Y\n");
+        exit (0);
 }
 """)
 
@@ -266,40 +295,48 @@ test.run(program = foo5, stdout = "foo5.c Y\n")
 test.up_to_date(arguments = foo_args)
 
 test.write('f1.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f1.c Z\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f1.c Z\n");
+        exit (0);
 }
 """)
 
 test.write('f3b.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 void
 f3b(void)
 {
-       printf("f3b.c Z\n");
+        printf("f3b.c Z\n");
 }
 """)
 
 test.write('f4.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("f4.c Z\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("f4.c Z\n");
+        exit (0);
 }
 """)
 
 test.write('foo5.c', r"""
+#include <stdio.h>
+#include <stdlib.h>
 int
 main(int argc, char *argv[])
 {
-       argv[argc++] = "--";
-       printf("foo5.c Z\n");
-       exit (0);
+        argv[argc++] = "--";
+        printf("foo5.c Z\n");
+        exit (0);
 }
 """)
 
@@ -331,3 +368,9 @@ test.fail_test(not (oldtime4 == os.path.getmtime(foo4)))
 test.fail_test(not (oldtime5 == os.path.getmtime(foo5)))
 
 test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: