1 |
gross |
2502 |
|
2 |
jfenwick |
3982 |
############################################################################## |
3 |
gross |
2502 |
# |
4 |
jfenwick |
6651 |
# Copyright (c) 2003-2018 by The University of Queensland |
5 |
jfenwick |
3982 |
# http://www.uq.edu.au |
6 |
gross |
2502 |
# |
7 |
|
|
# 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 |
gross |
2502 |
# |
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 |
gross |
2502 |
|
17 |
caltinay |
6034 |
from grouptest import GroupTest |
18 |
gross |
2502 |
import os |
19 |
|
|
Import('*') |
20 |
jfenwick |
3259 |
local_env = env.Clone() |
21 |
|
|
|
22 |
gross |
2502 |
example_files = example_files_allow_mpi + example_files_no_mpi |
23 |
|
|
|
24 |
|
|
src_dir = local_env.Dir('.').srcnode().abspath |
25 |
|
|
test_dir= Dir('test', local_env.Dir('.')) |
26 |
|
|
cc=Command(test_dir, [], Mkdir("$TARGET")) |
27 |
jfenwick |
2648 |
|
28 |
caltinay |
6034 |
# create copy of all non-py files: |
29 |
jfenwick |
3259 |
# We need this because of cblib.py which needs to be present for other tests |
30 |
|
|
# to work |
31 |
caltinay |
6034 |
data_files=[] |
32 |
jfenwick |
2648 |
for i in example_deps: |
33 |
|
|
f_in=File(os.path.join(src_dir,i)) |
34 |
|
|
f_out=File(i,test_dir) |
35 |
|
|
data_files.append(Command(f_out, f_in, Copy("$TARGET", "$SOURCE"))) |
36 |
gross |
2502 |
|
37 |
|
|
programs=[] |
38 |
jfenwick |
2508 |
copies=[] |
39 |
gross |
2502 |
for i in example_files: |
40 |
caltinay |
6034 |
if local_env['mpi']=='none' or not i in example_files_no_mpi: |
41 |
jfenwick |
3259 |
f_in=File(os.path.join(src_dir,i)) |
42 |
|
|
f_out=File(i, test_dir) |
43 |
|
|
c=Command(f_out, f_in, Copy("$TARGET", "$SOURCE")) |
44 |
|
|
copies+=c |
45 |
sshaw |
5017 |
programs+=local_env.RunPyExample(c) |
46 |
jfenwick |
3259 |
|
47 |
jfenwick |
2508 |
env.Alias('build_py_tests', data_files) |
48 |
|
|
env.Alias('build_py_tests', copies) |
49 |
gross |
2502 |
env.Alias('py_tests', programs) |
50 |
|
|
Depends(programs, data_files) |
51 |
|
|
Depends(cc, data_files) |
52 |
jfenwick |
3259 |
|
53 |
caltinay |
6034 |
# Add group of tests |
54 |
|
|
dirs = set([os.path.split(i)[0] for i in example_files]) |
55 |
|
|
for d in dirs: |
56 |
|
|
single_runs=[] |
57 |
|
|
runs=[] |
58 |
|
|
for i in example_files_no_mpi: |
59 |
|
|
if i.startswith(d): |
60 |
|
|
single_runs.append(os.path.split(i)[1]) |
61 |
|
|
for i in example_files_allow_mpi: |
62 |
|
|
if i.startswith(d): |
63 |
|
|
runs.append(os.path.split(i)[1]) |
64 |
|
|
TestGroups.append(GroupTest(d, "$PYTHONRUNNER ", (), "", os.path.join("$BATCH_ROOT/doc/examples",d), runs, single_runs)) |
65 |
jfenwick |
3259 |
|