summaryrefslogtreecommitdiff
path: root/test/option-n.py
blob: 0f8687a49e3536e8ae58a32122f98ff11e266de0 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python

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

import TestSCons
import os.path
import string
import sys

test = TestSCons.TestSCons()

test.write('build.py', r"""
import sys
file = open(sys.argv[1], 'w')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")

test.write('SConstruct', """
MyBuild = Builder(name = "MyBuild",
		  action = "python build.py %(target)s")
env = Environment(BUILDERS = [MyBuild])
env.MyBuild(target = 'f1.out', source = 'f1.in')
env.MyBuild(target = 'f2.out', source = 'f2.in')
""")

args = 'f1.out f2.out'
expect = "python build.py f1.out\npython build.py f2.out\n"

test.run(arguments = args)

test.fail_test(test.stdout() != expect)
test.fail_test(test.stderr() != "")
test.fail_test(not os.path.exists(test.workpath('f1.out')))
test.fail_test(not os.path.exists(test.workpath('f2.out')))

os.unlink(test.workpath('f1.out'))
os.unlink(test.workpath('f2.out'))

test.run(arguments = '-n ' + args)

test.fail_test(test.stdout() != expect)
test.fail_test(test.stderr() != "")
test.fail_test(os.path.exists(test.workpath('f1.out')))
test.fail_test(os.path.exists(test.workpath('f2.out')))

test.run(arguments = '--no-exec ' + args)

test.fail_test(test.stdout() != expect)
test.fail_test(test.stderr() != "")
test.fail_test(os.path.exists(test.workpath('f1.out')))
test.fail_test(os.path.exists(test.workpath('f2.out')))

test.run(arguments = '--just-print ' + args)

test.fail_test(test.stdout() != expect)
test.fail_test(test.stderr() != "")
test.fail_test(os.path.exists(test.workpath('f1.out')))
test.fail_test(os.path.exists(test.workpath('f2.out')))

test.run(arguments = '--dry-run ' + args)

test.fail_test(test.stdout() != expect)
test.fail_test(test.stderr() != "")
test.fail_test(os.path.exists(test.workpath('f1.out')))
test.fail_test(os.path.exists(test.workpath('f2.out')))

test.run(arguments = '--recon ' + args)

test.fail_test(test.stdout() != expect)
test.fail_test(test.stderr() != "")
test.fail_test(os.path.exists(test.workpath('f1.out')))
test.fail_test(os.path.exists(test.workpath('f2.out')))

test.pass_test()