1 |
ksteube |
1811 |
|
2 |
jfenwick |
3982 |
############################################################################## |
3 |
ksteube |
1705 |
# |
4 |
jfenwick |
6651 |
# Copyright (c) 2003-2018 by The University of Queensland |
5 |
jfenwick |
3982 |
# http://www.uq.edu.au |
6 |
ksteube |
1705 |
# |
7 |
ksteube |
1811 |
# Primary Business: Queensland, Australia |
8 |
jfenwick |
6112 |
# Licensed under the Apache License, version 2.0 |
9 |
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
10 |
ksteube |
1705 |
# |
11 |
jfenwick |
3982 |
# Development until 2012 by Earth Systems Science Computational Center (ESSCC) |
12 |
jfenwick |
4657 |
# Development 2012-2013 by School of Earth Sciences |
13 |
|
|
# Development from 2014 by Centre for Geoscience Computing (GeoComp) |
14 |
jfenwick |
3982 |
# |
15 |
|
|
############################################################################## |
16 |
ksteube |
1705 |
|
17 |
jfenwick |
3259 |
from os.path import splitext |
18 |
robwdcock |
661 |
Import('*') |
19 |
ksteube |
1705 |
|
20 |
jfenwick |
3259 |
local_env = env.Clone() |
21 |
ksteube |
1705 |
|
22 |
jfenwick |
3259 |
# files defining test runs (passing in a release) |
23 |
caltinay |
6282 |
testruns = Glob('run_*.py', strings=True) |
24 |
jfenwick |
3259 |
|
25 |
ksteube |
1937 |
# files defining a few tests for a quick test |
26 |
|
|
scalable_tests = [] |
27 |
|
|
scalable_tests += ['run_inputOutput.py'] |
28 |
caltinay |
6032 |
scalable_tests += ['run_pasoSolversOnFinley.py'] |
29 |
jfenwick |
3259 |
|
30 |
gross |
700 |
# files defining tests run locally (not as part of a release) |
31 |
jfenwick |
3259 |
localtestruns = [x for x in Glob('*.py', strings=True) if not x.startswith('run_')] |
32 |
|
|
|
33 |
|
|
# all tests |
34 |
gross |
700 |
alltestruns = testruns + localtestruns |
35 |
robwdcock |
661 |
|
36 |
sshaw |
5017 |
# test files are just compiled |
37 |
|
|
sources = Glob('*.py') |
38 |
|
|
test_pyc = env.PyCompile(sources) |
39 |
|
|
env.Alias('build_py_tests', test_pyc) |
40 |
jfenwick |
3259 |
|
41 |
|
|
# add unit test to target alias |
42 |
caltinay |
3349 |
local_env.PrependENVPath('PYTHONPATH', Dir('.').abspath) |
43 |
sshaw |
5017 |
local_env.PrependENVPath('PYTHONPATH', env.Dir('$BUILD_DIR/$PLATFORM/finley/test/python').abspath) |
44 |
jfenwick |
4508 |
local_env.PrependENVPath('PYTHONPATH', env.Dir('$BUILD_DIR/$PLATFORM/escriptcore/test/python').abspath) |
45 |
caltinay |
6119 |
local_env['ENV']['FINLEY_TEST_DATA'] = Dir('.').srcnode().abspath |
46 |
|
|
local_env['ENV']['FINLEY_WORKDIR'] = Dir('.').abspath |
47 |
caltinay |
3349 |
# needed for a test from the util base class in escript |
48 |
caltinay |
6119 |
local_env['ENV']['ESCRIPT_WORKDIR'] = Dir('.').abspath |
49 |
jfenwick |
3259 |
env.Alias('local_py_tests',[splitext(x)[0]+'.passed' for x in alltestruns]) |
50 |
|
|
env.Alias('py_tests', [splitext(x)[0]+'.passed' for x in testruns ]) |
51 |
|
|
env.Alias('scalable_tests', [splitext(x)[0]+'.passed' for x in scalable_tests]) |
52 |
robwdcock |
661 |
|
53 |
jfenwick |
3259 |
# run all tests |
54 |
woo409 |
757 |
program = local_env.RunPyUnitTest(alltestruns) |
55 |
caltinay |
6119 |
Requires(program, ['install_escript', 'build_py_tests']) |
56 |
sshaw |
5496 |
if env['usempi']: |
57 |
caltinay |
6119 |
Requires(program, ['install_pythonMPI']) |
58 |
woo409 |
757 |
|
59 |
jfenwick |
3259 |
# add a group of tests |
60 |
caltinay |
6034 |
from grouptest import GroupTest |
61 |
|
|
tgroup=GroupTest("finley", "$PYTHONRUNNER ", (("FINLEY_TEST_DATA","$BATCH_ROOT/finley/test/python"),('FINLEY_WORKDIR','$BUILD_DIR/finley/test/python')), "$BATCH_ROOT/escriptcore/test/python:$BATCH_ROOT/finley/test/python", "$BATCH_ROOT/finley/test/python", testruns) |
62 |
jfenwick |
2235 |
tgroup.makeDir("$BUILD_DIR/finley/test/python") |
63 |
|
|
TestGroups.append(tgroup) |
64 |
|
|
|