summaryrefslogtreecommitdiffstats
path: root/test/option--C.py
blob: 7b3bc277891817535cb2511ee990810732ba3fae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python

__revision__ = "test/option--C.py __REVISION__ __DATE__ __DEVELOPER__"

import TestSCons
import string
import sys

test = TestSCons.TestSCons()

wpath = test.workpath()
wpath_sub = test.workpath('sub')
wpath_sub_dir = test.workpath('sub', 'dir')

test.subdir('sub', ['sub', 'dir'])

test.write('SConstruct', """
import os
print "SConstruct", os.getcwd()
""")

test.write(['sub', 'SConstruct'], """
import os
print "sub/SConstruct", os.getcwd()
""")

test.write(['sub', 'dir', 'SConstruct'], """
import os
print "sub/dir/SConstruct", os.getcwd()
""")

test.run(arguments = '-C sub')

test.fail_test(test.stdout() != "sub/SConstruct %s\n" % wpath_sub)
test.fail_test(test.stderr() != "")

test.run(arguments = '-C sub -C dir')

test.fail_test(test.stdout() != "sub/dir/SConstruct %s\n" % wpath_sub_dir)
test.fail_test(test.stderr() != "")

test.run(chdir = '.')

test.fail_test(test.stdout() != "SConstruct %s\n" % wpath)
test.fail_test(test.stderr() != "")

test.run(arguments = '--directory=sub/dir')

test.fail_test(test.stdout() != "sub/dir/SConstruct %s\n" % wpath_sub_dir)
test.fail_test(test.stderr() != "")

test.run(arguments = '-C %s -C %s' % (wpath_sub_dir, wpath_sub))

test.fail_test(test.stdout() != "sub/SConstruct %s\n" % wpath_sub)
test.fail_test(test.stderr() != "")

test.pass_test()