Skip to content

Commit

Permalink
Fix test logic for shared array (#1160)
Browse files Browse the repository at this point in the history
* Fix shared array test
* Remove use of deprecated functions in test suites and frameworks
  • Loading branch information
gvoskuilen authored Oct 10, 2024
1 parent 2b5da60 commit d622a26
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/sst/core/testElements/coreTest_SharedObjectComponent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ coreTestSharedObjectsComponent::coreTestSharedObjectsComponent(SST::ComponentId_
array.write(myid, myid);
}
if ( pub ) array.publish();
int readval = array.mutex_read(myid);
if ( !full_initialization && readval != myid ) {
out.fatal(CALL_INFO, 100, "ERROR: SharedArray does not contain expected data\n");
if ( !full_initialization ) {
int readval = array.mutex_read(myid);
if ( readval != myid ) { out.fatal(CALL_INFO, 100, "ERROR: SharedArray does not contain expected data\n"); }
}
}
else if ( test_bool_array && !late_initialize ) {
Expand Down
8 changes: 4 additions & 4 deletions src/sst/core/testingframework/sst_unittest_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def testing_is_PIN_loaded() -> bool:

def testing_is_PIN_Compiled() -> bool:
global pin_exec_path
pin_crt = sst_elements_config_include_file_get_value_int("HAVE_PINCRT", 0, True)
pin_exec = sst_elements_config_include_file_get_value_str("PINTOOL_EXECUTABLE", "", True)
pin_crt = sst_elements_config_include_file_get_value(define="HAVE_PINCRT", type=int, default=0, disable_warning=True)
pin_exec = sst_elements_config_include_file_get_value(define="PINTOOL_EXECUTABLE", type=str, default="", disable_warning=True)
#log_debug("testing_is_PIN_Compiled() - Detected PIN_CRT = {0}".format(pin_crt))
#log_debug("testing_is_PIN_Compiled() - Detected PIN_EXEC = {0}".format(pin_exec))
pin_exec_path = pin_exec
Expand Down Expand Up @@ -238,7 +238,7 @@ def host_os_get_distribution_type() -> str:
'ROCKY' for Rocky;
'UNDEFINED' an undefined OS.
"""
k_type = host_os_get_kernel_type()
k_type = platform.system()
if k_type == 'Linux':
lin_dist = _get_linux_distribution()
dist_name = lin_dist[0].lower()
Expand All @@ -262,7 +262,7 @@ def host_os_get_distribution_version() -> str:
Returns:
(str) The OS distribution version
"""
k_type = host_os_get_kernel_type()
k_type = platform.system()
if k_type == 'Linux':
lin_dist = _get_linux_distribution()
return lin_dist[1]
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite_default_PerfComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ 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(sst_core_config_include_file_get_value(define="SST_PERFORMANCE_INSTRUMENTING", type=int, default=0, disable_warning=True) > 0):
if os.path.isfile(perfdata_out):
os.system("mv {0} {1}".format(perfdata_out, perfdata_sav))
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite_default_StatisticsComponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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 = sst_core_config_include_file_get_value(define="HAVE_HDF5", type=int, default=0, disable_warning=True) == 1


class testcase_StatisticComponent(SSTTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite_default_config_input_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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 = sst_core_config_include_file_get_value(define="SST_CONFIG_HAVE_MPI", type=int, default=0, disable_warning=True) == 1


class testcase_Config_input_output(SSTTestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite_default_sstinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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 = sst_core_config_include_file_get_value(define="HAVE_CURSES", type=int, default=0, disable_warning=True) == 1


class testcase_sstinfo(SSTTestCase):
Expand Down Expand Up @@ -47,7 +47,7 @@ def sstinfo_test_template(self, testtype, flags):
errfile = "{0}/test_sstinfo_{1}.err".format(outdir, testtype)

# Get the path to sst-info binary application
sst_app_path = sstsimulator_conf_get_value_str('SSTCore', 'bindir', default="UNDEFINED")
sst_app_path = sstsimulator_conf_get_value(section='SSTCore', key='bindir', type=str, default="UNDEFINED")
err_str = "Path to SST-INFO {0}; does not exist...".format(sst_app_path)
self.assertTrue(os.path.isdir(sst_app_path), err_str)

Expand Down
20 changes: 10 additions & 10 deletions tests/testsuite_testengine_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,33 @@ def tearDown(self):

############################################################################
# Test read access of the sstsimulator configuration file
# Note: We can only test the sstsimulator_conf_get_value_str(); as we have
# No generic entries for _int, _float, _bool
# Note: We can only test the sstsimulator_conf_get_value() with type=str;
# as we have no generic entries for _int, _float, _bool
############################################################################

def test_support_functions_get_info_from_sstsimulator_conf_success(self):
# This should pass as we give valid data
log_forced("NOTE: This Test Has an Expected Pass and should show as 'PASS'")
sourcedir = sstsimulator_conf_get_value_str("SSTCore", "sourcedir")
sourcedir = sstsimulator_conf_get_value(section="SSTCore", key="sourcedir", type=str)
log_forced("SSTCore SourceDir = {0}; Type = {1}".format(sourcedir, type(sourcedir)))
self.assertIsInstance(sourcedir, str)

def test_support_functions_get_info_from_sstsimulator_conf_invalid_section_exception_success(self):
# This should pass as we detect an expected exception due to invalid section
log_forced("NOTE: This Test Has an Expected Pass (BUT GENERATES A WARNING) and should show as 'PASS'")
with self.assertRaises(SSTTestCaseException):
sstsimulator_conf_get_value_str("invalid_section", "invalid_key")
sstsimulator_conf_get_value(section="invalid_section", key="invalid_key", type=str)

@unittest.expectedFailure
def test_support_functions_get_info_from_sstsimulator_conf_invalid_key_exception_error(self):
# This should give an error as we detect an exception due to invalid key
log_forced("NOTE: This Test Has an Expected ERROR (BUT GENERATES A WARNING) and should show as 'EXPECTED FAILURE'")
sstsimulator_conf_get_value_str("SSTCore", "invalid_key")
sstsimulator_conf_get_value(section="SSTCore", key="invalid_key", type=str)

def test_support_functions_get_info_from_sstsimulator_conf_invalid_key_rtn_default_success_with_warning(self):
# This should pass by failing to find a valid key and returning a default, but should log a warning
log_forced("NOTE: This Test Has an Expected Pass (BUT GENERATES A WARNING) and should show as 'PASS'")
sourcedir = sstsimulator_conf_get_value_str("SSTCore", "invalid_key", "kilroy_was_here")
sourcedir = sstsimulator_conf_get_value(section="SSTCore", key="invalid_key", type=str, default="kilroy_was_here")
log_forced("SSTCore SourceDir = {0}".format(sourcedir))
self.assertEqual(str, type(sourcedir))
self.assertEqual("kilroy_was_here", sourcedir)
Expand Down Expand Up @@ -197,15 +197,15 @@ def test_support_functions_get_all_key_vaules_from_section_from_sstsimulator_con
def test_support_functions_get_info_from_sst_config_h_valid_key_rtn_int_success(self):
# This should pass as we give/get valid data
log_forced("NOTE: This Test Has an Expected Pass and should show as 'PASS'")
test_define = sst_config_include_file_get_value_int("HAVE_CLOSEDIR", 123)
test_define = sst_config_include_file_get_value(define="HAVE_CLOSEDIR", type=int, default=123)
log_forced("#define HAVE_CLOSEDIR={0}; type={1}".format(test_define, type(test_define)))
self.assertEqual(1, test_define)
self.assertEqual(int, type(test_define))

def test_support_functions_get_info_from_sst_config_h_valid_key_rtn_str_success(self):
# This should pass as we give/get valid data
log_forced("NOTE: This Test Has an Expected Pass and should show as 'PASS'")
test_define = sst_config_include_file_get_value_str("PACKAGE_BUGREPORT", "THIS_IS_DEFAULT_DATA")
test_define = sst_config_include_file_get_value(define="PACKAGE_BUGREPORT", type=str, default="THIS_IS_DEFAULT_DATA")
log_forced("#define PACKAGE_BUGREPORT={0}; type={1}".format(test_define, type(test_define)))
self.assertEqual("[email protected]", test_define)
self.assertEqual(str, type(test_define))
Expand All @@ -214,7 +214,7 @@ def test_support_functions_get_info_from_sst_config_h_invalid_key_rtn_default_st
# This should pass as we give valid data
log_forced("NOTE: This Test Has an Expected Pass (BUT GENERATES A WARNING) and should show as 'PASS'")
# This should pass by returning a default, but should log a warning
test_define = sst_config_include_file_get_value_str("PACKAGE_BUGREPORT_KEYINVALID", "THIS_IS_DEFAULT_DATA")
test_define = sst_config_include_file_get_value(define="PACKAGE_BUGREPORT_KEYINVALID", type=str, default="THIS_IS_DEFAULT_DATA")
log_forced("#define PACKAGE_BUGREPORT_KEYINVALID={0}; type={1}".format(test_define, type(test_define)))
self.assertEqual("THIS_IS_DEFAULT_DATA", test_define)
self.assertEqual(str, type(test_define))
Expand All @@ -223,7 +223,7 @@ def test_support_functions_get_info_from_sst_config_h_invalid_key_exception_succ
# This should pass as we detect an expected exception
log_forced("NOTE: This Test Has an Expected Pass (BUT GENERATES A WARNING) and should show as 'PASS'")
with self.assertRaises(SSTTestCaseException):
test_define = sst_config_include_file_get_value_str("PACKAGE_BUGREPORT_KEYINVALID")
test_define = sst_config_include_file_get_value(define="PACKAGE_BUGREPORT_KEYINVALID", type=str)
log_forced("#define PACKAGE_BUGREPORT_KEYINVALID={0}; type={1}".format(test_define, type(test_define)))

############################################################################
Expand Down

0 comments on commit d622a26

Please sign in to comment.