Skip to content

Commit

Permalink
Merge pull request #340 from lanl/JoshuaSBrown/add_parthenon_dir_to_t…
Browse files Browse the repository at this point in the history
…est_cast_parameters

Add parthenon root dir to parameters
  • Loading branch information
Joshua S Brown authored Oct 29, 2020
2 parents edc46cd + 8cb73ef commit b7d2436
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
15 changes: 3 additions & 12 deletions tst/regression/test_suites/output_hdf5/output_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,7 @@ def Analyse(self,parameters):
analyze_status = True
print(os.getcwd())

# Determine path to parthenon installation
# Fallback to relative path on failure
try:
parthenonPath = os.path.realpath(__file__)
idx = parthenonPath.rindex('/parthenon/')
parthenonPath = os.path.join(parthenonPath[:idx],'parthenon')
except ValueError:
baseDir = os.path.dirname(__file__)
parthenonPath = baseDir + '/../../../..'
sys.path.insert(1, parthenonPath+'/scripts/python')
sys.path.insert(1, parameters.parthenon_path + '/scripts/python')

try:
import phdf_diff
Expand All @@ -101,10 +92,10 @@ def Analyse(self,parameters):
# TODO(pgrete) make sure this also works/doesn't fail for the user
ret_2d = phdf_diff.compare([
'advection_2d.out0.00001.phdf',
parthenonPath+'/tst/regression/gold_standard/advection_2d.out0.00001.phdf'])
parameters.parthenon_path + '/tst/regression/gold_standard/advection_2d.out0.00001.phdf'])
ret_3d = phdf_diff.compare([
'advection_3d.out0.00001.phdf',
parthenonPath+'/tst/regression/gold_standard/advection_3d.out0.00001.phdf'])
parameters.parthenon_path + '/tst/regression/gold_standard/advection_3d.out0.00001.phdf'])

if ret_2d != 0 or ret_3d != 0:
analyze_status = False
Expand Down
9 changes: 9 additions & 0 deletions tst/regression/utils/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Parameters():
driver_input_path = ""
test_path = ""
output_path = ""
parthenon_path = ""
mpi_cmd = ""
num_ranks = 1
mpi_opts = ""
Expand Down Expand Up @@ -82,6 +83,14 @@ def __init__(self,run_test_path,**kwargs):
else:
output_path = os.path.abspath(output_path)

try:
parthenon_path = os.path.realpath(__file__)
idx = parthenon_path.rindex('/parthenon/')
self.parameters.parthenon_path = os.path.join(parthenon_path[:idx],'parthenon')
except ValueError:
baseDir = os.path.dirname(__file__)
self.parameters.parthenon_path = os.path.abspath(baseDir + '/../../../')

self.__test_module = 'test_suites.' + test_base_name + '.' + test_base_name

test_module = 'test_suites.' + test_base_name + '.' + test_base_name
Expand Down

0 comments on commit b7d2436

Please sign in to comment.