1 |
gross |
2502 |
|
2 |
|
|
######################################################## |
3 |
|
|
# |
4 |
|
|
# Copyright (c) 2003-2008 by University of Queensland |
5 |
|
|
# 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 |
|
|
example_files = example_files_allow_mpi + example_files_no_mpi |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
local_env = clone_env(env) |
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 |
|
|
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 |
|
|
Depends(cc, data_files) |
36 |
|
|
|
37 |
|
|
np=int(local_env['ENV']['ESCRIPT_NUM_NODES']) |
38 |
|
|
programs=[] |
39 |
|
|
for i in example_files: |
40 |
|
|
if i.endswith('.py') and (np==1 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 |
|
|
programs+=local_env.RunPyUnitTest(c) |
45 |
|
|
env.Alias('py_tests', programs) |
46 |
|
|
Depends(programs, env['pyinstall']) |
47 |
|
|
Depends(programs, data_files) |
48 |
|
|
Depends(cc, data_files) |
49 |
|
|
# Add a group of tests |
50 |
|
|
# find all directories: |
51 |
|
|
for single_processor_only in [True, False]: |
52 |
|
|
dirs=[] |
53 |
|
|
for i in example_files: |
54 |
|
|
if i.endswith('.py'): |
55 |
|
|
if single_processor_only == (i in example_files_no_mpi): |
56 |
|
|
d=os.path.split(i)[0] |
57 |
|
|
if not d in dirs: dirs.append(d) |
58 |
|
|
for d in dirs: |
59 |
|
|
runs=[] |
60 |
|
|
for i in example_files: |
61 |
|
|
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]) |
62 |
|
|
TestGroups.append(GroupTest("$PYTHONRUNNER ",(),"",os.path.join("$BATCH_ROOT/doc/examples/test",d),runs, single_processor_only=single_processor_only)) |