Perl tests are now part of the build system

This commit is contained in:
Dan Hirsch 2013-12-05 08:41:28 +01:00
parent 8c44d583e6
commit 2f3bc9c4b0
4 changed files with 27 additions and 9 deletions

View file

@ -114,6 +114,8 @@ else:
lib = env.SConscript(["src/SConscript"])
env.Alias(env.SConscript(["examples/SConscript"]))
env.Alias("test", testruns)
print testruns
for testrun in testruns:
env.Alias("test", testrun)
env.Alias("install", targets)

View file

@ -1,19 +1,34 @@
# -*- python -*-
Import("env libhammer_shared")
import os.path
Import("env libhammer_shared testruns targets")
perlenv = env.Clone()
perlenv.Append(CCFLAGS=["-fpic", '-DSWIG', '-Wno-all', '-Wno-extra', '-Wno-error', '-DHAMMER_INTERNAL__NO_STDARG_H'],
perlenv.Append(CCFLAGS=["-fpic", '-DSWIG', '-Wno-all',
'-Wno-extra', '-Wno-error',
'-DHAMMER_INTERNAL__NO_STDARG_H'],
CPPPATH=["../.."],
LIBS=['hammer'],
LIBPATH=["../.."],
SWIGFLAGS=["-DHAMMER_INTERNAL__NO_STDARG_H", "-Isrc/", "-perl"])
SWIGFLAGS=["-DHAMMER_INTERNAL__NO_STDARG_H",
"-Isrc/", "-perl"])
perlenv.ParseConfig("perl -MConfig -e 'print(qq[-I$$Config{archlib}/CORE\n]);'")
perlenv.ParseConfig("perl -MConfig -e 'print($$Config{ccflags} . \"\n\");'")
perlenv.ParseConfig("perl -MConfig -e'print(qq[-I$$Config{archlib}/CORE\n]);'")
perlenv.ParseConfig("perl -MConfig -e'print($$Config{ccflags} . \"\n\");'")
swig = ['hammer.i']
libhammer_perl = perlenv.SharedLibrary('hammer', swig, SHLIBPREFIX='')
Default(libhammer_perl)
perltestenv = perlenv.Clone()
perltestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
perltests = ['t/hammer.t']
perltestexec = perltestenv.Command(None, perltests + libhammer_perl + libhammer_shared, "pwd && prove -I%(perldir)s %(perldir)s/t" % dict(perldir=os.path.dirname(str(libhammer_perl[0].path))))
perltest = Alias("testperl", [perltestexec], perltestexec)
AlwaysBuild(perltestexec)
testruns.append(perltest)
print "Reading perl sconscript"

View file

@ -15,8 +15,8 @@ pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
pytests = ['hammer_tests.py']
pytestexec = pytestenv.Command(['hammer.pyc', 'hammer_tests.pyc'], pytests + libhammer_python, "LD_LIBRARY_PATH=" + os.path.dirname(str(libhammer_shared[0])) + " nosetests -vv $SOURCE")
pytest = Alias("testpython", [pytestexec], pytestexec)
AlwaysBuild(pytest)
testruns.append(pytest)
AlwaysBuild(pytestexec)
testruns.extend(pytest)
pyinstallexec = pythonenv.Command(None, libhammer_python, 'python ' + os.path.join(pydir, 'setup.py ') + ' install')
pyinstall = Alias("installpython", [pyinstallexec], pyinstallexec)

View file

@ -35,7 +35,8 @@ int main(int argc, char** argv) {
register_parser_tests();
register_grammar_tests();
register_misc_tests();
register_benchmark_tests();
if (g_test_slow() || g_test_perf())
register_benchmark_tests();
g_test_run();
}