1 |
gross |
2502 |
|
2 |
|
|
######################################################## |
3 |
|
|
# |
4 |
jfenwick |
2881 |
# Copyright (c) 2003-2010 by University of Queensland |
5 |
gross |
2502 |
# Earth Systems Science Computational Center (ESSCC) |
6 |
|
|
# http://www.uq.edu.au/esscc |
7 |
|
|
# |
8 |
|
|
# Primary Business: Queensland, Australia |
9 |
|
|
# Licensed under the Open Software License version 3.0 |
10 |
|
|
# http://www.opensource.org/licenses/osl-3.0.php |
11 |
|
|
# |
12 |
|
|
######################################################## |
13 |
|
|
|
14 |
|
|
from grouptest import * |
15 |
|
|
import os |
16 |
|
|
Import('*') |
17 |
jfenwick |
3259 |
local_env = env.Clone() |
18 |
|
|
|
19 |
gross |
2502 |
example_files = example_files_allow_mpi + example_files_no_mpi |
20 |
|
|
|
21 |
|
|
src_dir = local_env.Dir('.').srcnode().abspath |
22 |
|
|
test_dir= Dir('test', local_env.Dir('.')) |
23 |
|
|
cc=Command(test_dir, [], Mkdir("$TARGET")) |
24 |
|
|
# Execute(Delete(test_dir.srcnode().abspath)) |
25 |
|
|
# Execute(Mkdir(test_dir.srcnode().abspath)) |
26 |
|
|
# |
27 |
|
|
# create copy of all non-py files: |
28 |
|
|
# |
29 |
|
|
data_files=[] |
30 |
|
|
for i in example_files: |
31 |
jfenwick |
3259 |
if not i.endswith('.py'): |
32 |
|
|
f_in=File(os.path.join(src_dir,i)) |
33 |
|
|
f_out=File(i,test_dir) |
34 |
|
|
data_files.append(Command(f_out, f_in, Copy("$TARGET", "$SOURCE"))) |
35 |
jfenwick |
2648 |
|
36 |
jfenwick |
3259 |
# We need this because of cblib.py which needs to be present for other tests |
37 |
|
|
# to work |
38 |
jfenwick |
2648 |
for i in example_deps: |
39 |
|
|
f_in=File(os.path.join(src_dir,i)) |
40 |
|
|
f_out=File(i,test_dir) |
41 |
|
|
data_files.append(Command(f_out, f_in, Copy("$TARGET", "$SOURCE"))) |
42 |
gross |
2502 |
Depends(cc, data_files) |
43 |
|
|
|
44 |
|
|
np=int(local_env['ENV']['ESCRIPT_NUM_NODES']) |
45 |
|
|
programs=[] |
46 |
jfenwick |
2508 |
copies=[] |
47 |
gross |
2502 |
for i in example_files: |
48 |
jfenwick |
3259 |
if i.endswith('.py') and (np==1 or not i in example_files_no_mpi): |
49 |
|
|
f_in=File(os.path.join(src_dir,i)) |
50 |
|
|
f_out=File(i, test_dir) |
51 |
|
|
c=Command(f_out, f_in, Copy("$TARGET", "$SOURCE")) |
52 |
|
|
copies+=c |
53 |
|
|
programs+=local_env.RunPyUnitTest(c) |
54 |
|
|
|
55 |
jfenwick |
2508 |
#env.Alias('build_py_tests', programs) |
56 |
|
|
env.Alias('build_py_tests', data_files) |
57 |
|
|
env.Alias('build_py_tests', copies) |
58 |
gross |
2502 |
env.Alias('py_tests', programs) |
59 |
|
|
Depends(programs, data_files) |
60 |
|
|
Depends(cc, data_files) |
61 |
jfenwick |
3259 |
|
62 |
gross |
2502 |
# Add a group of tests |
63 |
|
|
# find all directories: |
64 |
|
|
for single_processor_only in [True, False]: |
65 |
|
|
dirs=[] |
66 |
|
|
for i in example_files: |
67 |
|
|
if i.endswith('.py'): |
68 |
|
|
if single_processor_only == (i in example_files_no_mpi): |
69 |
|
|
d=os.path.split(i)[0] |
70 |
|
|
if not d in dirs: dirs.append(d) |
71 |
|
|
for d in dirs: |
72 |
|
|
runs=[] |
73 |
|
|
for i in example_files: |
74 |
|
|
if i.startswith(d) and i.endswith('.py') and (single_processor_only == (i in example_files_no_mpi)): runs.append(os.path.split(i)[1]) |
75 |
jfenwick |
2508 |
TestGroups.append(GroupTest("$PYTHONRUNNER ",(),"",os.path.join("$BUILD_DIR/doc/examples/test",d),runs, single_processor_only=single_processor_only)) |
76 |
jfenwick |
3259 |
|