summaryrefslogtreecommitdiffstats
path: root/test/option--C.py
blob: d1389bbbff1fb1512b5c02dcdd27f135973e8983 (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
59
60
#!/usr/bin/env python

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

import TestCmd
import string
import sys

test = TestCmd.TestCmd(program = 'scons.py',
                       workdir = '',
                       interpreter = 'python')

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(chdir = '.', arguments = '-C sub')

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

test.run(chdir = '.', 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(chdir = '.', arguments = '--directory=sub/dir')

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

test.run(chdir = '.', 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()