5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 test
= TestSCons
.TestSCons()
34 subdir_BuildThis
= os
.path
.join('subdir', 'Buildthis')
36 test
.write('SConscript', """
39 DefaultEnvironment(tools=[])
40 print("SConscript " + os.getcwd())
43 test
.write(subdir_BuildThis
, """
46 DefaultEnvironment(tools=[])
47 print("subdir/BuildThis " + os.getcwd())
50 test
.write('Build2', """
53 DefaultEnvironment(tools=[])
54 print("Build2 " + os.getcwd())
57 wpath
= test
.workpath()
60 arguments
='-f SConscript .',
61 stdout
=test
.wrap_stdout(
62 read_str
=f
'SConscript {wpath}\n',
63 build_str
="scons: `.' is up to date.\n"
68 arguments
=f
'-f {subdir_BuildThis} .',
69 stdout
=test
.wrap_stdout(
70 read_str
=f
'subdir/BuildThis {wpath}\n',
71 build_str
="scons: `.' is up to date.\n",
76 arguments
='--file=SConscript .',
77 stdout
=test
.wrap_stdout(
78 read_str
=f
'SConscript {wpath}\n',
79 build_str
="scons: `.' is up to date.\n"
84 arguments
=f
'--file={subdir_BuildThis} .',
85 stdout
=test
.wrap_stdout(
86 read_str
=f
'subdir/BuildThis {wpath}\n',
87 build_str
="scons: `.' is up to date.\n",
92 arguments
='--makefile=SConscript .',
93 stdout
=test
.wrap_stdout(
94 read_str
=f
'SConscript {wpath}\n',
95 build_str
="scons: `.' is up to date.\n"
100 arguments
=f
'--makefile={subdir_BuildThis} .',
101 stdout
=test
.wrap_stdout(
102 read_str
=f
'subdir/BuildThis {wpath}\n',
103 build_str
="scons: `.' is up to date.\n",
108 arguments
='--sconstruct=SConscript .',
109 stdout
=test
.wrap_stdout(
110 read_str
=f
'SConscript {wpath}\n',
111 build_str
="scons: `.' is up to date.\n"
116 arguments
=f
'--sconstruct={subdir_BuildThis} .',
117 stdout
=test
.wrap_stdout(
118 read_str
=f
'subdir/BuildThis {wpath}\n',
119 build_str
="scons: `.' is up to date.\n",
126 DefaultEnvironment(tools=[])
128 print("STDIN " + os.getcwd())
130 stdout
=test
.wrap_stdout(
131 read_str
=f
'STDIN {wpath}\n',
132 build_str
="scons: `.' is up to date.\n"
136 expect
= test
.wrap_stdout(
137 read_str
=f
'Build2 {wpath}\nSConscript {wpath}\n',
138 build_str
="scons: `.' is up to date.\n",
140 test
.run(arguments
='-f Build2 -f SConscript .', stdout
=expect
)
142 missing
= "no_such_file"
143 test
.run(arguments
=f
"-f {missing} .", status
=2, stderr
=None)
144 expect
= [f
"scons: *** missing SConscript file {missing!r}"]
145 test
.must_contain_all_lines(test
.stderr(), expect
)
151 # indent-tabs-mode:nil
153 # vim: set expandtab tabstop=4 shiftwidth=4: