90aa4428563d8162bde5421a07c5abb98c0798f9
[scons.git] / test / option-f.py
1 #!/usr/bin/env python
2
3 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
4
5 import TestSCons
6 import os.path
7
8 test = TestSCons.TestSCons()
9
10 test.subdir('subdir')
11
12 subdir_BuildThis = os.path.join('subdir', 'Buildthis')
13
14 test.write('SConscript', """
15 import os
16 print "SConscript " + os.getcwd()
17 """)
18
19 test.write(subdir_BuildThis, """
20 import os
21 print "subdir/BuildThis", os.getcwd()
22 """)
23
24 wpath = test.workpath()
25
26 test.run(arguments = '-f SConscript',
27          stdout = "SConscript %s\n" % wpath)
28
29 test.run(arguments = '-f ' + subdir_BuildThis,
30          stdout = "subdir/BuildThis %s\n" % wpath)
31
32 test.run(arguments = '--file=SConscript',
33          stdout = "SConscript %s\n" % wpath)
34
35 test.run(arguments = '--file=' + subdir_BuildThis,
36          stdout = "subdir/BuildThis %s\n" % wpath)
37
38 test.run(arguments = '--makefile=SConscript',
39          stdout = "SConscript %s\n" % wpath)
40
41 test.run(arguments = '--makefile=' + subdir_BuildThis,
42          stdout = "subdir/BuildThis %s\n" % wpath)
43
44 test.run(arguments = '--sconstruct=SConscript',
45          stdout = "SConscript %s\n" % wpath)
46
47 test.run(arguments = '--sconstruct=' + subdir_BuildThis,
48          stdout = "subdir/BuildThis %s\n" % wpath)
49
50 test.run(arguments = '-f -', stdin = """
51 import os
52 print "STDIN " + os.getcwd()
53 """,
54          stdout = "STDIN %s\n" % wpath)
55
56 test.run(arguments = '-f no_such_file',
57          stdout = "",
58          stderr = "Ignoring missing script 'no_such_file'\n")
59
60 test.pass_test()