Changeset c5074d2 in flex_extract.git for source/pythontest
- Timestamp:
- Oct 9, 2018, 8:42:16 PM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- aa275fc
- Parents:
- 0a06607
- Location:
- source/pythontest
- Files:
-
- 1 added
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
source/pythontest/TestData/CONTROL.temp
r25b14be rc5074d2 9 9 NUMBER OFF 10 10 EXPVER 1 11 GRID 500011 GRID 1000 12 12 LEFT -15000 13 13 LOWER 30000 -
source/pythontest/TestData/compilejob.test
r0aaeb04 rc5074d2 17 17 ##PBS -q ns 18 18 ##PBS -S /usr/bin/ksh 19 ##PBS -o /scratch/ms/testgroup/testuser/flex_ecmwf.$ Jobname.$Job_ID.out19 ##PBS -o /scratch/ms/testgroup/testuser/flex_ecmwf.${Jobname}.${Job_ID}.out 20 20 # job output is in .ecaccess_DO_NOT_REMOVE 21 21 ##PBS -j oe … … 26 26 set -x 27 27 export VERSION=7.1 28 case $ HOSTin28 case ${HOST} in 29 29 *ecg*) 30 30 module load python … … 43 43 echo ${GROUP} 44 44 echo ${HOME} 45 echo $ HOME| awk -F / '{print $1, $2, $3, $4}'46 export GROUP=`echo $ HOME| awk -F / '{print $4}'`45 echo ${HOME} | awk -F / '{print $1, $2, $3, $4}' 46 export GROUP=`echo ${HOME} | awk -F / '{print $4}'` 47 47 export SCRATCH=/scratch/ms/${GROUP}/${USER} 48 export FLEXPART_ROOT_SCRIPTS= p_root_test_path48 export FLEXPART_ROOT_SCRIPTS=fp_root_test_path 49 49 export MAKEFILE=Makefile.TEST 50 50 ;; 51 51 esac 52 52 53 mkdir -p $ FLEXPART_ROOT_SCRIPTS/flex_extract_v$VERSION54 cd $ FLEXPART_ROOT_SCRIPTS/flex_extract_v$VERSION# if FLEXPART_ROOT is not set this means cd to the home directory55 tar -xvf $ HOME/flex_extract_v$VERSION.tar53 mkdir -p ${FLEXPART_ROOT_SCRIPTS}/flex_extract_v${VERSION} 54 cd ${FLEXPART_ROOT_SCRIPTS}/flex_extract_v${VERSION} # if FLEXPART_ROOT is not set this means cd to the home directory 55 tar -xvf ${HOME}/flex_extract_v${VERSION}.tar 56 56 cd src 57 57 \rm *.o *.mod CONVERT2 58 make -f $ MAKEFILE>flexcompile 2>flexcompile58 make -f ${MAKEFILE} >flexcompile 2>flexcompile 59 59 60 60 ls -l CONVERT2 >>flexcompile 61 61 if [ $? -eq 0 ]; then 62 62 echo 'SUCCESS!' >>flexcompile 63 mail -s flexcompile.$ HOST.$$ $USER<flexcompile63 mail -s flexcompile.${HOST}.$$ ${USER} <flexcompile 64 64 else 65 65 echo Environment: >>flexcompile 66 66 env >> flexcompile 67 mail -s "ERROR! flexcompile.$ HOST.$$" $USER<flexcompile67 mail -s "ERROR! flexcompile.${HOST}.$$" ${USER} <flexcompile 68 68 fi -
source/pythontest/TestData/job.temp.test
r25b14be rc5074d2 5 5 # start with sbatch NAME_OF_THIS_FILE directly on machine 6 6 7 #SBATCH --workdir=/scratch/ms/ at/km4a7 #SBATCH --workdir=/scratch/ms/testgroup/testuser 8 8 #SBATCH --qos=normal 9 9 #SBATCH --job-name=flex_ecmwf … … 17 17 ##PBS -q np 18 18 ##PBS -S /usr/bin/ksh 19 ## -o /scratch/ms/ spatlh00/lh0/flex_ecmwf.$PBS_JOBID.out19 ## -o /scratch/ms/testgroup/testuser/flex_ecmwf.${PBS_JOBID}.out 20 20 ## job output is in .ecaccess_DO_NOT_REMOVE 21 21 ##PBS -j oe … … 26 26 set -x 27 27 export VERSION=7.1 28 case $ HOSTin28 case ${HOST} in 29 29 *ecg*) 30 30 module load python … … 33 33 module load grib_api/1.14.5 34 34 module load emos/437-r64 35 export PATH=${PATH}: ${HOME}/flex_extract_v7.1/source/python35 export PATH=${PATH}:fp_root_test_path/flex_extract_v7.1/source/python 36 36 ;; 37 37 *cca*) … … 40 40 module load emos 41 41 module load python 42 export SCRATCH=$ TMPDIR43 export PATH=${PATH}: ${HOME}/flex_extract_v7.1/source/python42 export SCRATCH=${TMPDIR} 43 export PATH=${PATH}:fp_root_test_path/flex_extract_v7.1/source/python 44 44 ;; 45 45 esac 46 46 47 cd $ SCRATCH47 cd ${SCRATCH} 48 48 mkdir -p python$$ 49 49 cd python$$ … … 51 51 export CONTROL=CONTROL 52 52 53 cat >$ CONTROL<<EOF53 cat >${CONTROL}<<EOF 54 54 EOF 55 55 56 56 57 submit.py --controlfile=$ CONTROL--inputdir=./work --outputdir=./work 1> prot 2>&157 submit.py --controlfile=${CONTROL} --inputdir=./work --outputdir=./work 1> prot 2>&1 58 58 59 59 if [ $? -eq 0 ] ; then 60 60 l=0 61 for muser in `grep -i MAILOPS $ CONTROL`; do62 if [ $ l-gt 0 ] ; then63 mail -s flex.${HOST}.$$ $ muser<prot61 for muser in `grep -i MAILOPS ${CONTROL}`; do 62 if [ ${l} -gt 0 ] ; then 63 mail -s flex.${HOST}.$$ ${muser} <prot 64 64 fi 65 l=$(($ l+1))65 l=$((${l}+1)) 66 66 done 67 67 else 68 68 l=0 69 for muser in `grep -i MAILFAIL $ CONTROL`; do70 if [ $ l-gt 0 ] ; then71 mail -s "ERROR! flex.${HOST}.$$" $ muser<prot69 for muser in `grep -i MAILFAIL ${CONTROL}`; do 70 if [ ${l} -gt 0 ] ; then 71 mail -s "ERROR! flex.${HOST}.$$" ${muser} <prot 72 72 fi 73 l=$(($ l+1))73 l=$((${l}+1)) 74 74 done 75 75 fi -
source/pythontest/TestEcFlexpart.py
r25b14be rc5074d2 4 4 5 5 import sys 6 import os 7 import inspect 6 8 import pytest 7 9 8 10 sys.path.append('../python') 11 import _config 9 12 from classes.EcFlexpart import EcFlexpart 13 from classes.ControlFile import ControlFile 14 from mods.tools import silent_remove 10 15 11 16 class TestEcFlexpart(): … … 13 18 ''' 14 19 15 def test_init(self): 16 # create an instance of EcFlexpart and get a dictionary of the 17 # class attributes, compare this dict with an expected dict! 18 assert True == True 20 def test_write_namelist(self): 21 import filecmp 19 22 20 def test_write_namelist(self): 21 # simple 22 assert True == True 23 control_file = os.path.join(_config.PATH_TEST_DIR, 24 'TestData', 25 'CONTROL.temp') 26 c = ControlFile(control_file) 27 flexpart = EcFlexpart(c) 28 29 c.inputdir = 'TestData' 30 31 # comparison file 32 testfile = os.path.join(_config.PATH_TEST_DIR, 33 'TestData', 34 'convert.nl.test') 35 36 # create 37 flexpart.write_namelist(c) 38 39 finalfile = os.path.join(c.inputdir, _config.FILE_NAMELIST) 40 assert filecmp.cmp(testfile, finalfile, shallow=False) 41 42 # delete test file 43 silent_remove(finalfile) 23 44 24 45 def test_retrieve(self): -
source/pythontest/TestInstall.py
r0aaeb04 rc5074d2 25 25 #! - un_tarball 26 26 #! - mk_env_vars 27 # - mk_compilejob28 # - mk_job_template27 #! - mk_compilejob 28 #! - mk_job_template 29 29 # - delete_convert_build 30 30 # - make_convert_build … … 155 155 # delete test file 156 156 silent_remove(finalfile) 157 158 def test_mk_job_template(self): 159 import filecmp 160 161 # comparison file 162 testfile = os.path.join(_config.PATH_TEST_DIR, 163 'TestData', 164 'job.temp.test') 165 166 # create 167 install.mk_job_template('testuser', 168 'testgroup', 169 'gateway.test.ac.at', 170 'dest@generic', 171 'fp_root_test_path') 172 173 finalfile = os.path.join(_config.PATH_TEMPLATES, 174 _config.TEMPFILE_JOB) 175 assert filecmp.cmp(testfile, finalfile, shallow=False) 176 177 # delete test file 178 silent_remove(finalfile)
Note: See TracChangeset
for help on using the changeset viewer.