"""
def __init__(self, **kw):
- """Initialize an SCons testing object.
+ """Initialize an SCons testing object.
- If they're not overridden by keyword arguments, this
- initializes the object with the following default values:
+ If they're not overridden by keyword arguments, this
+ initializes the object with the following default values:
- program = 'scons' if it exists,
- else 'scons.py'
- interpreter = 'python'
- match = match_exact
- workdir = ''
+ program = 'scons' if it exists,
+ else 'scons.py'
+ interpreter = 'python'
+ match = match_exact
+ workdir = ''
The workdir value means that, by default, a temporary workspace
directory is created for a TestSCons environment. In addition,
- this method changes directory (chdir) to the workspace directory,
- so an explicit "chdir = '.'" on all of the run() method calls
- is not necessary.
- """
- if not kw.has_key('program'):
+ this method changes directory (chdir) to the workspace directory,
+ so an explicit "chdir = '.'" on all of the run() method calls
+ is not necessary.
+ """
+ if not kw.has_key('program'):
kw['program'] = os.environ.get('SCONS')
if not kw['program']:
if os.path.exists('scons'):
kw['program'] = 'scons'
else:
kw['program'] = 'scons.py'
- if not kw.has_key('interpreter') and not os.environ.get('SCONS_EXEC'):
- kw['interpreter'] = [python, '-tt']
- if not kw.has_key('match'):
- kw['match'] = match_exact
- if not kw.has_key('workdir'):
- kw['workdir'] = ''
- apply(TestCommon.__init__, [self], kw)
+ if not kw.has_key('interpreter') and not os.environ.get('SCONS_EXEC'):
+ kw['interpreter'] = [python, '-tt']
+ if not kw.has_key('match'):
+ kw['match'] = match_exact
+ if not kw.has_key('workdir'):
+ kw['workdir'] = ''
+ apply(TestCommon.__init__, [self], kw)
def Environment(self, ENV=None, *args, **kw):
"""
else:
workpath = self.workpath()
- if not sconscript:
- sconscript = self.workpath('SConstruct')
+ if not sconscript:
+ sconscript = self.workpath('SConstruct')
exec_script_main = "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-%s'), join(sys.prefix, 'scons-%s'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" % (self._scons_version, self._scons_version)
exec_script_main_xml = string.replace(exec_script_main, "'", "'")
sys.stdout = Unbuffered(sys.stdout)
for t in tests:
- t.command_args = [python]
+ t.command_args = [python, '-tt']
if debug:
t.command_args.append(debug)
t.command_args.append(t.abspath)
def exitstatfunc(stat, result=exitstatfunc_result):
result.append(stat)
- return stat
+ return stat
result = a("out", "in", env, exitstatfunc=exitstatfunc)
assert result == 0, result
s = act4.strfunction([t1], [s1], env)
assert s is None, s
- act = SCons.Action.CommandAction("@foo bar")
- s = act.strfunction([], [], env)
- assert s == "", s
+ act = SCons.Action.CommandAction("@foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "", s
- act = SCons.Action.CommandAction("@-foo bar")
- s = act.strfunction([], [], env)
- assert s == "", s
+ act = SCons.Action.CommandAction("@-foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "", s
- act = SCons.Action.CommandAction("-@foo bar")
- s = act.strfunction([], [], env)
- assert s == "", s
+ act = SCons.Action.CommandAction("-@foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "", s
- act = SCons.Action.CommandAction("-foo bar")
- s = act.strfunction([], [], env)
- assert s == "foo bar", s
+ act = SCons.Action.CommandAction("-foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "foo bar", s
- act = SCons.Action.CommandAction("@ foo bar")
- s = act.strfunction([], [], env)
- assert s == "", s
+ act = SCons.Action.CommandAction("@ foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "", s
- act = SCons.Action.CommandAction("@- foo bar")
- s = act.strfunction([], [], env)
- assert s == "", s
+ act = SCons.Action.CommandAction("@- foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "", s
- act = SCons.Action.CommandAction("-@ foo bar")
- s = act.strfunction([], [], env)
- assert s == "", s
+ act = SCons.Action.CommandAction("-@ foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "", s
- act = SCons.Action.CommandAction("- foo bar")
- s = act.strfunction([], [], env)
- assert s == "foo bar", s
+ act = SCons.Action.CommandAction("- foo bar")
+ s = act.strfunction([], [], env)
+ assert s == "foo bar", s
def test_execute(self):
"""Test execution of command Actions
r = act([], [], env.Copy(out = outfile))
assert r == expect_nonexecutable, "r == %d" % r
- act = SCons.Action.CommandAction('%s %s 1' % (python, exit_py))
- r = act([], [], env)
- assert r == 1, r
+ act = SCons.Action.CommandAction('%s %s 1' % (python, exit_py))
+ r = act([], [], env)
+ assert r == 1, r
- act = SCons.Action.CommandAction('@%s %s 1' % (python, exit_py))
- r = act([], [], env)
- assert r == 1, r
+ act = SCons.Action.CommandAction('@%s %s 1' % (python, exit_py))
+ r = act([], [], env)
+ assert r == 1, r
- act = SCons.Action.CommandAction('@-%s %s 1' % (python, exit_py))
- r = act([], [], env)
- assert r == 0, r
+ act = SCons.Action.CommandAction('@-%s %s 1' % (python, exit_py))
+ r = act([], [], env)
+ assert r == 0, r
- act = SCons.Action.CommandAction('-%s %s 1' % (python, exit_py))
- r = act([], [], env)
- assert r == 0, r
+ act = SCons.Action.CommandAction('-%s %s 1' % (python, exit_py))
+ r = act([], [], env)
+ assert r == 0, r
- act = SCons.Action.CommandAction('@ %s %s 1' % (python, exit_py))
- r = act([], [], env)
- assert r == 1, r
+ act = SCons.Action.CommandAction('@ %s %s 1' % (python, exit_py))
+ r = act([], [], env)
+ assert r == 1, r
- act = SCons.Action.CommandAction('@- %s %s 1' % (python, exit_py))
- r = act([], [], env)
- assert r == 0, r
+ act = SCons.Action.CommandAction('@- %s %s 1' % (python, exit_py))
+ r = act([], [], env)
+ assert r == 0, r
- act = SCons.Action.CommandAction('- %s %s 1' % (python, exit_py))
- r = act([], [], env)
- assert r == 0, r
+ act = SCons.Action.CommandAction('- %s %s 1' % (python, exit_py))
+ r = act([], [], env)
+ assert r == 0, r
def _DO_NOT_EXECUTE_test_pipe_execute(self):
"""Test capturing piped output from an action
tgt = builder2(env, target='baz',
source=['test.bar', 'test2.foo', 'test3.txt'])[0]
- s = str(tgt)
- assert s == 'baz', s
- s = map(str, tgt.sources)
- assert s == ['test.foo', 'test2.foo', 'test3.txt'], s
- s = map(str, tgt.sources[0].sources)
- assert s == ['test.bar'], s
+ s = str(tgt)
+ assert s == 'baz', s
+ s = map(str, tgt.sources)
+ assert s == ['test.foo', 'test2.foo', 'test3.txt'], s
+ s = map(str, tgt.sources[0].sources)
+ assert s == ['test.bar'], s
tgt = builder2(env, None, 'aaa.bar')[0]
- s = str(tgt)
- assert s == 'aaa', s
- s = map(str, tgt.sources)
- assert s == ['aaa.foo'], s
- s = map(str, tgt.sources[0].sources)
- assert s == ['aaa.bar'], s
+ s = str(tgt)
+ assert s == 'aaa', s
+ s = map(str, tgt.sources)
+ assert s == ['aaa.foo'], s
+ s = map(str, tgt.sources[0].sources)
+ assert s == ['aaa.bar'], s
builder3 = SCons.Builder.MultiStepBuilder(action = 'foo',
src_builder = 'xyzzy',
suffix='.exe',
src_suffix='.obj')
tgt = builder6(env, 'test', 'test.i')[0]
- s = str(tgt)
+ s = str(tgt)
assert s == 'test.exe', s
- s = map(str, tgt.sources)
- assert s == ['test_wrap.obj'], s
- s = map(str, tgt.sources[0].sources)
- assert s == ['test_wrap.c'], s
- s = map(str, tgt.sources[0].sources[0].sources)
- assert s == ['test.i'], s
+ s = map(str, tgt.sources)
+ assert s == ['test_wrap.obj'], s
+ s = map(str, tgt.sources[0].sources)
+ assert s == ['test_wrap.c'], s
+ s = map(str, tgt.sources[0].sources[0].sources)
+ assert s == ['test.i'], s
def test_CompositeBuilder(self):
"""Testing CompositeBuilder class."""
s2 = "env2 = {\n"
d = {}
for k in env1._dict.keys() + env2._dict.keys():
- d[k] = None
+ d[k] = None
keys = d.keys()
keys.sort()
for k in keys:
s2 = "d2 = {\n"
d = {}
for k in d1.keys() + d2.keys():
- d[k] = None
+ d[k] = None
keys = d.keys()
keys.sort()
for k in keys:
def test_Builder_execs(self):
- """Test Builder execution through different environments
+ """Test Builder execution through different environments
- One environment is initialized with a single
- Builder object, one with a list of a single Builder
- object, and one with a list of two Builder objects.
- """
- global built_it
+ One environment is initialized with a single
+ Builder object, one with a list of a single Builder
+ object, and one with a list of two Builder objects.
+ """
+ global built_it
- b1 = Builder()
- b2 = Builder()
+ b1 = Builder()
+ b2 = Builder()
- built_it = {}
+ built_it = {}
env3 = Environment()
env3.Replace(BUILDERS = { 'builder1' : b1,
'builder2' : b2 })
- env3.builder1.execute(target = 'out1')
- env3.builder2.execute(target = 'out2')
- env3.builder1.execute(target = 'out3')
- assert built_it['out1']
- assert built_it['out2']
- assert built_it['out3']
+ env3.builder1.execute(target = 'out1')
+ env3.builder2.execute(target = 'out2')
+ env3.builder1.execute(target = 'out3')
+ assert built_it['out1']
+ assert built_it['out2']
+ assert built_it['out3']
env4 = env3.Copy()
assert env4.builder1.env is env4, "builder1.env (%s) == env3 (%s)?" % (env4.builder1.env, env3)
assert s == [s1, s1, None, s3, s3], s
def test_ENV(self):
- """Test setting the external ENV in Environments
- """
- env = Environment()
- assert env.Dictionary().has_key('ENV')
+ """Test setting the external ENV in Environments
+ """
+ env = Environment()
+ assert env.Dictionary().has_key('ENV')
- env = Environment(ENV = { 'PATH' : '/foo:/bar' })
- assert env.Dictionary('ENV')['PATH'] == '/foo:/bar'
+ env = Environment(ENV = { 'PATH' : '/foo:/bar' })
+ assert env.Dictionary('ENV')['PATH'] == '/foo:/bar'
def test_ReservedVariables(self):
"""Test generation of warnings when reserved variable names
assert x is None, x
def test_Dictionary(self):
- """Test retrieval of known construction variables
-
- Fetch them from the Dictionary and check for well-known
- defaults that get inserted.
- """
- env = Environment(XXX = 'x', YYY = 'y', ZZZ = 'z')
- assert env.Dictionary('XXX') == 'x'
- assert env.Dictionary('YYY') == 'y'
- assert env.Dictionary('XXX', 'ZZZ') == ['x', 'z']
- xxx, zzz = env.Dictionary('XXX', 'ZZZ')
- assert xxx == 'x'
- assert zzz == 'z'
- assert env.Dictionary().has_key('BUILDERS')
- assert env.Dictionary().has_key('CC')
- assert env.Dictionary().has_key('CCFLAGS')
- assert env.Dictionary().has_key('ENV')
-
- assert env['XXX'] == 'x'
- env['XXX'] = 'foo'
- assert env.Dictionary('XXX') == 'foo'
- del env['XXX']
- assert not env.Dictionary().has_key('XXX')
+ """Test retrieval of known construction variables
+
+ Fetch them from the Dictionary and check for well-known
+ defaults that get inserted.
+ """
+ env = Environment(XXX = 'x', YYY = 'y', ZZZ = 'z')
+ assert env.Dictionary('XXX') == 'x'
+ assert env.Dictionary('YYY') == 'y'
+ assert env.Dictionary('XXX', 'ZZZ') == ['x', 'z']
+ xxx, zzz = env.Dictionary('XXX', 'ZZZ')
+ assert xxx == 'x'
+ assert zzz == 'z'
+ assert env.Dictionary().has_key('BUILDERS')
+ assert env.Dictionary().has_key('CC')
+ assert env.Dictionary().has_key('CCFLAGS')
+ assert env.Dictionary().has_key('ENV')
+
+ assert env['XXX'] == 'x'
+ env['XXX'] = 'foo'
+ assert env.Dictionary('XXX') == 'foo'
+ del env['XXX']
+ assert not env.Dictionary().has_key('XXX')
def test_FindIxes(self):
"Test FindIxes()"
assert i.path == 'dir2'
def test_Install(self):
- """Test the Install method"""
+ """Test the Install method"""
env = Environment(FOO='iii', BAR='jjj')
tgt = env.Install('export', [ 'build/foo1', 'build/foo2' ])
assert match, e
def test_InstallAs(self):
- """Test the InstallAs method"""
+ """Test the InstallAs method"""
env = Environment(FOO='iii', BAR='jjj')
tgt = env.InstallAs(target=string.split('foo1 foo2'),
assert e.errstr == "foo"
def test_InternalError(self):
- """Test the InternalError exception."""
+ """Test the InternalError exception."""
try:
raise SCons.Errors.InternalError, "test internal error"
except SCons.Errors.InternalError, e:
assert e.args == ("test internal error",)
def test_UserError(self):
- """Test the UserError exception."""
+ """Test the UserError exception."""
try:
raise SCons.Errors.UserError, "test user error"
except SCons.Errors.UserError, e:
assert e.args == ("test user error",)
def test_ExplicitExit(self):
- """Test the ExplicitExit exception."""
+ """Test the ExplicitExit exception."""
try:
raise SCons.Errors.ExplicitExit, "node"
except SCons.Errors.ExplicitExit, e:
if __name__ == "__main__":
suite = unittest.makeSuite(ErrorsTestCase, 'test_')
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
import "f3.idl";
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring("IBarObject Interface"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring("IBarObject Interface"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
import <f3.idl>;
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring(\"IBarObject Interface\"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring(\"IBarObject Interface\"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
const char* x = \"#include <never.idl>\"
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring(\"IBarObject Interface\"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring(\"IBarObject Interface\"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
#include <fb.idl>
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring(\"IBarObject Interface\"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring(\"IBarObject Interface\"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
"""
def __init__(self, value = ""):
- self.value = value
+ self.value = value
def get_signature(self):
if not hasattr(self, "sig"):
- self.sig = signature(self)
- return self.sig
+ self.sig = signature(self)
+ return self.sig
def get_contents(self):
- return self.value
+ return self.value
class MD5TestCase(unittest.TestCase):
def test_current(self):
- """Test deciding if an object is up-to-date
+ """Test deciding if an object is up-to-date
- Simple comparison of different "signature" values.
- """
- obj = my_obj('111')
- assert not current(obj.get_signature(), signature(my_obj('110')))
- assert current(obj.get_signature(), signature(my_obj('111')))
- assert not current(obj.get_signature(), signature(my_obj('112')))
+ Simple comparison of different "signature" values.
+ """
+ obj = my_obj('111')
+ assert not current(obj.get_signature(), signature(my_obj('110')))
+ assert current(obj.get_signature(), signature(my_obj('111')))
+ assert not current(obj.get_signature(), signature(my_obj('112')))
def test_collect(self):
- """Test collecting a list of signatures into a new signature value
- """
+ """Test collecting a list of signatures into a new signature value
+ """
s = map(signature, map(my_obj, ('111', '222', '333')))
assert '698d51a19d8a121ce581499d7b701668' == collect(s[0:1])
assert '8980c988edc2c78cc43ccb718c06efd5' == collect(s[0:2])
- assert '53fd88c84ff8a285eb6e0a687e55b8c7' == collect(s)
+ assert '53fd88c84ff8a285eb6e0a687e55b8c7' == collect(s)
def test_signature(self):
"""Test generating a signature"""
- o1 = my_obj(value = '111')
+ o1 = my_obj(value = '111')
s = signature(o1)
assert '698d51a19d8a121ce581499d7b701668' == s, s
if __name__ == "__main__":
suite = unittest.makeSuite(MD5TestCase, 'test_')
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
"""
def __init__(self, value = 0):
- self.value = value
+ self.value = value
def get_signature(self):
- return self.value
+ return self.value
def get_timestamp(self):
return self.value
class TimeStampTestCase(unittest.TestCase):
def test_current(self):
- """Test deciding if an object is up-to-date
+ """Test deciding if an object is up-to-date
- Simple comparison of different timestamp values.
- """
- o1 = my_obj(value = 111)
- assert not current(o1.get_signature(), 110)
- assert current(o1.get_signature(), 111)
- assert current(o1.get_signature(), 112)
+ Simple comparison of different timestamp values.
+ """
+ o1 = my_obj(value = 111)
+ assert not current(o1.get_signature(), 110)
+ assert current(o1.get_signature(), 111)
+ assert current(o1.get_signature(), 112)
def test_collect(self):
- """Test collecting a list of signatures into a new signature value
- into a new timestamp value.
- """
+ """Test collecting a list of signatures into a new signature value
+ into a new timestamp value.
+ """
- assert 111 == collect((111,))
- assert 222 == collect((111, 222))
- assert 333 == collect((333, 222, 111))
+ assert 111 == collect((111,))
+ assert 222 == collect((111, 222))
+ assert 333 == collect((333, 222, 111))
def test_signature(self):
"""Test generating a signature"""
if __name__ == "__main__":
suite = unittest.makeSuite(TimeStampTestCase, 'test_')
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java("""\
public class MyTabs
{
- private class MyInternal
- {
- }
- private final static String PATH = "images\\\\";
+ private class MyInternal
+ {
+ }
+ private final static String PATH = "images\\\\";
}
""")
assert pkg_dir == None, pkg_dir
print "Test MSVS 6 Registry"
# print str(registry.root)
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
registry = DummyRegistry(regdata_6b)
default_version = '6.0'
print "Test Other MSVS 6 Registry"
# print str(registry.root)
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
registry = DummyRegistry(regdata_67)
default_version = '7.0'
# print str(registry.root)
print "Test MSVS 6 & 7 Registry"
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
registry = DummyRegistry(regdata_7)
default_version = '7.0'
# print str(registry.root)
print "Test MSVS 7 Registry"
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
registry = DummyRegistry(regdata_none)
default_version = '6.0'
# print str(registry.root)
print "Test Empty Registry"
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
if __name__ == "__main__":
suite = unittest.makeSuite(WarningsTestCase, 'test_')
if not unittest.TextTestRunner().run(suite).wasSuccessful():
- sys.exit(1)
+ sys.exit(1)
self.version_lib = os.path.join(self.lib_dir, scons_version)
self.man_dir = os.path.join(self.prefix, 'man', 'man1')
- self.prepend_bin_dir = lambda p, d=self.bin_dir: os.path.join(d, p)
- self.prepend_bat_dir = lambda p, d=self.bat_dir: os.path.join(d, p)
- self.prepend_man_dir = lambda p, d=self.man_dir: os.path.join(d, p)
+ self.prepend_bin_dir = lambda p, d=self.bin_dir: os.path.join(d, p)
+ self.prepend_bat_dir = lambda p, d=self.bat_dir: os.path.join(d, p)
+ self.prepend_man_dir = lambda p, d=self.man_dir: os.path.join(d, p)
def run(self, *args, **kw):
kw['chdir'] = scons_version
return 'Installed SCons man pages into %s' % self.man_dir
def man_page_paths(self):
- return map(self.prepend_man_dir, self._man_pages)
+ return map(self.prepend_man_dir, self._man_pages)
def must_have_installed(self, paths):
void
library_function(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
void
library_function(void)
{
- printf("bar.c\n");
+ printf("bar.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- library_function();
- exit (0);
+ argv[argc++] = "--";
+ library_function();
+ exit (0);
}
""")
void
library_function(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
void
library_function(void)
{
- printf("bar.c\n");
+ printf("bar.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- library_function();
- exit (0);
+ argv[argc++] = "--";
+ library_function();
+ exit (0);
}
""")
.globl name
name:
.ascii "aaa.s"
- .byte 0
+ .byte 0
""")
test.write('bbb.s', """\
.globl name
name:
.ascii "bbb.s"
- .byte 0
+ .byte 0
""")
test.write('ccc.h', """\
.globl name
name:
.ascii STRING
- .byte 0
+ .byte 0
""")
test.write('aaa_main.c', r"""
test.write('ccc.asm',
"""
DSEG segment
- PUBLIC _name
+ PUBLIC _name
_name byte "ccc.asm",0
DSEG ends
- end
+ end
""")
test.write('ddd.asm',
"""
DSEG segment
- PUBLIC _name
+ PUBLIC _name
_name byte "ddd.asm",0
DSEG ends
- end
+ end
""")
test.write('ccc_main.c', r"""
"""
global name
name:
- db 'eee.asm',0
+ db 'eee.asm',0
""")
test.write('fff.asm',
"""
global name
name:
- db 'fff.asm',0
+ db 'fff.asm',0
""")
test.write('eee_main.c', r"""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf(F1_STR);
- exit (0);
+ argv[argc++] = "--";
+ printf(F1_STR);
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf(F2_STR);
- exit (0);
+ argv[argc++] = "--";
+ printf(F2_STR);
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf(F3_STR);
- exit (0);
+ argv[argc++] = "--";
+ printf(F3_STR);
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf(F4_STR);
- exit (0);
+ argv[argc++] = "--";
+ printf(F4_STR);
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("work2/prog.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("work2/prog.c\n");
+ exit (0);
}
""")
int main(int argc, char* argv[])
{
- return test_dep();
+ return test_dep();
}
""")
inline int test_dep()
{
- return 1;
+ return 1;
}
#endif //DEP_H
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:8] != '/*link*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:6] != '/*cc*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:8] != '/*link*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:6] != '/*cc*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
cc = Environment().Dictionary('CC')
env = Environment(LINK = r'%s mylink.py',
CC = r'%s mycc.py',
- CXX = cc)
+ CXX = cc)
env.Program(target = 'test2', source = 'test2.C')
""" % (python, python))
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
+ argv[argc++] = "--";
#ifdef FOO
- printf("prog.c: FOO\n");
+ printf("prog.c: FOO\n");
#endif
#ifdef BAR
- printf("prog.c: BAR\n");
+ printf("prog.c: BAR\n");
#endif
#ifdef BAZ
- printf("prog.c: BAZ\n");
+ printf("prog.c: BAZ\n");
#endif
- exit (0);
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
doIt()
{
#ifdef FOO
- printf("prog.c: FOO\n");
+ printf("prog.c: FOO\n");
#endif
#ifdef BAR
- printf("prog.c: BAR\n");
+ printf("prog.c: BAR\n");
#endif
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("LEX\n");
- printf("%s\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("LEX\n");
+ printf("%s\n");
+ exit (0);
}
"""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
+ argv[argc++] = "--";
#ifdef FOO
- printf("prog.c: FOO %d\n", VAL);
+ printf("prog.c: FOO %d\n", VAL);
#endif
#ifdef BAR
- printf("prog.c: BAR %d\n", VAL);
+ printf("prog.c: BAR %d\n", VAL);
#endif
- exit (0);
+ exit (0);
}
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:clen] != '#' + compiler:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 1\n"
+#define FOO_STRING "include/foo.h 1\n"
#include <bar.h>
""")
test.write(['subdir', 'include', 'foo.h'],
r"""
-#define FOO_STRING "subdir/include/foo.h 1\n"
+#define FOO_STRING "subdir/include/foo.h 1\n"
#include "bar.h"
""")
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 2\n"
+#define FOO_STRING "include/foo.h 2\n"
#include "bar.h"
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:8] != '/*link*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:7] != '/*c++*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:8] != '/*link*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:7] != '/*c++*/':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.cxx\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.cxx\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.cxx\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.cxx\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("LEX\n");
- printf("%s\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("LEX\n");
+ printf("%s\n");
+ exit (0);
}
"""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
doIt()
{
#ifdef FOO
- printf("prog.cpp: FOO\n");
+ printf("prog.cpp: FOO\n");
#endif
#ifdef BAR
- printf("prog.cpp: BAR\n");
+ printf("prog.cpp: BAR\n");
#endif
}
""")
for dir in ['one', 'two', 'three', 'four', 'five']:
- test.run(chdir = dir) # no arguments, use the Default
+ test.run(chdir = dir) # no arguments, use the Default
test.fail_test(test.read(test.workpath('one', 'foo.out')) != "one/foo.in\n")
test.fail_test(os.path.exists(test.workpath('one', 'bar')))
test.write(['nine', 'sub1', 'xxx.in'], "sub1/xxx.in\n")
-test.run(chdir = 'nine') # no arguments, use the Default
+test.run(chdir = 'nine') # no arguments, use the Default
test.fail_test(os.path.exists(test.workpath('nine', 'xxx.out')))
test.fail_test(test.read(test.workpath('nine', 'sub1', 'xxx.out')) != "sub1/xxx.in\n")
test.write(['ten', 'sub2', 'xxx.in'], "sub2/xxx.in\n")
-test.run(chdir = 'ten') # no arguments, use the Default
+test.run(chdir = 'ten') # no arguments, use the Default
test.fail_test(os.path.exists(test.workpath('ten', 'xxx.out')))
test.fail_test(test.read(test.workpath('ten', 'sub2', 'xxx.out')) != "sub2/xxx.in\n")
test.write(os.path.join('eleven', 'bar.in'), "eleven/bar.in\n");
-test.run(chdir = 'eleven') # no arguments, use the Default
+test.run(chdir = 'eleven') # no arguments, use the Default
test.fail_test(test.read(test.workpath('eleven', 'foo.out')) != "eleven/foo.in\n")
test.fail_test(os.path.exists(test.workpath('eleven', 'bar')))
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:4] != '#g77':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:length] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:length] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:4] != '#g77':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:5] != '#link':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:8] != '#fortran':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:4] != '#g77':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:8] != '#fortran':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
infile = open(sys.argv[3], 'rb')
for l in infile.readlines():
if l[:len(comment)] != comment:
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
outfile.write(optstring + "\n")
for l in infile.readlines():
if l[:8] != '#fortran':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
#include "resource.h"
class ATL_NO_VTABLE CBarObject :
- public CComObjectRootEx<CComSingleThreadModel>,
- public CComCoClass<CBarObject, &CLSID_BarObject>,
- public IDispatchImpl<IBarObject, &IID_IBarObject, &LIBID_BARLib>
+ public CComObjectRootEx<CComSingleThreadModel>,
+ public CComCoClass<CBarObject, &CLSID_BarObject>,
+ public IDispatchImpl<IBarObject, &IID_IBarObject, &LIBID_BARLib>
{
public:
- CBarObject()
- {
- }
+ CBarObject()
+ {
+ }
DECLARE_REGISTRY_RESOURCEID(IDR_BAROBJECT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CBarObject)
- COM_INTERFACE_ENTRY(IBarObject)
- COM_INTERFACE_ENTRY(IDispatch)
+ COM_INTERFACE_ENTRY(IBarObject)
+ COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
public:
test.write('src/BarObject.rgs',"""
HKCR
{
- Bar.BarObject.1 = s 'BarObject Class'
- {
- CLSID = s '{640BE9EC-B79D-4C9E-BB64-95D24854A303}'
- }
- Bar.BarObject = s 'BarObject Class'
- {
- CLSID = s '{640BE9EC-B79D-4C9E-BB64-95D24854A303}'
- CurVer = s 'Bar.BarObject.1'
- }
- NoRemove CLSID
- {
- ForceRemove {640BE9EC-B79D-4C9E-BB64-95D24854A303} = s 'BarObject Class'
- {
- ProgID = s 'Bar.BarObject.1'
- VersionIndependentProgID = s 'Bar.BarObject'
- ForceRemove 'Programmable'
- InprocServer32 = s '%MODULE%'
- {
- val ThreadingModel = s 'Apartment'
- }
- 'TypeLib' = s '{73E5EA5F-9D45-463F-AA33-9F376AF7B643}'
- }
- }
+ Bar.BarObject.1 = s 'BarObject Class'
+ {
+ CLSID = s '{640BE9EC-B79D-4C9E-BB64-95D24854A303}'
+ }
+ Bar.BarObject = s 'BarObject Class'
+ {
+ CLSID = s '{640BE9EC-B79D-4C9E-BB64-95D24854A303}'
+ CurVer = s 'Bar.BarObject.1'
+ }
+ NoRemove CLSID
+ {
+ ForceRemove {640BE9EC-B79D-4C9E-BB64-95D24854A303} = s 'BarObject Class'
+ {
+ ProgID = s 'Bar.BarObject.1'
+ VersionIndependentProgID = s 'Bar.BarObject'
+ ForceRemove 'Programmable'
+ InprocServer32 = s '%MODULE%'
+ {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{73E5EA5F-9D45-463F-AA33-9F376AF7B643}'
+ }
+ }
}
""")
LIBRARY "bar.DLL"
EXPORTS
- DllCanUnloadNow @1 PRIVATE
- DllGetClassObject @2 PRIVATE
- DllRegisterServer @3 PRIVATE
- DllUnregisterServer @4 PRIVATE
+ DllCanUnloadNow @1 PRIVATE
+ DllGetClassObject @2 PRIVATE
+ DllRegisterServer @3 PRIVATE
+ DllUnregisterServer @4 PRIVATE
''')
test.write('src/bar.idl','''
import "oaidl.idl";
import "ocidl.idl";
- [
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring("IBarObject Interface"),
- pointer_default(unique)
- ]
- interface IBarObject : IDispatch
- {
- };
+ [
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring("IBarObject Interface"),
+ pointer_default(unique)
+ ]
+ interface IBarObject : IDispatch
+ {
+ };
[
- uuid(73E5EA5F-9D45-463F-AA33-9F376AF7B643),
- version(1.0),
- helpstring("bar 1.0 Type Library")
+ uuid(73E5EA5F-9D45-463F-AA33-9F376AF7B643),
+ version(1.0),
+ helpstring("bar 1.0 Type Library")
]
library BARLib
{
- importlib("stdole32.tlb");
- importlib("stdole2.tlb");
-
- [
- uuid(640BE9EC-B79D-4C9E-BB64-95D24854A303),
- helpstring("BarObject Class")
- ]
- coclass BarObject
- {
- [default] interface IBarObject;
- };
+ importlib("stdole32.tlb");
+ importlib("stdole2.tlb");
+
+ [
+ uuid(640BE9EC-B79D-4C9E-BB64-95D24854A303),
+ helpstring("BarObject Class")
+ ]
+ coclass BarObject
+ {
+ [default] interface IBarObject;
+ };
};
''')
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("LEX\n");
- printf("aaa.l\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("LEX\n");
+ printf("aaa.l\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("LEX\n");
- printf("bbb.lex\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("LEX\n");
+ printf("bbb.lex\n");
+ exit (0);
}
""")
lex = r"""
%%%%
-a printf("A%sA");
-b printf("B%sB");
+a printf("A%sA");
+b printf("B%sB");
%%%%
int
yywrap()
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("LEXFLAGS\n");
- printf("aaa.l\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("LEXFLAGS\n");
+ printf("aaa.l\n");
+ exit (0);
}
""")
lex = r"""
%%%%
-a printf("A%sA");
-b printf("B%sB");
+a printf("A%sA");
+b printf("B%sB");
%%%%
int
yywrap()
void
f1(void)
{
- printf("f1.c\n");
+ printf("f1.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- f1();
- printf("prog.c\n");
+ argv[argc++] = "--";
+ f1();
+ printf("prog.c\n");
return 0;
}
""")
void
f1(void)
{
- printf("f1.c 1\n");
+ printf("f1.c 1\n");
}
""")
void
f1(void)
{
- printf("f1.c 2\n");
+ printf("f1.c 2\n");
}
""")
test = TestSCons.TestSCons()
-test.pass_test() #XXX Short-circuit until this is implemented.
+test.pass_test() #XXX Short-circuit until this is implemented.
test.write('SConstruct', """
""")
test.write('SConstruct', """
env = Environment(LIBPREFIX = 'xxx-',
- LIBPREFIXES = ['xxx-'])
+ LIBPREFIXES = ['xxx-'])
lib = env.Library(target = 'foo', source = 'foo.c')
env.Program(target = 'prog', source = ['prog.c', lib])
""")
void
foo(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- foo();
- printf("prog.c\n");
+ argv[argc++] = "--";
+ foo();
+ printf("prog.c\n");
return 0;
}
""")
test = TestSCons.TestSCons()
-test.pass_test() #XXX Short-circuit until this is implemented.
+test.pass_test() #XXX Short-circuit until this is implemented.
test.write('SConstruct', """
""")
test.write('SConstruct', """
env = Environment(LIBSUFFIX = '.xxx',
- LIBSUFFIXES = ['.xxx'])
+ LIBSUFFIXES = ['.xxx'])
lib = env.Library(target = 'foo', source = 'foo.c')
env.Program(target = 'prog', source = ['prog.c', lib])
""")
void
foo(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- foo();
- printf("prog.c\n");
+ argv[argc++] = "--";
+ foo();
+ printf("prog.c\n");
return 0;
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
void
test()
{
- printf("foo.c\n");
- fflush(stdout);
+ printf("foo.c\n");
+ fflush(stdout);
}
""")
void
test()
{
- printf("foo.c\n");
- fflush(stdout);
+ printf("foo.c\n");
+ fflush(stdout);
}
""")
void
test()
{
- printf("foo.c\n");
- fflush(stdout);
+ printf("foo.c\n");
+ fflush(stdout);
}
""")
void
test()
{
- printf("foo.c\n");
- fflush(stdout);
+ printf("foo.c\n");
+ fflush(stdout);
}
""")
void
f1(void)
{
- printf("f1.c\n");
+ printf("f1.c\n");
}
""")
void
f2a(void)
{
- printf("f2a.c\n");
+ printf("f2a.c\n");
}
""")
void
f2b(void)
{
- printf("f2b.c\n");
+ printf("f2b.c\n");
}
""")
void
f2c(void)
{
- printf("f2c.c\n");
+ printf("f2c.c\n");
}
""")
void
f3a(void)
{
- printf("f3a.c\n");
+ printf("f3a.c\n");
}
""")
void
f3b(void)
{
- printf("f3b.c\n");
+ printf("f3b.c\n");
}
""")
extern "C" void
f3c(void)
{
- printf("f3c.cpp\n");
+ printf("f3c.cpp\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- f1();
- f2a();
- f2b();
- f2c();
- f3a();
- f3b();
- f3c();
- printf("prog.c\n");
+ argv[argc++] = "--";
+ f1();
+ f2a();
+ f2b();
+ f2c();
+ f3a();
+ f3b();
+ f3c();
+ printf("prog.c\n");
return 0;
}
""")
void
f1(void)
{
- printf("f1.c\n");
+ printf("f1.c\n");
fflush(stdout);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
+ argv[argc++] = "--";
void *foo1_shobj = dlopen("__foo1_name__", RTLD_NOW);
- if(!foo1_shobj){
- printf("Error loading foo1 '__foo1_name__' library at runtime, exiting.\n");
- printf("%d\n", errno);
- perror("");
- return -1;
- }
- void (*f1)() = dlsym(foo1_shobj, "f1\0");
- (*f1)();
- printf("dlopenprog.c\n");
+ if(!foo1_shobj){
+ printf("Error loading foo1 '__foo1_name__' library at runtime, exiting.\n");
+ printf("%d\n", errno);
+ perror("");
+ return -1;
+ }
+ void (*f1)() = dlsym(foo1_shobj, "f1\0");
+ (*f1)();
+ printf("dlopenprog.c\n");
dlclose(foo1_shobj);
- return 0;
+ return 0;
}
"""
test.must_exist(test.workpath('work1', 'Test.vcproj'))
vcproj = test.read(['work1', 'Test.vcproj'], 'r')
expect = test.msvs_substitute(expected_vcprojfile, '7.0', 'work1', 'SConstruct',
- python=python)
+ python=python)
# don't compare the pickled data
assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
test.must_exist(test.workpath('work1', 'Test.vcproj'))
vcproj = test.read(['work1', 'Test.vcproj'], 'r')
expect = test.msvs_substitute(expected_vcprojfile, '7.1', 'work1', 'SConstruct',
- python=python)
+ python=python)
# don't compare the pickled data
assert vcproj[:len(expect)] == expect, test.diff_substr(expect, vcproj)
doIt()
{
#ifdef FOO
- printf("prog.cpp: FOO\n");
+ printf("prog.cpp: FOO\n");
#endif
#ifdef BAR
- printf("prog.cpp: BAR\n");
+ printf("prog.cpp: BAR\n");
#endif
}
""")
doIt()
{
#ifdef FOO
- printf("prog.cpp: %s\n", boo_sub());
+ printf("prog.cpp: %s\n", boo_sub());
#endif
}
""")
build_nodes = ['fooprog' + _exe,
dll_ + 'foo' + _dll,
- 'foo' + _obj,
+ 'foo' + _obj,
'barprog' + _exe,
- dll_ + 'bar' + _dll,
- 'bar' + _obj,
+ dll_ + 'bar' + _dll,
+ 'bar' + _obj,
'gooprog' + _exe,
void
f1(void)
{
- printf("f1.c\n");
+ printf("f1.c\n");
}
""")
void
f2(void)
{
- printf("f2.c\n");
+ printf("f2.c\n");
}
""")
void
f3(void)
{
- printf("f3.c\n");
+ printf("f3.c\n");
}
""")
void
f4(void)
{
- printf("f4.c\n");
+ printf("f4.c\n");
}
""")
void
f5(void)
{
- printf("f5.c\n");
+ printf("f5.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- f1();
- f2();
- f3();
- printf("prog.c\n");
- return 0;
+ argv[argc++] = "--";
+ f1();
+ f2();
+ f3();
+ printf("prog.c\n");
+ return 0;
}
""")
# We don't use self.run() because the TestCmd logic will hang
# waiting for the daemon to exit, even when we pass it
- # the -d option.
+ # the -d option.
try:
spawnv = os.spawnv
except AttributeError:
def substitute(self, s, **kw):
kw = kw.copy()
- kw.update(self.__dict__)
+ kw.update(self.__dict__)
return s % kw
def cleanup(self, condition = None):
if self.p4d:
self.p4('admin stop')
- self.p4d = None
+ self.p4d = None
- if TestSCons:
+ if TestSCons:
TestSCons.TestSCons.cleanup(self, condition)
test = TestPerforce()
test.write("minasm.asm", r"""
;
; MINASM.ASM - A minimal assembly language program which runs
-; under ToolSuite. You can use this program as a framework
-; for large assembly language programs.
+; under ToolSuite. You can use this program as a framework
+; for large assembly language programs.
;
.386
CGROUP group _TEXT, _CONST
DGROUP group _DATA, _bss
- assume cs:CGROUP,ds:DGROUP
+ assume cs:CGROUP,ds:DGROUP
_TEXT segment
;
; modify the loop count in memory verifies that it actually ends
; up in RAM.
;
- public _main
+ public _main
_main proc near
- mov cl,0ah ; Skip a line before we start
- call PutCharTarget ;
+ mov cl,0ah ; Skip a line before we start
+ call PutCharTarget ;
main_loop:
- cmp loopcount,0 ; Are we at the end of our loop?
- je short done_main ; yes.
- lea edx,rommessage ; EDX -> ROM message
- call WriteStringTarget ; Display it
- lea edx,rammessage ; EDX -> RAM message
- call WriteStringTarget ; Display it
- dec loopcount ;
- jmp main_loop ; Branch back for next loop iteration
+ cmp loopcount,0 ; Are we at the end of our loop?
+ je short done_main ; yes.
+ lea edx,rommessage ; EDX -> ROM message
+ call WriteStringTarget ; Display it
+ lea edx,rammessage ; EDX -> RAM message
+ call WriteStringTarget ; Display it
+ dec loopcount ;
+ jmp main_loop ; Branch back for next loop iteration
done_main:
- ret ; That's it!
+ ret ; That's it!
_main endp
; WriteStringTarget - Display a string on the target console
;
; Inputs:
-; EDX -> Null terminated ASCII string to display
+; EDX -> Null terminated ASCII string to display
;
; Outputs:
-; All registers preserved
+; All registers preserved
;
WriteStringTarget proc near
- push ecx ; Save registers
- push edx ;
+ push ecx ; Save registers
+ push edx ;
write_loop:
- movzx ecx,byte ptr [edx] ; Get a character
- jecxz done_str ; Branch if end of string
- call PutCharTarget ; Display this character
- inc edx ; Bump scan pointer
- jmp write_loop ; And loop back for next character
+ movzx ecx,byte ptr [edx] ; Get a character
+ jecxz done_str ; Branch if end of string
+ call PutCharTarget ; Display this character
+ inc edx ; Bump scan pointer
+ jmp write_loop ; And loop back for next character
done_str:
- pop edx ; Restore registers
- pop ecx ;
- ret ; and return
+ pop edx ; Restore registers
+ pop ecx ;
+ ret ; and return
WriteStringTarget endp
; the PutChar kernel service available through int 254.
;
; Inputs:
-; CL = character to display
+; CL = character to display
;
; Outputs:
-; All registers preserved
+; All registers preserved
;
PutCharTarget proc near
- push eax ; Save registers
- push ebx ;
- push edx ;
+ push eax ; Save registers
+ push ebx ;
+ push edx ;
- mov ax,254Ah ; Request Kernel Service
- mov bx,1 ; service code 1 = PutChar
- movzx edx,cl ; EDX = character to display
- int 0FEh ; Int 254 is for kernel services
+ mov ax,254Ah ; Request Kernel Service
+ mov bx,1 ; service code 1 = PutChar
+ movzx edx,cl ; EDX = character to display
+ int 0FEh ; Int 254 is for kernel services
- pop edx ; Restore registers
- pop ebx ;
- pop eax ;
- ret ; and return
+ pop edx ; Restore registers
+ pop ebx ;
+ pop eax ;
+ ret ; and return
PutCharTarget endp
;
public __p_start
__p_start proc near
- pushad ; save initial regs
- push es ;
- call __pl_unpackrom ; Call the unpacker
- cld ; Clear direction flag
-
- lea eax,__p_SEG__bss_END ; load end address and
- lea ebx,__p_SEG__bss_BEGIN ; subtract start to get size
- sub eax,ebx
- mov ecx,eax ; This is size
- inc ecx
- lea edi,__p_SEG__bss_BEGIN ; Zero from start address
- mov al,0 ;Zero out BSS and C_COMMON
- rep stosb
-
- pop es ; restore initial regs
- popad
- call _main ; go do some work
+ pushad ; save initial regs
+ push es ;
+ call __pl_unpackrom ; Call the unpacker
+ cld ; Clear direction flag
+
+ lea eax,__p_SEG__bss_END ; load end address and
+ lea ebx,__p_SEG__bss_BEGIN ; subtract start to get size
+ sub eax,ebx
+ mov ecx,eax ; This is size
+ inc ecx
+ lea edi,__p_SEG__bss_BEGIN ; Zero from start address
+ mov al,0 ;Zero out BSS and C_COMMON
+ rep stosb
+
+ pop es ; restore initial regs
+ popad
+ call _main ; go do some work
stopme:
xor eax,eax ; Call _EtsExitProcess(0)
- push eax ;
- call _EtsExitProcess ;
- pop eax ;
- jmp stopme ; .. in a loop just in case it ever
- ; comes back
+ push eax ;
+ call _EtsExitProcess ;
+ pop eax ;
+ jmp stopme ; .. in a loop just in case it ever
+ ; comes back
__p_start endp
TD_hack:
- mov eax, __p_tdhack ; force reference to TD-hack symbol
+ mov eax, __p_tdhack ; force reference to TD-hack symbol
_TEXT ends
;
-; Hack for Turbo Debugger/TDEMB - TD will fault if the .exe being
-; debugged doesn't have an import table. (TD looks for the address of
-; the table, then dereferences that address wihtout checking for NULL).
+; Hack for Turbo Debugger/TDEMB - TD will fault if the .exe being
+; debugged doesn't have an import table. (TD looks for the address of
+; the table, then dereferences that address wihtout checking for NULL).
;
-; This symbol, __p_tdhack, must be declared as an import in all the
-; .emb files shipped. IE:
+; This symbol, __p_tdhack, must be declared as an import in all the
+; .emb files shipped. IE:
;
-; -implib embkern.lib
-; -import __p_tdhack
+; -implib embkern.lib
+; -import __p_tdhack
;
-; This forces the creation of an import table within the .EXE.
+; This forces the creation of an import table within the .EXE.
_DATA segment
extrn __p_tdhack:dword
_DATA ends
- end __p_start
+ end __p_start
""")
test.write("foo.lnk","""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c\n");
+ exit (0);
}
""")
void
f2a(void)
{
- printf("f2a.c\n");
+ printf("f2a.c\n");
}
""")
void
f2b(void)
{
- printf("f2b.c\n");
+ printf("f2b.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- f2a();
- f2b();
- printf("f2c.c\n");
- exit (0);
+ argv[argc++] = "--";
+ f2a();
+ f2b();
+ printf("f2c.c\n");
+ exit (0);
}
""")
void
f3a(void)
{
- printf("f3a.c\n");
+ printf("f3a.c\n");
}
""")
void
f3b(void)
{
- printf("f3b.c\n");
+ printf("f3b.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- f3a();
- f3b();
- printf("f3c.c\n");
- exit (0);
+ argv[argc++] = "--";
+ f3a();
+ f3b();
+ printf("f3c.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f4.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f4.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo5.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo5.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c X\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c X\n");
+ exit (0);
}
""")
void
f3b(void)
{
- printf("f3b.c X\n");
+ printf("f3b.c X\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f4.c X\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f4.c X\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo5.c X\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo5.c X\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c Y\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c Y\n");
+ exit (0);
}
""")
void
f3b(void)
{
- printf("f3b.c Y\n");
+ printf("f3b.c Y\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f4.c Y\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f4.c Y\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo5.c Y\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo5.c Y\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c Z\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c Z\n");
+ exit (0);
}
""")
void
f3b(void)
{
- printf("f3b.c Z\n");
+ printf("f3b.c Z\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f4.c Z\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f4.c Z\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo5.c Z\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo5.c Z\n");
+ exit (0);
}
""")
void
library_function(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
void
library_function(void)
{
- printf("bar.c\n");
+ printf("bar.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- library_function();
- exit (0);
+ argv[argc++] = "--";
+ library_function();
+ exit (0);
}
""")
void
library_function(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
void
library_function(void)
{
- printf("bar.c\n");
+ printf("bar.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- library_function();
- exit (0);
+ argv[argc++] = "--";
+ library_function();
+ exit (0);
}
""")
test.subdir('repository',
['repository', 'include1'],
['repository', 'include2'],
- 'work')
+ 'work')
work_foo = test.workpath('work', 'foo')
#
test.write(['repository', 'include1', 'foo.h'], r"""
-#define STRING "repository/include1/foo.h"
+#define STRING "repository/include1/foo.h"
""")
test.write(['repository', 'include2', 'foo.h'], r"""
-#define STRING "repository/include2/foo.h"
+#define STRING "repository/include2/foo.h"
""")
test.write(['repository', 'foo.c'], r"""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("%s\n", STRING);
- exit (0);
+ argv[argc++] = "--";
+ printf("%s\n", STRING);
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("work/aaa.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("work/aaa.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("work/bbb.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("work/bbb.c\n");
+ exit (0);
}
""")
void
aaa(void)
{
- printf("repository/aaa.c\n");
+ printf("repository/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("repository/bbb.c\n");
+ printf("repository/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("repository/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("repository/foo.c\n");
+ exit (0);
}
""")
void
bbb(void)
{
- printf("work1/bbb.c\n");
+ printf("work1/bbb.c\n");
}
""")
void
aaa(void)
{
- printf("work1/aaa.c\n");
+ printf("work1/aaa.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("work1/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("work1/foo.c\n");
+ exit (0);
}
""")
void
aaa(void)
{
- printf("repository.old/aaa.c\n");
+ printf("repository.old/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("repository.old/bbb.c\n");
+ printf("repository.old/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("repository.old/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("repository.old/foo.c\n");
+ exit (0);
}
""")
void
aaa(void)
{
- printf("repository.new/aaa.c\n");
+ printf("repository.new/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("work2/bbb.c\n");
+ printf("work2/bbb.c\n");
}
""")
void
aaa(void)
{
- printf("work2/aaa.c\n");
+ printf("work2/aaa.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("work2/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("work2/foo.c\n");
+ exit (0);
}
""")
void
aaa(void)
{
- printf("repository/aaa.c\n");
+ printf("repository/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("repository/bbb.c\n");
+ printf("repository/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("repository/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("repository/foo.c\n");
+ exit (0);
}
""")
void
bbb(void)
{
- printf("work1/bbb.c\n");
+ printf("work1/bbb.c\n");
}
""")
void
bbb(void)
{
- printf("work2/bbb.c\n");
+ printf("work2/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("work3/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("work3/foo.c\n");
+ exit (0);
}
""")
test.subdir('repository',
['repository', 'src'],
'subdir',
- 'work')
+ 'work')
src_SConscript = os.path.join('src', 'SConscript')
subdir_aaa_c = test.workpath('subdir', 'aaa.c')
void
src_aaa(void)
{
- printf("repository/src/aaa.c\n");
+ printf("repository/src/aaa.c\n");
}
""")
void
subdir_aaa(void)
{
- printf("subdir/aaa.c\n");
+ printf("subdir/aaa.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- src_aaa();
- subdir_aaa();
- printf("repository/src/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ src_aaa();
+ subdir_aaa();
+ printf("repository/src/foo.c\n");
+ exit (0);
}
""")
""" % repository)
test.write(['repository', 'foo.h'], r"""
-#define STRING1 "repository/foo.h"
+#define STRING1 "repository/foo.h"
#include <bar.h>
""")
test.write(['repository', 'bar.h'], r"""
-#define STRING2 "repository/bar.h"
+#define STRING2 "repository/bar.h"
""")
test.write(['repository', 'foo.c'], r"""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("%s\n", STRING1);
- printf("%s\n", STRING2);
- printf("repository/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("%s\n", STRING1);
+ printf("%s\n", STRING2);
+ printf("repository/foo.c\n");
+ exit (0);
}
""")
#
test.write(['work', 'foo.h'], r"""
-#define STRING1 "work/foo.h"
+#define STRING1 "work/foo.h"
#include <bar.h>
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("%s\n", STRING1);
- printf("%s\n", STRING2);
- printf("work/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("%s\n", STRING1);
+ printf("%s\n", STRING2);
+ printf("work/foo.c\n");
+ exit (0);
}
""")
#
test.write(['work', 'bar.h'], r"""
-#define STRING2 "work/bar.h"
+#define STRING2 "work/bar.h"
""")
test.run(chdir = 'work', arguments = '.')
void
aaa(void)
{
- printf("repository/aaa.c\n");
+ printf("repository/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("repository/bbb.c\n");
+ printf("repository/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("repository/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("repository/foo.c\n");
+ exit (0);
}
""")
void
bbb(void)
{
- printf("work/bbb.c\n");
+ printf("work/bbb.c\n");
}
""")
""")
test.write(['repository', 'include', 'my_string.h'], r"""
-#define MY_STRING "repository/include/my_string.h"
+#define MY_STRING "repository/include/my_string.h"
""")
test.write(['repository', 'src', 'include.h'], r"""
#include <my_string.h>
-#define LOCAL_STRING "repository/src/include.h"
+#define LOCAL_STRING "repository/src/include.h"
""")
test.write(['repository', 'src', 'main.c'], r"""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("%s\n", MY_STRING);
- printf("%s\n", LOCAL_STRING);
- printf("repository/src/main.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("%s\n", MY_STRING);
+ printf("%s\n", LOCAL_STRING);
+ printf("repository/src/main.c\n");
+ exit (0);
}
""")
#
test.write(['work', 'include', 'my_string.h'], r"""
-#define MY_STRING "work/include/my_string.h"
+#define MY_STRING "work/include/my_string.h"
""")
test.run(chdir = 'work', options = opts, arguments = ".")
test.write(['work', 'src', 'include.h'], r"""
#include <my_string.h>
-#define LOCAL_STRING "work/src/include.h"
+#define LOCAL_STRING "work/src/include.h"
""")
test.run(chdir = 'work', options = opts, arguments = ".")
void
aaa(void)
{
- printf("work/aaa.c\n");
+ printf("work/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("work/bbb.c\n");
+ printf("work/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("work/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("work/foo.c\n");
+ exit (0);
}
""")
""" % repository)
foo_h_contents = """\
-#define STRING1 "foo.h"
+#define STRING1 "foo.h"
"""
bar_h_contents = """\
-#define STRING2 "bar.h"
+#define STRING2 "bar.h"
"""
test.write(['repository', 'foo.h'], foo_h_contents)
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("%s\n", STRING1);
- printf("%s\n", STRING2);
- printf("repository/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("%s\n", STRING1);
+ printf("%s\n", STRING2);
+ printf("repository/foo.c\n");
+ exit (0);
}
""")
test.subdir('repository',
['repository', 'src'],
['repository', 'subdir'],
- 'work')
+ 'work')
src_SConscript = os.path.join('src', 'SConscript')
work_src_foo = test.workpath('work', 'src', 'foo' + _exe)
void
src_aaa(void)
{
- printf("repository/src/aaa.c\n");
+ printf("repository/src/aaa.c\n");
}
""")
void
subdir_aaa(void)
{
- printf("repository/subdir/aaa.c\n");
+ printf("repository/subdir/aaa.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- src_aaa();
- subdir_aaa();
- printf("repository/src/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ src_aaa();
+ subdir_aaa();
+ printf("repository/src/foo.c\n");
+ exit (0);
}
""")
['repository', 'src2', 'include'],
['repository', 'src2', 'xxx'],
['repository', 'build2'],
- ['repository', 'build2', 'foo'],
+ ['repository', 'build2', 'foo'],
['repository', 'build2', 'bar'],
'work1',
['work1', 'src1'],
""")
test.write(['repository', 'src1', 'iii.h'], r"""
-#ifdef FOO
-#define STRING "REPOSITORY_FOO"
+#ifdef FOO
+#define STRING "REPOSITORY_FOO"
#endif
-#ifdef BAR
-#define STRING "REPOSITORY_BAR"
+#ifdef BAR
+#define STRING "REPOSITORY_BAR"
#endif
""")
void
aaa(void)
{
- printf("repository/src1/aaa.c: %s\n", STRING);
+ printf("repository/src1/aaa.c: %s\n", STRING);
}
""")
void
bbb(void)
{
- printf("repository/src1/bbb.c: %s\n", STRING);
+ printf("repository/src1/bbb.c: %s\n", STRING);
}
""")
int
main(int argc, char *argv[])
{
-#ifdef BAR
- printf("Only when -DBAR.\n");
+#ifdef BAR
+ printf("Only when -DBAR.\n");
#endif
- aaa();
- bbb();
- printf("repository/src1/main.c: %s\n", STRING);
- exit (0);
+ aaa();
+ bbb();
+ printf("repository/src1/main.c: %s\n", STRING);
+ exit (0);
}
""")
test.write(['repository', 'src2', 'include', 'my_string.h'], r"""
-#ifdef FOO
-#define INCLUDE_OS "FOO"
+#ifdef FOO
+#define INCLUDE_OS "FOO"
#endif
-#ifdef BAR
-#define INCLUDE_OS "BAR"
+#ifdef BAR
+#define INCLUDE_OS "BAR"
#endif
-#define INCLUDE_STRING "repository/src2/include/my_string.h: %s\n"
+#define INCLUDE_STRING "repository/src2/include/my_string.h: %s\n"
""")
test.write(['repository', 'src2', 'xxx', 'include.h'], r"""
#include <my_string.h>
-#ifdef FOO
-#define XXX_OS "FOO"
+#ifdef FOO
+#define XXX_OS "FOO"
#endif
-#ifdef BAR
-#define XXX_OS "BAR"
+#ifdef BAR
+#define XXX_OS "BAR"
#endif
-#define XXX_STRING "repository/src2/xxx/include.h: %s\n"
+#define XXX_STRING "repository/src2/xxx/include.h: %s\n"
""")
test.write(['repository', 'src2', 'xxx', 'main.c'], r"""
#include <include.h>
-#ifdef FOO
-#define MAIN_OS "FOO"
+#ifdef FOO
+#define MAIN_OS "FOO"
#endif
-#ifdef BAR
-#define MAIN_OS "BAR"
+#ifdef BAR
+#define MAIN_OS "BAR"
#endif
main()
{
- printf(INCLUDE_STRING, INCLUDE_OS);
- printf(XXX_STRING, XXX_OS);
- printf("repository/src2/xxx/main.c: %s\n", MAIN_OS);
- exit (0);
+ printf(INCLUDE_STRING, INCLUDE_OS);
+ printf(XXX_STRING, XXX_OS);
+ printf("repository/src2/xxx/main.c: %s\n", MAIN_OS);
+ exit (0);
}
""")
time.sleep(2)
test.write(['work1', 'src1', 'iii.h'], r"""
-#ifdef FOO
-#define STRING "WORK_FOO"
+#ifdef FOO
+#define STRING "WORK_FOO"
#endif
-#ifdef BAR
-#define STRING "WORK_BAR"
+#ifdef BAR
+#define STRING "WORK_BAR"
#endif
""")
time.sleep(2)
test.write(['work2', 'src2', 'include', 'my_string.h'], r"""
-#ifdef FOO
-#define INCLUDE_OS "FOO"
+#ifdef FOO
+#define INCLUDE_OS "FOO"
#endif
-#ifdef BAR
-#define INCLUDE_OS "BAR"
+#ifdef BAR
+#define INCLUDE_OS "BAR"
#endif
-#define INCLUDE_STRING "work2/src2/include/my_string.h: %s\n"
+#define INCLUDE_STRING "work2/src2/include/my_string.h: %s\n"
""")
#
test.write(['work2', 'src2', 'xxx', 'include.h'], r"""
#include <my_string.h>
-#ifdef FOO
-#define XXX_OS "FOO"
+#ifdef FOO
+#define XXX_OS "FOO"
#endif
-#ifdef BAR
-#define XXX_OS "BAR"
+#ifdef BAR
+#define XXX_OS "BAR"
#endif
-#define XXX_STRING "work2/src2/xxx/include.h: %s\n"
+#define XXX_STRING "work2/src2/xxx/include.h: %s\n"
""")
test.run(chdir = 'work2', options = opts, arguments = 'build2')
void
aaa(void)
{
- printf("repository/aaa.c\n");
+ printf("repository/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("repository/bbb.c\n");
+ printf("repository/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("repository/foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("repository/foo.c\n");
+ exit (0);
}
""")
void
aaa(void)
{
- printf("repository/src/aaa.c\n");
+ printf("repository/src/aaa.c\n");
}
""")
void
bbb(void)
{
- printf("repository/src/bbb.c\n");
+ printf("repository/src/bbb.c\n");
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- aaa();
- bbb();
- printf("repository/src/bar.c\n");
- exit (0);
+ argv[argc++] = "--";
+ aaa();
+ bbb();
+ printf("repository/src/bar.c\n");
+ exit (0);
}
""")
void
foo(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
void
foo(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
}
""")
outfile = open(out, 'wb')
for l in infile.readlines():
if l[:4] != 'swig':
- outfile.write(l)
+ outfile.write(l)
sys.exit(0)
""")
test.write('test1.i', r"""
int
main(int argc, char *argv[]) {
- argv[argc++] = "--";
- printf("test1.i\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("test1.i\n");
+ exit (0);
}
swig
""")
#include <stdlib.h>
int
main(int argc, char *argv[]) {
- argv[argc++] = "--";
- printf("test3.i\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("test3.i\n");
+ exit (0);
}
swig
""")
void
f1(void)
{
- printf("foo.c\n");
+ printf("foo.c\n");
fflush(stdout);
}
""")
void
f1(void)
{
- printf("f1.c\n");
+ printf("f1.c\n");
fflush(stdout);
}
""")
void
f2a(void)
{
- printf("f2a.c\n");
+ printf("f2a.c\n");
}
""")
void
f2b(void)
{
- printf("f2b.c\n");
+ printf("f2b.c\n");
}
""")
void
f2c(void)
{
- printf("f2c.c\n");
+ printf("f2c.c\n");
fflush(stdout);
}
""")
void
f3a(void)
{
- printf("f3a.c\n");
+ printf("f3a.c\n");
}
""")
void
f3b(void)
{
- printf("f3b.c\n");
+ printf("f3b.c\n");
}
""")
void
f3c(void)
{
- printf("f3c.c\n");
+ printf("f3c.c\n");
fflush(stdout);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- f1();
- f2a();
- f2b();
- f2c();
- f3a();
- f3b();
- f3c();
- printf("prog.c\n");
+ argv[argc++] = "--";
+ f1();
+ f2a();
+ f2b();
+ f2c();
+ f3a();
+ f3b();
+ f3c();
+ printf("prog.c\n");
return 0;
}
""")
list = os.listdir(name)
list.sort()
for entry in list:
- process(outfile, os.path.join(name, entry))
+ process(outfile, os.path.join(name, entry))
else:
outfile.write(open(name, 'rb').read())
outfile = open(out, 'wb')
entries = os.listdir(name)
entries.sort()
for entry in entries:
- process(outfile, os.path.join(name, entry))
+ process(outfile, os.path.join(name, entry))
else:
outfile.write(open(name, 'rb').read())
outfile = open(out, 'wb')
foo = Environment()
tar = foo['TAR']
bar = Environment(TAR = '',
- TARFLAGS = r'%s wrapper.py ' + tar + ' -c -b 1')
+ TARFLAGS = r'%s wrapper.py ' + tar + ' -c -b 1')
foo.Tar(target = 'foo.tar', source = ['file10', 'file11'])
foo.Tar(target = 'foo.tar', source = 'file12')
bar.Tar(target = 'bar.tar', source = ['file13', 'file14'])
out_file = open(base_name+'.dvi', 'wb')
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
out_file.write(opt_string + "\n")
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
out_file = open(base_name+'.pdf', 'wb')
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
out_file.write(opt_string + "\n")
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
out_file = open(base_name+'.pdf', 'wb')
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
out_file.write(opt_string + "\n")
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
out_file = open(base_name+'.dvi', 'wb')
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
bib = r"""
@Book{lamport,
- author = {L. Lamport},
- title = {{\LaTeX: A} Document Preparation System},
- publisher = {Addison-Wesley},
- year = 1994
+ author = {L. Lamport},
+ title = {{\LaTeX: A} Document Preparation System},
+ publisher = {Addison-Wesley},
+ year = 1994
}
"""
out_file.write(opt_string + "\n")
for l in infile.readlines():
if l[0] != '\\':
- out_file.write(l)
+ out_file.write(l)
sys.exit(0)
""")
test.workpath(sub3_xxx_exe),
test.workpath(sub4_xxx_exe),
test.workpath(sub3_xxx_exe),
- ]
+ ]
test.run(arguments = ".",
stdout = test.wrap_stdout(read_str = string.join(expect, "\n") + "\n",
test.workpath(sub3_xxx_exe),
test.workpath(sub4_xxx_exe),
test.workpath(sub3_xxx_exe),
- ]
+ ]
test.run(arguments = ".",
stdout = test.wrap_stdout(read_str = string.join(expect, "\n") + "\n",
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("YACC\n");
- printf("aaa.y\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("YACC\n");
+ printf("aaa.y\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("YACC\n");
- printf("bbb.yacc\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("YACC\n");
+ printf("bbb.yacc\n");
+ exit (0);
}
""")
}
%%}
%%%%
-input: letter newline { printf("%s\n"); };
+input: letter newline { printf("%s\n"); };
letter: 'a' | 'b';
newline: '\n';
"""
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("YACCFLAGS\n");
- printf("aaa.y\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("YACCFLAGS\n");
+ printf("aaa.y\n");
+ exit (0);
}
""")
}
%%}
%%%%
-input: letter newline { printf("%s\n"); };
+input: letter newline { printf("%s\n"); };
letter: 'a' | 'b';
newline: '\n';
"""
list = os.listdir(name)
list.sort()
for entry in list:
- process(outfile, os.path.join(name, entry))
+ process(outfile, os.path.join(name, entry))
else:
outfile.write(open(name, 'rb').read())
outfile = open(sys.argv[1], 'wb')
""" % string.replace(no_such_file, '\\', '\\\\'))
test.run(arguments='-f SConstruct1 .',
- stdout = test.wrap_stdout("%s f1.in f1\n" % no_such_file, error=1),
+ stdout = test.wrap_stdout("%s f1.in f1\n" % no_such_file, error=1),
stderr = None,
status = 2)
""" % string.replace(not_executable, '\\', '\\\\'))
test.run(arguments='-f SConstruct2 .',
- stdout = test.wrap_stdout("%s f2.in f2\n" % not_executable, error=1),
+ stdout = test.wrap_stdout("%s f2.in f2\n" % not_executable, error=1),
stderr = None,
status = 2)
""" % string.replace(test.workdir, '\\', '\\\\'))
test.run(arguments='-f SConstruct3 .',
- stdout = test.wrap_stdout("%s f3.in f3\n" % test.workdir, error=1),
+ stdout = test.wrap_stdout("%s f3.in f3\n" % test.workdir, error=1),
stderr = None,
status = 2)
""")
test.run(stdout = "scons: Reading SConscript files ...\n",
- stderr = """ File "SConstruct", line 2
+ stderr = """ File "SConstruct", line 2
a ! x
""")
test.run(stdout = "scons: Reading SConscript files ...\n",
- stderr = """
+ stderr = """
scons: \*\*\* Depends\(\) require both sources and targets.
File "SConstruct", line 4, in \?
""", status=2)
""")
test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n",
- stderr = r"""Traceback \((most recent call|innermost) last\):
+ stderr = r"""Traceback \((most recent call|innermost) last\):
File ".+", line \d+, in .+
File ".+", line \d+, in .+
File ".+", line \d+, in .+
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("sub/f1.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("sub/f1.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f2.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f2.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("sub/f3.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("sub/f3.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("sub/foo4.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("sub/foo4.c\n");
+ exit (0);
}
""")
if not bad_char(c):
if c in '$':
c = '\\' + c
- infile = "in" + c + "in"
+ infile = "in" + c + "in"
env.Command(c + "out", infile, "cp $SOURCE $TARGET")
env.Command("out" + c + "out", infile, "cp $SOURCE $TARGET")
env.Command("out" + c, infile, "cp $SOURCE $TARGET")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("foo.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("foo.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("static.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("static.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("shared.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("shared.c\n");
+ exit (0);
}
""")
test.write('file4a.in', 'file4a.in\n')
test.write('file4b.in', 'file4b.in\n')
+python_expr = string.replace(TestSCons.python, '\\', '\\\\')
+act = TestSCons.re_escape('%s build.py \$foo \$TARGET \$SOURCES' % python_expr)
+
test.run(arguments='file4.out',
- stderr=TestSCons.re_escape("""
+ stderr=("""
scons: warning: Two different environments were specified for target file4.out,
- but they appear to have the same action: %(python)s build.py \$foo \$TARGET \$SOURCES
-""" % {'python':string.replace(TestSCons.python, '\\', '\\\\')}) + TestSCons.file_expr)
+\tbut they appear to have the same action: %s
+""" % act) + TestSCons.file_expr)
test.must_match('file4.out', "3\nfile4a.in\nfile4b.in\n")
test.run(arguments='file5.out',
stderr=TestSCons.re_escape("""
scons: warning: Two different environments were specified for target file5.out,
- but they appear to have the same action: build(target, source, env)
+\tbut they appear to have the same action: build(target, source, env)
""") + TestSCons.file_expr)
test.must_match('file5.out', "file5a.in\nfile5b.in\n")
""")
test.run(arguments = '-C sub .',
- stdout = test.wrap_stdout(read_str = '%s\n' % wpath,
- build_str = "scons: `.' is up to date.\n"))
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath,
+ build_str = "scons: `.' is up to date.\n"))
test.run(arguments = '-C sub -C dir .',
- stdout = test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
- build_str = "scons: `.' is up to date.\n"))
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
+ build_str = "scons: `.' is up to date.\n"))
test.run(arguments = ".",
- stdout = test.wrap_stdout(read_str = 'SConstruct %s\n' % wpath,
- build_str = "scons: `.' is up to date.\n"))
+ stdout = test.wrap_stdout(read_str = 'SConstruct %s\n' % wpath,
+ build_str = "scons: `.' is up to date.\n"))
test.run(arguments = '--directory=sub/dir .',
- stdout = test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
- build_str = "scons: `.' is up to date.\n"))
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
+ build_str = "scons: `.' is up to date.\n"))
test.run(arguments = '-C %s -C %s .' % (wpath_sub_dir, wpath_sub),
- stdout = test.wrap_stdout(read_str = '%s\n' % wpath,
- build_str = "scons: `.' is up to date.\n"))
+ stdout = test.wrap_stdout(read_str = '%s\n' % wpath,
+ build_str = "scons: `.' is up to date.\n"))
test.pass_test()
test.run(arguments = '-I sub1 -I sub2 .',
stdout = test.wrap_stdout(read_str = 'sub1/foo\nsub2/bar\n',
- build_str = "scons: `.' is up to date.\n"))
+ build_str = "scons: `.' is up to date.\n"))
test.run(arguments = '--include-dir=sub2 --include-dir=sub1 .',
- stdout = test.wrap_stdout(read_str = 'sub2/foo\nsub2/bar\n',
- build_str = "scons: `.' is up to date.\n"))
+ stdout = test.wrap_stdout(read_str = 'sub2/foo\nsub2/bar\n',
+ build_str = "scons: `.' is up to date.\n"))
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-R .',
- stderr = "Warning: the -R option is not yet implemented\n")
+ stderr = "Warning: the -R option is not yet implemented\n")
test.run(arguments = '--no-builtin-variables .',
- stderr = "Warning: the --no-builtin-variables option is not yet implemented\n")
+ stderr = "Warning: the --no-builtin-variables option is not yet implemented\n")
test.pass_test()
test.run(arguments = '-S .', stderr = "Warning: ignoring -S option\n")
test.run(arguments = '--no-keep-going .',
- stderr = "Warning: ignoring --no-keep-going option\n")
+ stderr = "Warning: ignoring --no-keep-going option\n")
test.run(arguments = '--stop .', stderr = "Warning: ignoring --stop option\n")
test.write('SConstruct', "")
test.run(arguments = '-W foo .',
- stderr = "Warning: the -W option is not yet implemented\n")
+ stderr = "Warning: the -W option is not yet implemented\n")
test.run(arguments = '--what-if=foo .',
- stderr = "Warning: the --what-if option is not yet implemented\n")
+ stderr = "Warning: the --what-if option is not yet implemented\n")
test.run(arguments = '--new-file=foo .',
- stderr = "Warning: the --new-file option is not yet implemented\n")
+ stderr = "Warning: the --new-file option is not yet implemented\n")
test.run(arguments = '--assume-new=foo .',
- stderr = "Warning: the --assume-new option is not yet implemented\n")
+ stderr = "Warning: the --assume-new option is not yet implemented\n")
test.pass_test()
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("src2/hello.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("src2/hello.c\n");
+ exit (0);
}
""")
#include "foo.h"
int main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c\n");
+ exit (0);
}
""")
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 1\n"
+#define FOO_STRING "include/foo.h 1\n"
#include <bar.h>
""")
test.write(['subdir', 'include', 'foo.h'],
r"""
-#define FOO_STRING "subdir/include/foo.h 1\n"
+#define FOO_STRING "subdir/include/foo.h 1\n"
#include "bar.h"
""")
# Make sure implicit dependenies work right when one is modifed:
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 2\n"
+#define FOO_STRING "include/foo.h 2\n"
#include "bar.h"
""")
# doesn't produce redundant rebuilds:
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 2\n"
+#define FOO_STRING "include/foo.h 2\n"
#include "bar.h"
#include "baz.h"
""")
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 2\n"
+#define FOO_STRING "include/foo.h 2\n"
#include "baz.h"
#include "bar.h"
""")
# Now modifying include/foo.h should make scons aware of inc2/foo.h
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 3\n"
+#define FOO_STRING "include/foo.h 3\n"
#include "bar.h"
""")
# Test forcing of implicit caching:
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 3\n"
+#define FOO_STRING "include/foo.h 3\n"
#include "bar.h"
""")
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 3\n"
+#define FOO_STRING "include/foo.h 3\n"
#include "baz.h"
#include "bar.h"
""")
# Test forcing rescanning:
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 3\n"
+#define FOO_STRING "include/foo.h 3\n"
#include "bar.h"
""")
test.write(['include', 'foo.h'],
r"""
-#define FOO_STRING "include/foo.h 3\n"
+#define FOO_STRING "include/foo.h 3\n"
#include "baz.h"
#include "bar.h"
""")
test.write('SConstruct', "")
test.run(arguments = '--list-actions .',
- stderr = "Warning: the --list-actions option is not yet implemented\n")
+ stderr = "Warning: the --list-actions option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '--list-derived .',
- stderr = "Warning: the --list-derived option is not yet implemented\n")
+ stderr = "Warning: the --list-derived option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '--list-where .',
- stderr = "Warning: the --list-where option is not yet implemented\n")
+ stderr = "Warning: the --list-where option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '--no-print-directory .',
- stderr = "Warning: the --no-print-directory option is not yet implemented\n")
+ stderr = "Warning: the --no-print-directory option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '--override=foo .',
- stderr = "Warning: the --override option is not yet implemented\n")
+ stderr = "Warning: the --override option is not yet implemented\n")
test.pass_test()
test.run(arguments='file1.out',
stderr=r"""
scons: warning: Two different environments were specified for target file1.out,
- but they appear to have the same action: build\(target, source, env\)
+\tbut they appear to have the same action: build\(target, source, env\)
""" + TestSCons.file_expr)
test.must_match('file1.out', "file1a.in\nfile1b.in\n")
test.run(arguments='--warn=duplicate-environment file1.out',
stderr=r"""
scons: warning: Two different environments were specified for target file1.out,
- but they appear to have the same action: build\(target, source, env\)
+\tbut they appear to have the same action: build\(target, source, env\)
""" + TestSCons.file_expr)
test.run(arguments='--warn=no-duplicate-environment file1.out')
test.write('SConstruct', "")
test.run(arguments = '--write-filenames=FILE .',
- stderr = "Warning: the --write-filenames option is not yet implemented\n")
+ stderr = "Warning: the --write-filenames option is not yet implemented\n")
test.pass_test()
# control. The getopt module reports "--warn not a unique prefix"
# when both are defined. We may be able to support both in the
# future with a more robust getopt solution.
-test.pass_test() #XXX Short-circuit until then.
+test.pass_test() #XXX Short-circuit until then.
test.write('SConstruct', "")
test.run(arguments = '--warn-undefined-variables',
- stderr = "Warning: the --warn-undefined-variables option is not yet implemented\n")
+ stderr = "Warning: the --warn-undefined-variables option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-b .',
- stderr = "Warning: ignoring -b option\n")
+ stderr = "Warning: ignoring -b option\n")
test.pass_test()
test = TestSCons.TestSCons()
-test.pass_test() #XXX Short-circuit until this is supported.
+test.pass_test() #XXX Short-circuit until this is supported.
test.subdir('subdir')
int
main(int argc, char *argv)
{
- argv[argc++] = "--";
- printf("aaa.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("aaa.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv)
{
- argv[argc++] = "--";
- printf("bbb.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("bbb.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv)
{
- argv[argc++] = "--";
- printf("subdir/ccc.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("subdir/ccc.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv)
{
- argv[argc++] = "--";
- printf("subdir/ddd.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("subdir/ddd.c\n");
+ exit (0);
}
""")
test.write('SConstruct', "")
test.run(arguments = '-e .',
- stderr = "Warning: the -e option is not yet implemented\n")
+ stderr = "Warning: the -e option is not yet implemented\n")
test.run(arguments = '--environment-overrides .',
- stderr = "Warning: the --environment-overrides option is not yet implemented\n")
+ stderr = "Warning: the --environment-overrides option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-l 1 .',
- stderr = "Warning: the -l option is not yet implemented\n")
+ stderr = "Warning: the -l option is not yet implemented\n")
test.run(arguments = '--load-average=1 .',
- stderr = "Warning: the --load-average option is not yet implemented\n")
+ stderr = "Warning: the --load-average option is not yet implemented\n")
test.run(arguments = '--max-load=1 .',
- stderr = "Warning: the --max-load option is not yet implemented\n")
+ stderr = "Warning: the --max-load option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-m .',
- stderr = "Warning: ignoring -m option\n")
+ stderr = "Warning: ignoring -m option\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-o foo .',
- stderr = "Warning: the -o option is not yet implemented\n")
+ stderr = "Warning: the -o option is not yet implemented\n")
test.run(arguments = '--old-file=foo .',
- stderr = "Warning: the --old-file option is not yet implemented\n")
+ stderr = "Warning: the --old-file option is not yet implemented\n")
test.run(arguments = '--assume-old=foo .',
- stderr = "Warning: the --assume-old option is not yet implemented\n")
+ stderr = "Warning: the --assume-old option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-p .',
- stderr = "Warning: the -p option is not yet implemented\n")
+ stderr = "Warning: the -p option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-r .',
- stderr = "Warning: the -r option is not yet implemented\n")
+ stderr = "Warning: the -r option is not yet implemented\n")
test.run(arguments = '--no-builtin-rules .',
- stderr = "Warning: the --no-builtin-rules option is not yet implemented\n")
+ stderr = "Warning: the --no-builtin-rules option is not yet implemented\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-t .',
- stderr = "Warning: ignoring -t option\n")
+ stderr = "Warning: ignoring -t option\n")
test.run(arguments = '--touch .',
- stderr = "Warning: ignoring --touch option\n")
+ stderr = "Warning: ignoring --touch option\n")
test.pass_test()
test.write('SConstruct', "")
test.run(arguments = '-w .',
- stderr = "Warning: the -w option is not yet implemented\n")
+ stderr = "Warning: the -w option is not yet implemented\n")
test.run(arguments = '--print-directory .',
- stderr = "Warning: the --print-directory option is not yet implemented\n")
+ stderr = "Warning: the --print-directory option is not yet implemented\n")
test.pass_test()
#include "foo.h"
int main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c\n");
+ exit (0);
}
""")
#include "foo.h"
int main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c\n");
+ exit (0);
}
""")
#include "foo.h"
int main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c\n");
+ exit (0);
}
""")
#include "Foo.h"
int main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("f1.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("f1.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
+ argv[argc++] = "--";
bu();
- printf("foo.c\n");
- exit (0);
+ printf("foo.c\n");
+ exit (0);
}
""")
function = scan,
argument = None,
scan_check = exists_check,
- skeys = ['.x'])
+ skeys = ['.x'])
def echo(env, target, source):
t = os.path.split(str(target[0]))[1]
Echo = Builder(action = Action(echo, None),
src_suffix = '.x',
- suffix = '.x')
+ suffix = '.x')
env = Environment(BUILDERS = {'Echo':Echo}, SCANNERS = [XScanner])
builders["StaticLibMerge"] = BStaticLibMerge
env = Environment(BUILDERS = builders)
-e = env.Dictionary() # Slightly easier to type
+e = env.Dictionary() # Slightly easier to type
global_env = env
e["GlobalEnv"] = global_env
class MyTestSCons(TestSCons.TestSCons):
# subclass with a method for running the sconsign script
def __init__(self, *args, **kw):
- apply(TestSCons.TestSCons.__init__, (self,)+args, kw)
- self.my_kw = {
+ apply(TestSCons.TestSCons.__init__, (self,)+args, kw)
+ self.my_kw = {
'interpreter' : TestSCons.python,
- 'program' : sconsign,
- }
+ 'program' : sconsign,
+ }
def run_sconsign(self, *args, **kw):
kw.update(self.my_kw)
return apply(self.run, args, kw)
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("sub1/hello.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("sub1/hello.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("sub2/goodbye.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("sub2/goodbye.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("sub1/hello.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("sub1/hello.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("sub2/goodbye.c\n");
- exit (0);
+ argv[argc++] = "--";
+ printf("sub2/goodbye.c\n");
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("%s\n", STRING);
- exit (0);
+ argv[argc++] = "--";
+ printf("%s\n", STRING);
+ exit (0);
}
""")
int
main(int argc, char *argv[])
{
- argv[argc++] = "--";
- printf("%s\n", STRING);
- exit (0);
+ argv[argc++] = "--";
+ printf("%s\n", STRING);
+ exit (0);
}
""")
env.Dict('dict8.out', 'dict8.liststr')
""" % (python, python, python, python))
-test.write('func.in', "func.in\n")
-test.write('funcstr.in', "funcstr.in\n")
-test.write('cmd.in', "cmd.in\n")
-test.write('cmdstr.in', "cmdstr.in\n")
-test.write('lazy.in', "lazy.in\n")
-test.write('lazystr.in', "lazystr.in\n")
-test.write('list.in', "list.in\n")
-test.write('liststr.in', "liststr.in\n")
+test.write('func.in', "func.in\n")
+test.write('funcstr.in', "funcstr.in\n")
+test.write('cmd.in', "cmd.in\n")
+test.write('cmdstr.in', "cmdstr.in\n")
+test.write('lazy.in', "lazy.in\n")
+test.write('lazystr.in', "lazystr.in\n")
+test.write('list.in', "list.in\n")
+test.write('liststr.in', "liststr.in\n")
test.write('dict1.cmd', "dict1.cmd\n")
test.write('dict2.cmdstr', "dict2.cmdstr\n")