From f7d359ee6f90b1ac0f671ce26e659728f0474f41 Mon Sep 17 00:00:00 2001 From: joshuasbrown Date: Tue, 27 Oct 2020 08:52:02 -0600 Subject: [PATCH 1/2] Add parthenon root dir to parameters --- tst/regression/utils/test_case.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tst/regression/utils/test_case.py b/tst/regression/utils/test_case.py index 538dd294bee8..e9817b0c2536 100644 --- a/tst/regression/utils/test_case.py +++ b/tst/regression/utils/test_case.py @@ -28,6 +28,7 @@ class Parameters(): driver_input_path = "" test_path = "" output_path = "" + parthenon_path = "" mpi_cmd = "" num_ranks = 1 mpi_opts = "" @@ -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 From 0092f8145008b2cd1876bb22fca60cf06cbb1bbd Mon Sep 17 00:00:00 2001 From: joshuasbrown Date: Tue, 27 Oct 2020 09:07:30 -0600 Subject: [PATCH 2/2] Utilize parameters path to root of parthenon --- .../test_suites/output_hdf5/output_hdf5.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tst/regression/test_suites/output_hdf5/output_hdf5.py b/tst/regression/test_suites/output_hdf5/output_hdf5.py index fcd88fcf4fec..a3b89d059b80 100644 --- a/tst/regression/test_suites/output_hdf5/output_hdf5.py +++ b/tst/regression/test_suites/output_hdf5/output_hdf5.py @@ -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 @@ -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