3 # Permission is hereby granted, free of charge, to any person obtaining
4 # a copy of this software and associated documentation files (the
5 # "Software"), to deal in the Software without restriction, including
6 # without limitation the rights to use, copy, modify, merge, publish,
7 # distribute, sublicense, and/or sell copies of the Software, and to
8 # permit persons to whom the Software is furnished to do so, subject to
9 # the following conditions:
11 # The above copyright notice and this permission notice shall be included
12 # in all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
15 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
16 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 Verify that setting the $TEMPFILEDIR variable will cause
24 the generated tempfile used for long command lines to be created in specified directory.
25 And if not specified in one of TMPDIR, TEMP or TMP (based on os' normal usage of such)
30 from TestCmd
import IS_WINDOWS
32 test
= TestSCons
.TestSCons(match
=TestSCons
.match_re
)
34 test
.file_fixture('fixture/SConstruct.tempfiledir', 'SConstruct')
36 expected_output
= r
"""Using tempfile __WORKDIR__/my_temp_files/\S+ for command line:
38 xxx.py @__WORKDIR__/my_temp_files/\S+
39 Using tempfile __TEMPDIR__/\S+ for command line:
40 xxx.py global_foo.out foo.in
41 xxx.py @__TEMPDIR__/\S+
45 expected_output
= expected_output
.replace('/','\\\\')
46 wd_escaped
= escape(test
.workdir
)
47 td_escaped
= escape(tempfile
.gettempdir())
48 expected_output
=expected_output
.replace("__WORKDIR__", wd_escaped
)
49 expected_output
= expected_output
.replace("__TEMPDIR__", td_escaped
)
51 test
.write('foo.in', "foo.in\n")
53 test
.run(arguments
='-n -Q .',
54 stdout
=expected_output
)
56 # Using tempfile \\S+ for command line:
57 # xxx.py foo.out foo.in
62 # tempfile = test.stdout().splitlines()[0].split()[2]
64 # test.fail_test("Unexpected output couldn't find tempfile")
66 # dirname = os.path.basename(os.path.dirname(tempfile))
67 # test.fail_test('my_temp_files' != dirname, message="Temp file not created in \"my_temp_files\" directory")
72 # indent-tabs-mode:nil
74 # vim: set expandtab tabstop=4 shiftwidth=4: