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 |
gross |
898 |
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 |
|
|
testruns = ['run_pycad_test.py'] |
24 |
|
|
|
25 |
gross |
898 |
# files defining tests run locally (not as part of a release) |
26 |
jfenwick |
3259 |
localtestruns = [x for x in Glob('*.py', strings=True) if not x.startswith('run_')] |
27 |
|
|
|
28 |
|
|
# all tests |
29 |
gross |
898 |
alltestruns = testruns + localtestruns |
30 |
|
|
|
31 |
jfenwick |
3259 |
# test files are just compiled - none of those in pycad yet |
32 |
sshaw |
5487 |
sources = Glob('run_*.py') |
33 |
|
|
test_pyc = env.PyCompile(sources) |
34 |
|
|
env.Alias('build_py_tests', test_pyc) |
35 |
jfenwick |
3259 |
|
36 |
|
|
# add unit test to target alias |
37 |
sshaw |
5017 |
local_env.PrependENVPath('PYTHONPATH', Dir('#/pycad/test/python')) |
38 |
caltinay |
3349 |
local_env.PrependENVPath('PYTHONPATH', Dir('.').abspath) |
39 |
|
|
local_env['ENV']['ESCRIPT_TEST_DATA_ROOT']=Dir('.').srcnode().abspath |
40 |
|
|
local_env['ENV']['ESCRIPT_WORKDIR']=Dir('.').abspath |
41 |
jfenwick |
3259 |
env.Alias('local_py_tests',[splitext(x)[0]+'.passed' for x in alltestruns]) |
42 |
|
|
env.Alias('py_tests', [splitext(x)[0]+'.passed' for x in testruns]) |
43 |
gross |
898 |
|
44 |
jfenwick |
3259 |
# run all tests |
45 |
gross |
898 |
program = local_env.RunPyUnitTest(alltestruns) |
46 |
sshaw |
5017 |
Depends(program, 'build_py_tests') |
47 |
sshaw |
5496 |
if env['usempi']: |
48 |
sshaw |
5527 |
Depends(program, env['prefix']+"/lib/pythonMPI") |
49 |
gross |
898 |
|
50 |
jfenwick |
3259 |
# add a group of tests |
51 |
caltinay |
6034 |
from grouptest import GroupTest |
52 |
|
|
tgroup=GroupTest("pycad", "$PYTHONRUNNER ", (("ESCRIPT_TEST_DATA_ROOT","$BATCH_ROOT/pycad/test/python"),("ESCRIPT_WORKDIR","$BUILD_DIR/pycad/test/python")), "$BATCH_ROOT/pycad/test/python", "$BATCH_ROOT/pycad/test/python", testruns) |
53 |
caltinay |
6158 |
tgroup.makeDir("$BUILD_DIR/pycad/test/python") |
54 |
jfenwick |
2235 |
TestGroups.append(tgroup) |
55 |
|
|
|