/[escript]/branches/lapack2681/scons/grouptest.py
ViewVC logotype

Annotation of /branches/lapack2681/scons/grouptest.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2502 - (hide annotations)
Tue Jun 30 05:49:22 2009 UTC (10 years, 3 months ago) by gross
Original Path: trunk/scons/grouptest.py
File MIME type: text/x-python
File size: 3176 byte(s)
tests for examples added. utest is not working yet.
1 jfenwick 2266 ########################################################
2     #
3     # Copyright (c) 2003-2008 by University of Queensland
4     # Earth Systems Science Computational Center (ESSCC)
5     # http://www.uq.edu.au/esscc
6     #
7     # Primary Business: Queensland, Australia
8     # Licensed under the Open Software License version 3.0
9     # http://www.opensource.org/licenses/osl-3.0.php
10     #
11     ########################################################
12    
13     __copyright__="""Copyright (c) 2003-2008 by University of Queensland
14     Earth Systems Science Computational Center (ESSCC)
15     http://www.uq.edu.au/esscc
16     Primary Business: Queensland, Australia"""
17     __license__="""Licensed under the Open Software License version 3.0
18     http://www.opensource.org/licenses/osl-3.0.php"""
19 jfenwick 2344 __url__="https://launchpad.net/escript-finley"
20 jfenwick 2266
21    
22    
23     class GroupTest:
24 gross 2502 def __init__(self, exec_cmd, evars, python_dir, working_dir, test_list, single_processor_only=False):
25 jfenwick 2266 self.python_dir=python_dir
26     self.working_dir=working_dir
27     self.test_list=test_list
28     self.exec_cmd=exec_cmd
29     self.evars=evars
30     self.mkdirs=[]
31 gross 2502 self.single_processor_only=single_processor_only
32 jfenwick 2266
33     def makeDir(self,dirname):
34     self.mkdirs.append(dirname)
35    
36 jfenwick 2276 def makeHeader(build_platform):
37 jfenwick 2266 res="#!/bin/bash\n"
38     res=res+"\n#############################################\n"
39     res=res+"# This file is autogenerated by scons.\n"
40     res=res+"# It will be regenerated each time scons is run\n"
41     res=res+"#############################################\n\n"
42     res=res+"function failed()\n{\n echo ""Execution failed for $@""\n exit 1\n}\n"
43 jfenwick 2276 res=res+"\nexport LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH\n"
44     if build_platform=='darwin':
45     res=res+"export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH\n"
46 jfenwick 2374 res=res+"\nexport OLD_PYTHON=`pwd`:$PYTHONPATH\nBINRUNNER=\"`pwd`/bin/escript -b $1\"\nPYTHONRUNNER=\"`pwd`/bin/escript $1\"\nBATCH_ROOT=`pwd`\n"
47 jfenwick 2276 res=res+"BUILD_DIR=$BATCH_ROOT/build/"+build_platform
48     res=res+"\nif [ ! -d $BUILD_DIR ]\nthen\n echo Can not find build directory $BUILD_DIR\n exit 2\nfi\n"
49 jfenwick 2374 res=res+"if [ $# -ne 1 ]\nthen\n echo Usage: $0 wrapper_options\necho Runs all unit tests. Options must be a single string.\nexit 2\nfi\n"
50     #res=res+"if [ $# -lt 2 ]\nthen\n echo Usage: $0 bin_run_cmd python_run_cmd\n exit 2\nfi\n"
51 jfenwick 2266 return res
52     makeHeader=staticmethod(makeHeader)
53    
54     def makeString(self):
55     res=""
56 gross 2502 if self.single_processor_only:
57     res+="if [ ( $ESCRIPT_NUM_NODES * $ESCRIPT_NUM_PROCS ) -le 1 ]; then\n"
58     tt="\t"
59     else:
60     tt=""
61 jfenwick 2266 for d in self.mkdirs:
62 gross 2502 res=res+tt+"if [ ! -d "+str(d)+" ]\n"+tt+"then\n"+tt+"\tmkdir "+d+"\n"+tt+"fi\n"
63 jfenwick 2266 for v in self.evars:
64 gross 2502 res=res+tt+"export "+str(v[0])+"="+str(v[1])+"\n"
65     if len(self.python_dir)>0:
66     res=res+tt+"export PYTHONPATH="+self.python_dir+":$OLD_PYTHON"+"\n"+tt+"cd "+self.working_dir+"\n"
67     else:
68     res=res+tt+"export PYTHONPATH=$OLD_PYTHON"+"\n"+tt+"cd "+self.working_dir+"\n"
69 jfenwick 2266 for t in self.test_list:
70 gross 2502 res=res+tt+"echo Starting "+t+"\n"
71     res=res+tt+self.exec_cmd+' '+t+' || failed '+t+'\n'
72     res=res+tt+"echo Completed "+t+"\n"
73     if self.single_processor_only:
74     res+="fi\n"
75 jfenwick 2266 res=res+"\n"
76     return res
77    

  ViewVC Help
Powered by ViewVC 1.1.26