All tests now run using "scons test"
The "newtest" target has been removed. Python and Matlab unit tests can be run with "scons test-python" and "scons test-matlab", respectively.
This commit is contained in:
parent
987578d033
commit
16390cc547
3 changed files with 41 additions and 32 deletions
24
SConstruct
24
SConstruct
|
|
@ -11,14 +11,13 @@ Basic usage:
|
|||
|
||||
'[sudo] scons install' - Install Cantera.
|
||||
|
||||
'scons test' - Run full regression test suite.
|
||||
'scons test' - Run full test suite.
|
||||
|
||||
'scons test-clean' - Delete files created while running the
|
||||
regression tests.
|
||||
'scons test-clean' - Delete files created while running the tests.
|
||||
|
||||
'scons test-help' - List available regression tests.
|
||||
'scons test-help' - List available tests.
|
||||
|
||||
'scons test-NAME' - Run the regression test named "FOO".
|
||||
'scons test-NAME' - Run the test named "NAME".
|
||||
|
||||
'scons samples' - Compile the C++ and Fortran samples
|
||||
|
||||
|
|
@ -1273,9 +1272,18 @@ if 'msi' in COMMAND_LINE_TARGETS:
|
|||
|
||||
### Tests ###
|
||||
if any(target.startswith('test') for target in COMMAND_LINE_TARGETS):
|
||||
SConscript('test_problems/SConscript')
|
||||
env['testNames'] = []
|
||||
|
||||
# Tests written using the gtest framework
|
||||
if any(target.startswith('newtest') for target in COMMAND_LINE_TARGETS):
|
||||
# Tests written using the gtest framework, the Python unittest module,
|
||||
# or the Matlab xunit package.
|
||||
VariantDir('build/test', 'test', duplicate=0)
|
||||
SConscript('build/test/SConscript')
|
||||
|
||||
# Regression tests
|
||||
SConscript('test_problems/SConscript')
|
||||
|
||||
if 'test-help' in COMMAND_LINE_TARGETS:
|
||||
print '\n*** Available tests ***\n'
|
||||
for name in env['testNames']:
|
||||
print 'test-%s' % name
|
||||
sys.exit(0)
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ def addTestProgram(subdir, progName):
|
|||
pjoin(subdir, '%s.cpp' % progName))
|
||||
passedFile = File(pjoin(str(program[0].dir), '%s.passed' % program[0].name))
|
||||
run_program = localenv.Command(passedFile, program, testRunner)
|
||||
Alias('newtest', run_program)
|
||||
Alias('test', run_program)
|
||||
Alias('test-%s' % progName, run_program)
|
||||
env['testNames'].append(progName)
|
||||
if os.path.exists(passedFile.abspath):
|
||||
Alias('newtest-reset', localenv.Command('reset-%s%s' % (subdir, progName),
|
||||
[], [Delete(passedFile.abspath)]))
|
||||
Alias('test-reset', localenv.Command('reset-%s%s' % (subdir, progName),
|
||||
[], [Delete(passedFile.abspath)]))
|
||||
|
||||
|
||||
def addTestScript(subdir, script, interpreter, dependencies):
|
||||
|
|
@ -65,10 +67,12 @@ def addTestScript(subdir, script, interpreter, dependencies):
|
|||
if isinstance(dep, str):
|
||||
dep = File(pjoin(subdir, dep))
|
||||
testenv.Depends(run_program, dep)
|
||||
Alias('newtest', run_program)
|
||||
Alias('test', run_program)
|
||||
if os.path.exists(passedFile.abspath):
|
||||
Alias('newtest-reset', testenv.Command('reset-%s%s' % (subdir, script),
|
||||
[], [Delete(passedFile.abspath)]))
|
||||
Alias('test-reset', testenv.Command('reset-%s%s' % (subdir, script),
|
||||
[], [Delete(passedFile.abspath)]))
|
||||
|
||||
return run_program
|
||||
|
||||
|
||||
def addMatlabTest(script, dependencies=None):
|
||||
|
|
@ -110,22 +114,27 @@ def addMatlabTest(script, dependencies=None):
|
|||
dep = File(pjoin('matlab', dep))
|
||||
testenv.Depends(run_program, dep)
|
||||
|
||||
Alias('newtest', run_program)
|
||||
Alias('test', run_program)
|
||||
if os.path.exists(passedFile.abspath):
|
||||
Alias('newtest-reset', testenv.Command('reset-%s%s' % ('matlab', script),
|
||||
[], [Delete(passedFile.abspath)]))
|
||||
Alias('test-reset', testenv.Command('reset-%s%s' % ('matlab', script),
|
||||
[], [Delete(passedFile.abspath)]))
|
||||
|
||||
return run_program
|
||||
|
||||
# Instantiate tests
|
||||
addTestProgram('thermo', 'nasapoly')
|
||||
addTestProgram('kinetics', 'pdep')
|
||||
|
||||
if localenv['python_package'] == 'full':
|
||||
addTestScript('python', 'runTests.py',
|
||||
interpreter=sys.executable,
|
||||
dependencies=['testSolution.py', 'testReactors.py',
|
||||
localenv['python_module']])
|
||||
pyTest= addTestScript('python', 'runTests.py',
|
||||
interpreter=sys.executable,
|
||||
dependencies=['testSolution.py', 'testReactors.py',
|
||||
localenv['python_module']])
|
||||
localenv.Alias('python', pyTest)
|
||||
env['testNames'].append('python')
|
||||
|
||||
if localenv['matlab_toolbox'] == 'y':
|
||||
addMatlabTest('runCanteraTests.m',
|
||||
dependencies=mglob(localenv, 'matlab', 'm'))
|
||||
matlabTest = addMatlabTest('runCanteraTests.m',
|
||||
dependencies=mglob(localenv, 'matlab', 'm'))
|
||||
localenv.Alias('matlab', matlabTest)
|
||||
env['testNames'].append('matlab')
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ localenv.Append(CPPPATH=['#include', '#src', 'shared'])
|
|||
os.environ['PYTHONPATH'] = pjoin(os.getcwd(), '..', 'interfaces', 'python')
|
||||
os.environ['CANTERA_DATA'] = pjoin(os.getcwd(), '..', 'data', 'inputs')
|
||||
|
||||
testNames = []
|
||||
|
||||
class Test(object):
|
||||
_validArgs = set(['arguments', 'options', 'artifacts', 'comparisons',
|
||||
'tolerance', 'threshold', 'ignoreLines', 'extensions',
|
||||
|
|
@ -42,7 +40,7 @@ class Test(object):
|
|||
localenv.Alias('test-run', run)
|
||||
localenv.Alias('test-clean', self.clean(localenv))
|
||||
localenv.Alias('test-%s' % self.testName, run)
|
||||
testNames.append(self.testName)
|
||||
env['testNames'].append(self.testName)
|
||||
|
||||
# reset: just delete the ".passed" file so that this test will be re-run
|
||||
localenv.Alias('test-reset', self.reset(localenv))
|
||||
|
|
@ -325,9 +323,3 @@ if localenv['python_package'] == 'full':
|
|||
finish_tests = localenv.Command('finish_tests', [], testResults.printReport)
|
||||
localenv.Depends(finish_tests, 'test-run')
|
||||
Alias('test', finish_tests)
|
||||
|
||||
if 'test-help' in COMMAND_LINE_TARGETS:
|
||||
print '\n*** Available regression tests ***\n'
|
||||
for name in testNames:
|
||||
print name
|
||||
sys.exit(0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue