/[escript]/trunk/scons/grouptest.py
ViewVC logotype

Contents of /trunk/scons/grouptest.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2502 - (show annotations)
Tue Jun 30 05:49:22 2009 UTC (10 years, 3 months ago) by gross
File MIME type: text/x-python
File size: 3176 byte(s)
tests for examples added. utest is not working yet.
1 ########################################################
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 __url__="https://launchpad.net/escript-finley"
20
21
22
23 class GroupTest:
24 def __init__(self, exec_cmd, evars, python_dir, working_dir, test_list, single_processor_only=False):
25 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 self.single_processor_only=single_processor_only
32
33 def makeDir(self,dirname):
34 self.mkdirs.append(dirname)
35
36 def makeHeader(build_platform):
37 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 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 res=res+"\nexport OLD_PYTHON=`pwd`:$PYTHONPATH\nBINRUNNER=\"`pwd`/bin/escript -b $1\"\nPYTHONRUNNER=\"`pwd`/bin/escript $1\"\nBATCH_ROOT=`pwd`\n"
47 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 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 return res
52 makeHeader=staticmethod(makeHeader)
53
54 def makeString(self):
55 res=""
56 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 for d in self.mkdirs:
62 res=res+tt+"if [ ! -d "+str(d)+" ]\n"+tt+"then\n"+tt+"\tmkdir "+d+"\n"+tt+"fi\n"
63 for v in self.evars:
64 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 for t in self.test_list:
70 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 res=res+"\n"
76 return res
77

  ViewVC Help
Powered by ViewVC 1.1.26