Commit 42f5d0a2 authored by kraus's avatar kraus

Merge branch 'master' of gitorious.psi.ch:opal/regression-tests

parents d0b6bdbb 2bc60033
*.pyc
RegressionTests/BeamLine-1/AMF1_R10.h5
RegressionTests/BeamLine-1/AMF1_R11.h5
RegressionTests/BeamLine-1/AMF1_R12.h5
RegressionTests/BeamLine-1/AMF1_R13.h5
RegressionTests/BeamLine-1/AMF1_R14.h5
RegressionTests/BeamLine-1/AMF1_R15.h5
RegressionTests/BeamLine-1/AMF1_R16.h5
RegressionTests/BeamLine-1/AMF1_R17.h5
RegressionTests/BeamLine-1/AMF1_R18.h5
RegressionTests/BeamLine-1/AMF1_R19.h5
RegressionTests/BeamLine-1/AMF1_R20.h5
RegressionTests/BeamLine-1/AMF1_R21.h5
RegressionTests/BeamLine-1/AMF1_R22.h5
RegressionTests/BeamLine-1/AMF1_R23.h5
RegressionTests/BeamLine-1/AMF1_R24.h5
RegressionTests/BeamLine-1/AMF1_R25.h5
RegressionTests/BeamLine-1/AMF1_R26.h5
RegressionTests/BeamLine-1/AMF1_R27.h5
RegressionTests/BeamLine-1/AMF1_R28.h5
RegressionTests/BeamLine-1/AMF1_R29.h5
RegressionTests/BeamLine-1/AMF1_R9.h5
RegressionTests/BeamLine-1/BeamLine-1-RT.o
RegressionTests/BeamLine-1/BeamLine-1.h5
RegressionTests/BeamLine-1/BeamLine-1.lbal
RegressionTests/BeamLine-1/BeamLine-1.out
RegressionTests/BeamLine-1/BeamLine-1.stat
RegressionTests/BeamLine-1/BeamLine-1_emit_s_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_emit_s_22_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_emit_x_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_emit_x_22_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_emit_y_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_emit_y_22_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_energy_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_energy_22_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_numParticles_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_numParticles_22_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_rms_s_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_rms_s_22_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_rms_x_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_rms_x_22_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_rms_y_21_5_2015.png
RegressionTests/BeamLine-1/BeamLine-1_rms_y_22_5_2015.png
RegressionTests/BeamLine-1/MMFP1X.h5
RegressionTests/BeamLine-1/MMFP2Y.h5
RegressionTests/BeamLine-1/MMFP3X.h5
RegressionTests/BeamLine-1/MMFP4Y.h5
RegressionTests/BeamLine-1/MMFP5X.h5
RegressionTests/BeamLine-1/MMFP6Y.h5
RegressionTests/BeamLine-1/QMF4_R0.h5
RegressionTests/BeamLine-1/QMF4_R1.h5
RegressionTests/BeamLine-1/QMF5_R0.h5
RegressionTests/BeamLine-1/QMF5_R1.h5
RegressionTests/BeamLine-1/QMF5_R2.h5
RegressionTests/BeamLine-1/QMF5_R3.h5
RegressionTests/BeamLine-1/QMF6_R0.h5
RegressionTests/BeamLine-1/QMF6_R1.h5
RegressionTests/BeamLine-1/QMF6_R2.h5
RegressionTests/BeamLine-1/QMF6_R3.h5
RegressionTests/BeamLine-1/QMF7_R0.h5
RegressionTests/BeamLine-1/QMF7_R1.h5
RegressionTests/BeamLine-1/QMF7_R2.h5
RegressionTests/BeamLine-1/QMF7_R3.h5
RegressionTests/BeamLine-1/timing.dat
RegressionTests/OpalRingTest/OpalRingTest-trackOrbit.dat
RegressionTests/OpalRingTest/OpalRingTest.h5
RegressionTests/OpalRingTest/PROBE1.loss
......
......@@ -6,12 +6,11 @@ if sys.version_info < (3,0):
else:
import subprocess
import os
import shutil
from reporter import Reporter
from reporter import TempXMLElement
from builder import Builder
from regressiontest import RegressionTest
from documentation import OpalDocumentation
......@@ -48,16 +47,19 @@ def callback(arg, dirname, fnames):
global totalNrPassed
global totalNrTests
if not ".svn" in dirname and not "reference" in dirname: #exclude svn and reference dirs
if ".svn" in dirname or "reference" in dirname:
return #exclude svn and reference dirs
dir = str.split(dirname, "/")
simname = dir[len(dir)-1]
# check if all files required are available
if os.path.isfile(dirname + "/" + simname + ".in") and \
if not (os.path.isfile(dirname + "/" + simname + ".in") and \
os.path.isfile(dirname + "/" + simname + ".rt") and \
os.path.isfile(dirname + "/" + simname + ".sge") and \
os.path.isdir(dirname + "/" + "reference"):
os.path.isdir(dirname + "/" + "reference")):
return
rep = Reporter()
rep.appendReport("Found valid test in %s \n" % dirname)
......@@ -73,7 +75,7 @@ def callback(arg, dirname, fnames):
d = datetime.date.today()
resultdir = "results/" + d.isoformat() + "/" + simname
if not os.path.isdir(resultdir):
subprocess.getoutput("mkdir -p " + resultdir)
os.makedirs (resultdir)
simulation_report = TempXMLElement("Simulation")
simulation_report.addAttribute("name", simname)
......@@ -107,22 +109,26 @@ def main(argv):
d = datetime.date.today()
rep.appendReport("Results: http://amas.web.psi.ch/regressiontests/results_%s_%s_%s.xml \n\n" % (d.day, d.month, d.year))
#various paths needed
www_folder = os.getenv("REGTEST_WWW")
if www_folder is None:
www_folder = "/afs/psi.ch/project/amas/www/regressiontests"
rep.appendReport("Error: REGTEST_WWW not set")
bailout(runAsUser)
return
os.chdir(sys.path[0]) #chdir to path of script
rundir = os.getcwd()
regdir = '/run'.join((rundir.split("/run"))[0:-1])
if not os.getenv("OPAL_EXE_PATH"):
rep.appendReport("Error: OPAL_EXE_PATH not set")
bailout(runAsUser)
return
if not os.path.isfile(os.getenv("OPAL_EXE_PATH") + "/opal"):
rep.appendReport("Error: OPAL_EXE_PATH is invalid")
bailout(runAsUser)
return
# tests are one level up starting from directory of this script
rundir = sys.path[0] # get absolute path name of this script
regdir = os.path.dirname (rundir)
#FIXME
srcdir = os.getenv("OPAL_ROOT")
if srcdir is None:
srcdir = "/gpfs/homefelsim/l_felsimsvn/work/opal/"
builddir = rundir + "/build"
d = datetime.date.today()
global totalNrPassed
global totalNrTests
totalNrTests = 0
......@@ -130,7 +136,7 @@ def main(argv):
runAsUser = False
runtests = list()
run_local = False
publish_local = True
do_publish = True
if "--run-local" in argv:
run_local = True
......@@ -153,27 +159,9 @@ def main(argv):
os.environ["SGE_ROOT"]="/gpfs/homefelsim/export/sge"
os.environ["SGE_CLUSTER_NAME"]="sgeclusterfelsim"
os.environ["PATH"]= os.getenv("PATH") + ":/gpfs/homefelsim/export/sge/bin/lx24-amd64:/usr/kerberos/bin"
print (subprocess.getoutput("/bin/env"))
#rep.appendReport(subprocess.getoutput("/bin/env"))
#klog to be able to do svn stuff
os.environ["KRB5_CONFIG"] = "/home2/l_felsimsvn/krb5.conf"
subprocess.getoutput("/usr/kerberos/bin/kinit -V -k -t ~/.krb5.keytab.D.PSI.CH l_felsimsvn@D.PSI.CH")
#subprocess.getoutput("kinit -k -t ~/.krb5.keytab l_felsimsvn")
#check if user also wants build test
if "--build" in argv:
buildopal = Builder(srcdir, "OPAL", "src/opal", builddir)
totalNrTests += 1
if buildopal.build():
totalNrPassed += 1
else:
rep.appendReport("Build-test failed! Exiting..")
bailout(runAsUser)
return
if "--dont-publish" in argv:
publish_local = False
do_publish = False
queue = ""
for arg in argv:
......@@ -184,43 +172,24 @@ def main(argv):
sys.exit()
queue = "-q " + tmp[1]
#check if user has already set an OPAL executable
#if not use the one from the last build test
env = os.getenv("OPAL_EXE_PATH")
if env is None:
os.environ["OPAL_EXE_PATH"] = builddir + "/src"
rep.appendReport("\n")
rep.appendReport("Start Regression Test on %s \n" % datetime.datetime.today())
rep.appendReport("==========================================================\n")
#only run regression tests if opal executable is valid
if os.path.isfile(os.getenv("OPAL_EXE_PATH") + "/opal"):
os.chdir(regdir)
#first update all tests and regression test files
#FIXME: detect SCM
if os.path.isdir(regdir + "/.svn") and not runAsUser:
subprocess.getoutput("svn update")
#walk the run dir tree
arglist = [runtests, run_local, queue]
for root, dirs, files in os.walk("./"):
callback(arglist, root, files)
else:
rep.appendReport("Error: OPAL_EXE_PATH is invalid")
bailout(runAsUser)
return
rep.dumpXML("results.xml")
#cp report to webdir and add entry in index.html
if not runAsUser:
subprocess.getoutput("/usr/kerberos/bin/kinit -V -k -t ~/.krb5.keytab.D.PSI.CH l_felsimsvn@D.PSI.CH")
subprocess.getoutput("/usr/bin/aklog")
failedtests = rep.NrFailed()
brokentests = rep.NrBroken()
webfilename = "results_%s_%s_%s.xml" % (d.day, d.month, d.year)
subprocess.getoutput("cp results.xml " + www_folder + "/" + webfilename)
shutil.copy ("results.xml", www_folder + "/" + webfilename)
subprocess.getoutput("cp -rf plots_" + d.isoformat() + " " + www_folder + "/")
indexhtml = open(www_folder + "/index.html").readlines()
for line in range(len(indexhtml)):
......@@ -231,7 +200,7 @@ def main(argv):
indexhtmlout.writelines(indexhtml)
indexhtmlout.close()
#update xslt formating file
subprocess.getoutput("cp " + rundir + "/results.xslt " + www_folder + "/")
shutil.copy (rundir + "/results.xslt", www_folder + "/")
#update manual
OpalDocumentation()
......@@ -239,11 +208,11 @@ def main(argv):
#update doxygen
OpalDoxygen()
if publish_local:
if do_publish:
failedtests = rep.NrFailed()
brokentests = rep.NrBroken()
webfilename = "results_%s_%s_%s.xml" % (d.day, d.month, d.year)
subprocess.getoutput("cp results.xml " + www_folder + "/" + webfilename)
shutil.copy ("results.xml", www_folder + "/" + webfilename)
subprocess.getoutput("cp -rf plots_" + d.isoformat() + " " + www_folder + "/")
indexhtml = open(www_folder + "/index.html").readlines()
for line in range(len(indexhtml)):
......@@ -254,21 +223,18 @@ def main(argv):
indexhtmlout.writelines(indexhtml)
indexhtmlout.close()
#update xslt formating file
subprocess.getoutput("cp " + rundir + "/results.xslt " + www_folder + "/")
shutil.copy (rundir + "/results.xslt", www_folder + "/")
#move xml results to result-dir
if os.path.isfile('results.xml'):
resultdir = regdir + "/results/" + d.isoformat()
if not os.path.isdir(resultdir):
subprocess.getoutput("mkdir -p " + resultdir)
os.mkdir (resultdir)
subprocess.getoutput("cp -rf " + "results.xml " + resultdir)
if runAsUser:
subprocess.getoutput("rm -rf " + regdir + "/plots_" + d.isoformat())
else:
subprocess.getoutput("kdestroy")
bailout(runAsUser)
#call main
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment