1 |
|
2 |
############################################################################## |
3 |
# |
4 |
# Copyright (c) 2003-2018 by The University of Queensland |
5 |
# http://www.uq.edu.au |
6 |
# |
7 |
# Primary Business: Queensland, Australia |
8 |
# Licensed under the Apache License, version 2.0 |
9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
10 |
# |
11 |
# Development until 2012 by Earth Systems Science Computational Center (ESSCC) |
12 |
# Development 2012-2013 by School of Earth Sciences |
13 |
# Development from 2014 by Centre for Geoscience Computing (GeoComp) |
14 |
# |
15 |
############################################################################## |
16 |
|
17 |
from grouptest import GroupTest |
18 |
import os |
19 |
Import('*') |
20 |
local_env = env.Clone() |
21 |
|
22 |
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 |
|
28 |
# create copy of all non-py files: |
29 |
# We need this because of cblib.py which needs to be present for other tests |
30 |
# to work |
31 |
data_files=[] |
32 |
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 |
|
37 |
programs=[] |
38 |
copies=[] |
39 |
for i in example_files: |
40 |
if local_env['mpi']=='none' or not i in example_files_no_mpi: |
41 |
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 |
programs+=local_env.RunPyExample(c) |
46 |
|
47 |
env.Alias('build_py_tests', data_files) |
48 |
env.Alias('build_py_tests', copies) |
49 |
env.Alias('py_tests', programs) |
50 |
Depends(programs, data_files) |
51 |
Depends(cc, data_files) |
52 |
|
53 |
# 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 |
|