Skip to content

Commit

Permalink
remove sst_core_config_include_file_get_value_*
Browse files Browse the repository at this point in the history
Call get_sst_config_include_file_value() directly
  • Loading branch information
jmlapre committed Aug 28, 2024
1 parent 8799b8c commit b1d30a0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 52 deletions.
54 changes: 6 additions & 48 deletions src/sst/core/testingframework/sst_unittest_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,48 +377,6 @@ def skip_on_sstsimulator_conf_empty_str(section, key, reason):
return lambda func: func
return unittest.skip(reason)

################################################################################
# SST Core Configuration include file (sst_config.h.conf) Access Functions
################################################################################

def sst_core_config_include_file_get_value_int(define, default=None, disable_warning = False):
""" Retrieve a define from the SST Core Configuration Include File (sst_config.h)
Args:
define (str): The define to look for
default (int): Default Return if failure occurs
disable_warning (bool): Disable logging the warning if define is not found
Returns:
(int) The returned data or default if not found in the include file
Raises:
SSTTestCaseException: if type is incorrect OR no data AND default
is not provided
"""
return _get_sst_config_include_file_value(test_engine_globals.TESTENGINE_CORE_CONFINCLUDE_DICT,
"sst_config.h", define, default, int, disable_warning)

###

def sst_core_config_include_file_get_value_str(define, default=None, disable_warning = False):
""" Retrieve a define from the SST Core Configuration Include File (sst_config.h)
Args:
define (str): The define to look for
default (str): Default Return if failure occurs
disable_warning (bool): Disable logging the warning if define is not found
Returns:
(str) The returned data or default if not found in the include file
Raises:
SSTTestCaseException: if type is incorrect OR no data AND default
is not provided
"""
return _get_sst_config_include_file_value(test_engine_globals.TESTENGINE_CORE_CONFINCLUDE_DICT,
"sst_config.h", define, default, str, disable_warning)

################################################################################
# SST Elements Configuration include file (sst_element_config.h.conf) Access Functions
################################################################################
Expand All @@ -438,8 +396,8 @@ def sst_elements_config_include_file_get_value_int(define, default=None, disable
SSTTestCaseException: if type is incorrect OR no data AND default
is not provided
"""
return _get_sst_config_include_file_value(test_engine_globals.TESTENGINE_ELEM_CONFINCLUDE_DICT,
"sst_element_config.h", define, default, int, disable_warning)
return get_sst_config_include_file_value(test_engine_globals.TESTENGINE_ELEM_CONFINCLUDE_DICT,
"sst_element_config.h", define, default, int, disable_warning)

###

Expand All @@ -458,8 +416,8 @@ def sst_elements_config_include_file_get_value_str(define, default=None, disable
SSTTestCaseException: if type is incorrect OR no data AND default
is not provided
"""
return _get_sst_config_include_file_value(test_engine_globals.TESTENGINE_ELEM_CONFINCLUDE_DICT,
"sst_element_config.h", define, default, str, disable_warning)
return get_sst_config_include_file_value(test_engine_globals.TESTENGINE_ELEM_CONFINCLUDE_DICT,
"sst_element_config.h", define, default, str, disable_warning)

################################################################################
# SST Configuration file (sstsimulator.conf) Access Functions
Expand Down Expand Up @@ -1748,8 +1706,8 @@ def _get_linux_version(filepath, sep):
### Generic Internal Support Functions
################################################################################

def _get_sst_config_include_file_value(include_dict, include_source, define, default=None,
data_type=str, disable_warning = False):
def get_sst_config_include_file_value(include_dict, include_source, define, default=None,
data_type=str, disable_warning = False):
""" Retrieve a define from an SST Configuration Include File (sst_config.h or sst-element_config.h)
include_dict (dict): The dictionary to search for the define
include_source (str): The name of the include file we are searching
Expand Down
4 changes: 3 additions & 1 deletion tests/testsuite_default_PerfComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# distribution.

import os
import test_engine_globals
from sst_unittest import *
from sst_unittest_support import *

Expand Down Expand Up @@ -52,7 +53,8 @@ def perf_component_test_template(self, testtype):
perfdata_sav = "{0}/PerfComponent_PerfData.out".format(outdir)

#if SST was built with SST_PERFORMANCE_INSTRUMENTING enabled, then we will also check that the counters are sane
if(sst_core_config_include_file_get_value_int(define="SST_PERFORMANCE_INSTRUMENTING", default=0, disable_warning=True) > 0):
if(get_sst_config_include_file_value(test_engine_globals.TESTENGINE_CORE_CONFINCLUDE_DICT,
"sst_config.h", "SST_PERFORMANCE_INSTRUMENTING", 0, int, True) > 0):
if os.path.isfile(perfdata_out):
os.system("mv {0} {1}".format(perfdata_out, perfdata_sav))
else:
Expand Down
4 changes: 3 additions & 1 deletion tests/testsuite_default_StatisticsComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
import filecmp
import subprocess

import test_engine_globals
from sst_unittest import *
from sst_unittest_support import *


have_h5 = sst_core_config_include_file_get_value_int("HAVE_HDF5", default=0, disable_warning=True) == 1
have_h5 = get_sst_config_include_file_value(test_engine_globals.TESTENGINE_CORE_CONFINCLUDE_DICT,
"sst_config.h", "HAVE_HDF5", 0, int, True) == 1


class testcase_StatisticComponent(SSTTestCase):
Expand Down
4 changes: 3 additions & 1 deletion tests/testsuite_default_config_input_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import os
import sys

import test_engine_globals
from sst_unittest import *
from sst_unittest_support import *


have_mpi = sst_core_config_include_file_get_value_int("SST_CONFIG_HAVE_MPI", default=0, disable_warning=True) == 1
have_mpi = get_sst_config_include_file_value(test_engine_globals.TESTENGINE_CORE_CONFINCLUDE_DICT,
"sst_config.h", "SST_CONFIG_HAVE_MPI", 0, int, True) == 1


class testcase_Config_input_output(SSTTestCase):
Expand Down
4 changes: 3 additions & 1 deletion tests/testsuite_default_sstinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
# information, see the LICENSE file in the top level directory of the
# distribution.

import test_engine_globals
from sst_unittest import *
from sst_unittest_support import *


have_curses = sst_core_config_include_file_get_value_int("HAVE_CURSES", default=0, disable_warning=True) == 1
have_curses = get_sst_config_include_file_value(test_engine_globals.TESTENGINE_CORE_CONFINCLUDE_DICT,
"sst_config.h", "HAVE_CURSES", 0, int, True) == 1


class testcase_sstinfo(SSTTestCase):
Expand Down

0 comments on commit b1d30a0

Please sign in to comment.