Skip to content
Snippets Groups Projects
Commit 581d8748 authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Add compile before exec to get clean backtrace

parent 7a60afc9
No related branches found
No related tags found
1 merge request!6amfe v1.0.5
Pipeline #7108 passed
# -*- coding: utf-8 -*-
# Copyright 2020 University of Liège
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
......@@ -96,7 +96,7 @@ def findbins(modname, dirB=['build','wavesB'], verb=False): # changer wavesB en
print("[findbins] looking for linux/mingw libs")
libpath.append( os.path.join(spath, 'bin') ) # also for win-mingw
# check the paths one by one
# check the paths one by one
for p in libpath:
if os.path.isdir(p):
if verb:
......@@ -156,12 +156,12 @@ def initMKL(verb=False):
# Display variables
if verb:
for s in ['OMP', 'MKL', 'KMP']:
print('* %s environment:' % s)
print('* %s environment:' % s)
for key, value in os.environ.items():
if s in key:
print(' %s = %s' % (key, value))
print('')
# ------------------------------------------------------------------------------
def setupwdir(testname):
......@@ -183,7 +183,7 @@ def setupwdir(testname):
name = "noname"
import os, os.path
# builds the name of the workspace folder
# builds the name of the workspace folder
#print "__file__=",__file__
dir1 = os.path.abspath(os.path.dirname(__file__)+os.sep+"..")+os.sep
print("dir1=",dir1)
......@@ -193,7 +193,7 @@ def setupwdir(testname):
resdir = testname[len(common):].replace(os.sep,"_")
resdir = os.path.splitext(resdir)[0] # remove ".py"
if siz>1:
# append the mpi size if mpi is used
# append the mpi size if mpi is used
# (so that the same test can be run concurrently with
# sevral mpi sizes in ctest)
resdir += "_mpi%d" % siz
......@@ -215,10 +215,10 @@ def setupwdir(testname):
os.remove(fpth)
elif os.path.isdir(fpth):
shutil.rmtree(fpth)
if siz>1: # if multiple process => send sync to slaves.
comm.Barrier()
# we can now safely go into the new folder
os.chdir(wdir)
......@@ -300,4 +300,5 @@ def run():
print("starting test", testname)
print("time:", time.strftime("%c"))
print("hostname:", socket.gethostname())
exec(open(testname, 'r', encoding='utf8').read(), globals(), globals()) # exec at global level!!
script = open(testname, 'r', encoding='utf-8').read()
exec(compile(script, testname, 'exec'), {'__file__': testname, '__name__':'__main__'}) # compile to get clean backtrace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment