Commit 8dbb96c3 authored by Brewer, Wes's avatar Brewer, Wes
Browse files

Add support for running separate tests, e.g. `python smoke.py frontier`

parent d2bd3b0f
Loading
Loading
Loading
Loading
+30 −7
Original line number Diff line number Diff line
import os
import argparse
import subprocess

# Define the data path
@@ -16,6 +17,8 @@ SYSTEMS = {
    "adastraMI250": "adastra/AdastaJobsMI250_15days.parquet"
}

VALID_CHOICES = list(SYSTEMS.keys()) + ["synthetic"]

def run_command(command):
    """Helper function to run a shell command."""
    print(f"Running: {command}")
@@ -29,10 +32,14 @@ def build_command(system, file_paths, additional_args=""):
    full_paths = " ".join([os.path.join(DATAPATH, path) for path in file_paths.split()])
    return f"python main.py --system {system} -f {full_paths} -t {DEFAULT_TIME} {additional_args}".strip()

def execute_system_tests():
    """Execute tests for all systems."""
    for system, file_paths in SYSTEMS.items():
        command = build_command(system, file_paths)
def execute_system_tests(system=None):
    """Execute tests for all systems or a specific system."""
    if system:
        command = build_command(system, SYSTEMS[system])
        run_command(command)
    else:
        for sys_name, file_paths in SYSTEMS.items():
            command = build_command(sys_name, file_paths)
            run_command(command)

def synthetic_workload_tests():
@@ -45,7 +52,23 @@ def synthetic_workload_tests():
    run_command(f"python multi-part-sim.py -x setonix/part-cpu setonix/part-gpu -t {DEFAULT_TIME}")

def main():
    """Main function to run all tests."""
    """Main function to parse arguments and run tests."""
    parser = argparse.ArgumentParser(description="Run smoke tests for HPC systems.")
    parser.add_argument(
        "system",
        nargs="?",  # Optional argument
        choices=VALID_CHOICES,  # Allow specific systems and 'synthetic'
        help="Run tests for a specific system (e.g., 'frontier') or 'synthetic' workloads. If omitted, all tests run.",
    )

    args = parser.parse_args()

    if args.system == "synthetic":
        synthetic_workload_tests()
    elif args.system:
        execute_system_tests(args.system)
    else:
        # If no argument, run all tests
        synthetic_workload_tests()
        execute_system_tests()