-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge latest `devel` into `master` for Github public release See merge request olcf-system-test/olcf-test-harness!40
- Loading branch information
Showing
147 changed files
with
7,327 additions
and
4,785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
# Ignore python bytecode file. | ||
# *.pyc | ||
**/__pycache__ | ||
|
||
#Ignore all html files. | ||
*.html | ||
|
||
# Ignore all *.doctree files. These files are | ||
# generated when sphinx-doc creates python documentation. | ||
*.doctree | ||
|
||
# Ignore all files in the sphinx documentation build directory. | ||
doc-sphinx/build | ||
|
||
# Ignore all files with *.orig suffix | ||
*.orig" | ||
|
||
# Ignore all vim temporary files. | ||
*.swp | ||
*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#----------------------------------------------------- | ||
# GIT_STRATEGY : - | ||
# Set the GIT_STRATEGY used for getting recent - | ||
# application code. See - | ||
# https://docs.gitlab.com/ee/ci/yaml/README.html - | ||
# for more details on GIT_STRATEGY. - | ||
# - | ||
# HUT_MACHINE_NAME : - | ||
# The name of the machine the unit tests. - | ||
# We use this variable to select the correct - | ||
# runtime environment. - | ||
# - | ||
# HUT_CONFIG_TAG : - | ||
# A unique identifier that corresponds to the - | ||
# HARNESS test configuration for a particular - | ||
# machine. - | ||
# - | ||
# HUT_PATH_TO_SSPACE: - | ||
# The path to the scratch space directory - | ||
# where the unit machine specfifc unit tests - | ||
# are run. - | ||
# - | ||
# HUT_RTE_ENV_FILE: - | ||
# A Lua module file, lmod, that when set ups the - | ||
# Harness unit test runtime environment. - | ||
# The lmod filename is formed by the combining the - | ||
# HUT_CONFIG_TAG and HUT_RTE_ENV_FILE - | ||
# variables as follows: - | ||
# "${HUT_MACHINE_NAME}-${HUT_CONFIG_TAG}.environment.sh" - | ||
# - | ||
# HUT_SCHED_ACCT_ID: - | ||
# The account to be used with the job resource - | ||
# manager and scheduler. - | ||
# - | ||
#----------------------------------------------------- | ||
variables: | ||
GIT_STRATEGY : fetch | ||
HUT_MACHINE_NAME : 'GenericMachine' | ||
HUT_CONFIG_TAG: 'GenericConfigTag' | ||
HUT_RTE_ENV_FILE: "${HUT_MACHINE_NAME}-${HUT_CONFIG_TAG}.environment.sh" | ||
HUT_PATH_TO_SSPACE: 'NOT_SET' | ||
HUT_SCHED_ACCT_ID: 'NOT_SET' | ||
|
||
#----------------------------------------------------- | ||
# This hidden job defines a template for a set of - | ||
# command commands to setup the Harness unit tests - | ||
# rutime environment. - | ||
# - | ||
#----------------------------------------------------- | ||
.core_tests_template: | ||
timeout : 15 minutes | ||
script : | ||
- bash # Change to the bash shell. | ||
- export OLCF_HARNESS_DIR=${CI_PROJECT_DIR} # Set the HARNESS top level directory. | ||
- export HUT_MACHINE_NAME | ||
- export HUT_CONFIG_TAG | ||
- export HUT_RTE_ENV_FILE | ||
- module --ignore-cache use ${OLCF_HARNESS_DIR}/modulefiles | ||
- module load olcf_harness | ||
- ci_testing_utilities/bin/run_generic_unit_tests.py | ||
- ci_testing_utilities/bin/run_machine_specific_unit_tests.py --machine ${HUT_MACHINE_NAME} --harness-config-tag ${HUT_CONFIG_TAG} | ||
|
||
#----------------------------------------------------- | ||
# This section defines jobs for machine Ascent. - | ||
# - | ||
# Machine: Ascent (OLCF training cluster) - | ||
# Description: - | ||
# LSB Version: core-4.1-noarch:core-4.1-ppc64le- | ||
# Distributor ID: RedHatEnterpriseServer - | ||
# Description: Red Hat Enterprise Linux - | ||
# Server release 7.6 (Maipo) - | ||
# Release: 7.6 - | ||
# Codename: Maipo - | ||
# - | ||
# Architecture: ppc64le - | ||
# Byte Order: Little Endian - | ||
# CPU(s): 128 - | ||
# On-line CPU(s) list: 0-127 - | ||
# Thread(s) per core: 4 - | ||
# Core(s) per socket: 16 - | ||
# Socket(s): 2 - | ||
# NUMA node(s): 6 - | ||
# Model: 2.1 (pvr 004e 1201) - | ||
# Model name: POWER9, altivec supported - | ||
# - | ||
# CUDA Version: 10.1 - | ||
# Driver Version: 418.40.04 - | ||
# 3 GPUs - | ||
# Product Name: Tesla V100-SXM2-16GB - | ||
#----------------------------------------------------- | ||
|
||
# This job performs basic tests on machine Ascent | ||
.Ascent_Basic_Tests : | ||
extends : .core_tests_template | ||
variables : | ||
HUT_MACHINE_NAME : 'Ascent' | ||
HUT_CONFIG_TAG : 'olcf5_acceptance' | ||
HUT_SCHED_ACCT_ID: 'stf006' | ||
tags : | ||
- olcf_harness_unit_tests | ||
|
||
#----------------------------------------------------- | ||
# This section defines jobs for machine Lyra. - | ||
# - | ||
# Machine: Lyra - | ||
# Description: - | ||
# Intentionally left blank - | ||
# - | ||
# This runners runs under user arnoldt on Lyra. - | ||
# Hence we must set the scratch space to a directory - | ||
# user arnoldt can write to, and the account is to - | ||
# stf006. - | ||
#----------------------------------------------------- | ||
Lyra_Basic_Tests : | ||
extends : .core_tests_template | ||
variables : | ||
HUT_MACHINE_NAME : 'lyra' | ||
HUT_CONFIG_TAG : 'olcf5_acceptance' | ||
HUT_PATH_TO_SSPACE : '/ccs/home/arnoldt/scratch_hut' | ||
HUT_SCHED_ACCT_ID: 'stf006' | ||
tags : | ||
- Lyra_OLCF_Harness | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Copyright (c) 2016 UT-Battelle, LLC | ||
Copyright (c) 2021 UT-Battelle, LLC | ||
|
||
All rights reserved. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
__all__ = [ | ||
"harness_unit_tests", | ||
"Ascent" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#! /usr/bin/env python3 | ||
## @package run_basic_unit_tests | ||
# This module contains the main function to run the Harness basic unit tests. | ||
|
||
# System imports | ||
import sys | ||
import string | ||
import argparse # Needed for parsing command line arguments. | ||
import logging # Needed for logging events. | ||
import shlex,subprocess # Needed for launching command line jobs | ||
from collections import OrderedDict | ||
|
||
# Local imports | ||
import harness_unit_tests.test_runtests | ||
from harness_unit_tests.harness_unittests_logging import create_logger_description | ||
from harness_unit_tests.harness_unittests_logging import create_logger | ||
|
||
## @fn parse_arguments( ) | ||
## @brief Parses the command line arguments. | ||
## | ||
## @details Parses the command line arguments and | ||
## returns A namespace. | ||
## | ||
## @return A namespace. The namespace contains attributes | ||
## that are the command line arguments. | ||
def parse_arguments(): | ||
|
||
# Create a string of the description of the | ||
# program | ||
program_description = "Your program description" | ||
|
||
# Create an argument parser. | ||
my_parser = argparse.ArgumentParser( | ||
description=program_description, | ||
formatter_class=argparse.RawTextHelpFormatter, | ||
add_help=True) | ||
|
||
# Add an optional argument for the logging level. | ||
my_parser.add_argument("--log-level", | ||
type=int, | ||
default=logging.WARNING, | ||
help=create_logger_description() ) | ||
|
||
my_args = my_parser.parse_args() | ||
|
||
return my_args | ||
|
||
|
||
|
||
def _do_generic_tests(): | ||
my_unittests = OrderedDict() | ||
my_unittests_return_code = OrderedDict() | ||
|
||
# Add test for runtests.py module. | ||
my_unittests["runtests.py"] = "python3 -m unittest -v harness_unit_tests.test_runtests" | ||
my_unittests_return_code["runtests.py"] = 0 | ||
|
||
for module_name,test_command_line in my_unittests.items(): | ||
args = shlex.split(test_command_line) | ||
my_test_process = subprocess.run(args) | ||
my_unittests_return_code[module_name] = my_test_process.returncode | ||
return my_unittests_return_code | ||
|
||
## @fn main () | ||
## @brief The main function. | ||
def main(): | ||
args = parse_arguments() | ||
|
||
logger = create_logger(log_id='generic_unit_tests.log', | ||
log_level=args.log_level) | ||
|
||
logger.info("Start of main program") | ||
|
||
retcode = 0 | ||
retcode = _do_generic_tests() | ||
|
||
logger.info("End of main program") | ||
|
||
return retcode | ||
|
||
if __name__ == "__main__": | ||
my_unittests_return_code = main() | ||
|
||
if my_unittests_return_code: | ||
nm_failed_tests = 0 | ||
for module_name,test_return_code in my_unittests_return_code.items(): | ||
if test_return_code != 0: | ||
nm_failed_tests += 1 | ||
retcode = 0 if nm_failed_tests == 0 else 1 | ||
else: | ||
retcode = 1 | ||
|
||
sys.exit(retcode) |
116 changes: 116 additions & 0 deletions
116
ci_testing_utilities/bin/run_machine_specific_unit_tests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#! /usr/bin/env python3 | ||
## @package run_basic_unit_tests | ||
# This module contains the main function to run the Harness basic unit tests. | ||
|
||
# System imports | ||
import os | ||
import sys | ||
import string | ||
import argparse # Needed for parsing command line arguments. | ||
import logging # Needed for logging events. | ||
import shlex,subprocess # Needed for launching command line jobs | ||
from collections import OrderedDict | ||
|
||
# Local imports | ||
from harness_unit_tests import harness_unittests_exceptions | ||
from harness_unit_tests.harness_unittests_logging import create_logger_description | ||
from harness_unit_tests.harness_unittests_logging import create_logger | ||
|
||
## @fn parse_arguments( ) | ||
## @brief Parses the command line arguments. | ||
## | ||
## @details Parses the command line arguments and | ||
## returns A namespace. | ||
## | ||
## @return A namespace. The namespace contains attributes | ||
## that are the command line arguments. | ||
def parse_arguments(): | ||
|
||
# Create a string of the description of the | ||
# program | ||
program_description = "Your program description" | ||
|
||
# Create an argument parser. | ||
my_parser = argparse.ArgumentParser( | ||
description=program_description, | ||
formatter_class=argparse.RawTextHelpFormatter, | ||
add_help=True) | ||
|
||
# Add an optional argument for the logging level. | ||
my_parser.add_argument("--log-level", | ||
type=str, | ||
default=logging.WARNING, | ||
help=create_logger_description() ) | ||
|
||
my_parser.add_argument("--machine", | ||
type=str, | ||
help="The name of the machine", | ||
required=True) | ||
|
||
my_parser.add_argument("--harness-config-tag", | ||
type=str, | ||
help="The harness configig tag", | ||
required=True) | ||
|
||
my_args = my_parser.parse_args() | ||
|
||
return my_args | ||
|
||
def _do_machine_specific_tests(): | ||
my_machine_name = os.getenv('HUT_MACHINE_NAME') | ||
if my_machine_name == None: | ||
message = "The environmental variable HUT_MACHINE_NAME is not set." | ||
raise harness_unittests_exceptions.EnvironmentalVariableNotSet('HUT_MACHINE_NAME',message) | ||
|
||
my_config_tag = os.getenv('HUT_CONFIG_TAG') | ||
if my_config_tag == None: | ||
message = "The environmental variable HUT_CONFIG_TAG is not set." | ||
raise harness_unittests_exceptions.EnvironmentalVariableNotSet('HUT_MACHINE_NAME',message) | ||
|
||
my_unittests = OrderedDict() | ||
my_unittests_return_code = OrderedDict() | ||
|
||
# Add test for machine specific tests. | ||
my_unittests["test_machine_specific_tests.py"] = "python3 -m unittest -v harness_unit_tests.test_machine_specific_tests" | ||
my_unittests_return_code["test_machine_specific_tests.py"] = 0 | ||
|
||
for module_name,test_command_line in my_unittests.items(): | ||
args = shlex.split(test_command_line) | ||
my_test_process = subprocess.run(args) | ||
my_unittests_return_code[module_name] = my_test_process.returncode | ||
|
||
return my_unittests_return_code | ||
|
||
## @fn main () | ||
## @brief The main function. | ||
def main(): | ||
args = parse_arguments() | ||
|
||
logger = create_logger(log_id='machine_unit_tests.log', | ||
log_level=args.log_level) | ||
|
||
logger.info("Start of main program") | ||
|
||
retcode = None | ||
try: | ||
retcode = _do_machine_specific_tests() | ||
except harness_unittests_exceptions.EnvironmentalVariableNotSet as err: | ||
print(err.message) | ||
|
||
logger.info("End of main program") | ||
|
||
return retcode | ||
|
||
if __name__ == "__main__": | ||
my_unittests_return_code = main() | ||
|
||
if my_unittests_return_code: | ||
nm_failed_tests = 0 | ||
for module_name,test_return_code in my_unittests_return_code.items(): | ||
if test_return_code != 0: | ||
nm_failed_tests += 1 | ||
retcode = 0 if nm_failed_tests == 0 else 1 | ||
else: | ||
retcode = 1 | ||
|
||
sys.exit(retcode) |
Oops, something went wrong.