Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SST test frameworks #1124

Draft
wants to merge 2 commits into
base: devel
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/sst/core/testingframework/sst_unittest_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
from test_engine_support import OSCommand
from test_engine_support import check_param_type

from warnings import warn
if not sys.warnoptions:
import os, warnings
warnings.simplefilter("once") # Change the filter in this process
os.environ["PYTHONWARNINGS"] = "once" # Also affect subprocesses

################################################################################

OS_DIST_OSX = "OSX"
Expand Down Expand Up @@ -136,6 +142,9 @@ def testing_is_PIN_Compiled():
return rtn

def testing_is_PIN2_used():
warn("testing_is_PIN2_used() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)

global pin_exec_path
if testing_is_PIN_Compiled():
if "/pin.sh" in pin_exec_path:
Expand Down Expand Up @@ -179,6 +188,8 @@ def host_os_get_system_node_name():
Returns:
(str) Returns the system node name
"""
warn("host_os_get_system_node_name() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.node()

###
Expand All @@ -189,6 +200,8 @@ def host_os_get_kernel_type():
Returns:
(str) 'Linux' or 'Darwin' as the Kernel Type
"""
warn("host_os_get_kernel_type() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.system()

def host_os_get_kernel_release():
Expand All @@ -197,6 +210,8 @@ def host_os_get_kernel_release():
Returns:
(str) Kernel Release Number. Note: This is not the same as OS version
"""
warn("host_os_get_kernel_release() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.release()

def host_os_get_kernel_arch():
Expand All @@ -205,6 +220,8 @@ def host_os_get_kernel_arch():
Returns:
(str) 'x86_64' on Linux; 'i386' on OSX as the Kernel Architecture
"""
warn("host_os_get_kernel_arch() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return platform.machine()

def host_os_get_distribution_type():
Expand Down Expand Up @@ -261,6 +278,8 @@ def host_os_is_osx():
Returns:
(bool) True if OS Distribution is OSX
"""
warn("host_os_is_osx() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_OSX

def host_os_is_linux():
Expand All @@ -269,6 +288,8 @@ def host_os_is_linux():
Returns:
(bool) True if OS Distribution is Linux
"""
warn("host_os_is_linux() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return not host_os_get_distribution_type() == OS_DIST_OSX

def host_os_is_centos():
Expand All @@ -277,6 +298,8 @@ def host_os_is_centos():
Returns:
(bool) True if OS Distribution is CentOS
"""
warn("host_os_is_centos() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_CENTOS

def host_os_is_rhel():
Expand All @@ -285,6 +308,8 @@ def host_os_is_rhel():
Returns:
(bool) True if OS Distribution is RHEL
"""
warn("host_os_is_rhel() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_RHEL

def host_os_is_toss():
Expand All @@ -293,6 +318,8 @@ def host_os_is_toss():
Returns:
(bool) True if OS Distribution is Toss
"""
warn("host_os_is_toss() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_TOSS

def host_os_is_ubuntu():
Expand All @@ -301,6 +328,8 @@ def host_os_is_ubuntu():
Returns:
(bool) True if OS Distribution is Ubuntu
"""
warn("host_os_is_ubuntu() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_UBUNTU

def host_os_is_rocky():
Expand All @@ -309,6 +338,8 @@ def host_os_is_rocky():
Returns:
(bool) True if OS Distribution is Rocky
"""
warn("host_os_is_rocky() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
return host_os_get_distribution_type() == OS_DIST_ROCKY


Expand All @@ -320,6 +351,8 @@ def host_os_get_num_cores_on_system():
Returns:
(int) Number of cores on the system
"""
warn("host_os_get_num_cores_on_system() is deprecated and will be removed in future versions of SST.",
DeprecationWarning, stacklevel=2)
num_cores = multiprocessing.cpu_count()
return num_cores

Expand Down
Loading