From 34777e3df8988f6fd1749a504897ab87bab322e7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 25 May 2012 15:11:00 +0000 Subject: [PATCH] some smaller improvements on the intel compilation test --- lib/damask/test/test.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index bc66889c0..8cb1a6b45 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # $Id$ -import os, sys +import os, sys, shlex import subprocess,shutil,string import damask from optparse import OptionParser @@ -29,7 +29,7 @@ class Test(): (self.options, self.args) = self.parser.parse_args() def execute(self,variants = [],update = []): - + ''' Run all variants and report first failure. ''' @@ -44,19 +44,10 @@ class Test(): self.update(variant) elif not self.compare(variant): return variant - except: + except Exception,e : + print '\nWARNING:\n %s\n'%e return variant return -1 - # for self.current_variant_index,variant in enumerate(variants): - # self.prepare(variant) - # self.run(variant) - # self.postprocess(variant) - # if self.current_variant_index in update: - # self.update(variant) - # elif not self.compare(variant): - # return variant - # return -1 - def clean(self): ''' @@ -148,10 +139,14 @@ class Test(): except: print 'Current2Current: Unable to copy file ', file - def execute_inCurrentDir(self,cmd): + def execute_inCurrentDir(self,cmd,outfile='execute_log.txt'): os.chdir(self.dirCurrent()) + file=open(outfile,'a+') print cmd - os.system(cmd) + process = subprocess.Popen(shlex.split(cmd),stdout = file,stderr = subprocess.STDOUT) + file.close() + process.wait() + def compare_Array(self,ref,cur): import numpy