5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Verify correct use of the live 'ml' assembler.
37 _python_ = TestSCons._python_
40 test = TestSCons.TestSCons()
42 if sys.platform != 'win32':
43 test.skip_test("Skipping ml test on non-win32 platform '%s'\n" % sys.platform)
45 ml = test.where_is('ml')
48 test.skip_test("ml not found; skipping test\n")
50 test.write("wrapper.py",
54 open('%s', 'wb').write("wrapper.py\\n")
55 os.system(string.join(sys.argv[1:], " "))
56 """ % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
58 test.write('SConstruct', """
60 ccc = Environment(tools = ['msvc', 'mslink', 'masm'],
61 ASFLAGS = '/nologo /coff')
62 ccc['ENV']['PATH'] = ccc['ENV']['PATH'] + os.pathsep + os.environ['PATH']
63 ddd = ccc.Clone(AS = r'%(_python_)s wrapper.py ' + ccc['AS'])
64 ccc.Program(target = 'ccc', source = ['ccc.asm', 'ccc_main.c'])
65 ddd.Program(target = 'ddd', source = ['ddd.asm', 'ddd_main.c'])
72 _name byte "ccc.asm",0
81 _name byte "ddd.asm",0
86 test.write('ccc_main.c', r"""
90 main(int argc, char *argv[])
93 printf("ccc_main.c %s\n", name);
98 test.write('ddd_main.c', r"""
102 main(int argc, char *argv[])
105 printf("ddd_main.c %s\n", name);
110 test.run(arguments = 'ccc' + _exe, stderr = None)
112 test.run(program = test.workpath('ccc'), stdout = "ccc_main.c ccc.asm\n")
114 test.must_not_exist('wrapper.out')
116 test.run(arguments = 'ddd' + _exe)
118 test.run(program = test.workpath('ddd'), stdout = "ddd_main.c ddd.asm\n")
120 test.must_match('wrapper.out', "wrapper.py\n")