Skip to content
Snippets Groups Projects
Commit b4a0f67b authored by Maël Madon's avatar Maël Madon
Browse files

test: adapted tests to new SWF sanity checks

parent ebac0712
Branches
No related tags found
No related merge requests found
Pipeline #5312 passed
...@@ -4,7 +4,7 @@ import os, subprocess ...@@ -4,7 +4,7 @@ import os, subprocess
class KTH_WL: class KTH_WL:
swf_file = "workloads/KTH-SP2-1996-2.1-cln.swf" swf_file = "workloads/KTH-SP2-1996-2.1-cln.swf"
nb_users = 214 nb_users = 214
nb_jobs = 28476 nb_jobs = 28475
thresholds = [0, 30, 1440] thresholds = [0, 30, 1440]
...@@ -17,7 +17,7 @@ def create_dir_rec_if_needed(dirname): ...@@ -17,7 +17,7 @@ def create_dir_rec_if_needed(dirname):
def run_script(delim, threshold, def run_script(delim, threshold,
input_swf=KTH_WL.swf_file, test_name=None, input_swf=KTH_WL.swf_file, test_name=None,
dyn_red=True, graph=False): dyn_red=True, graph=False, given_walltime_only=False):
if test_name is None: if test_name is None:
if input_swf == KTH_WL.swf_file: if input_swf == KTH_WL.swf_file:
pfx = "KTH" pfx = "KTH"
...@@ -31,11 +31,13 @@ def run_script(delim, threshold, ...@@ -31,11 +31,13 @@ def run_script(delim, threshold,
create_dir_rec_if_needed(out_dir) create_dir_rec_if_needed(out_dir)
args = ['python3', 'swf2userSessions.py', f'--{delim}', str(threshold), args = ['python3', 'swf2userSessions.py', f'--{delim}', str(threshold),
'-q', '--given_walltime_only', input_swf, out_dir] '-q', input_swf, out_dir]
if graph: if graph:
args.append("--graph") args.append("--graph")
if not dyn_red: if not dyn_red:
args.append("--no_dynamic_reduction") args.append("--no_dynamic_reduction")
if given_walltime_only:
args.append('--given_walltime_only')
cp = subprocess.run(args, check=True) cp = subprocess.run(args, check=True)
......
...@@ -49,24 +49,28 @@ def test_example_workload(): ...@@ -49,24 +49,28 @@ def test_example_workload():
"""Simple tests with example workload""" """Simple tests with example workload"""
test_name = "example_arrival_t60" test_name = "example_arrival_t60"
run_script(delim="arrival", threshold=60, input_swf="workloads/example.swf") run_script(delim="arrival", threshold=60, given_walltime_only=True,
input_swf="workloads/example.swf")
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "example_arrival_t0" test_name = "example_arrival_t0"
run_script(delim="arrival", threshold=0, input_swf="workloads/example.swf") run_script(delim="arrival", threshold=0, given_walltime_only=True,
input_swf="workloads/example.swf")
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "example_arrival_t0_nodyn" test_name = "example_arrival_t0_nodyn"
run_script(delim="arrival", threshold=0, input_swf="workloads/example.swf", run_script(delim="arrival", threshold=0, given_walltime_only=True,
dyn_red=False) input_swf="workloads/example.swf", dyn_red=False)
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "example_max_t0" test_name = "example_max_t0"
run_script(delim="max", threshold=0, input_swf="workloads/example.swf") run_script(delim="max", threshold=0, given_walltime_only=True,
input_swf="workloads/example.swf")
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "example_last_t30" test_name = "example_last_t30"
run_script(delim="last", threshold=30, input_swf="workloads/example.swf") run_script(delim="last", threshold=30, given_walltime_only=True,
input_swf="workloads/example.swf")
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
def test_edge_cases(): def test_edge_cases():
...@@ -74,32 +78,32 @@ def test_edge_cases(): ...@@ -74,32 +78,32 @@ def test_edge_cases():
Same tests than in batmen.""" Same tests than in batmen."""
test_name = "load_platform" test_name = "load_platform"
run_script(delim="arrival", threshold=10, run_script(delim="arrival", threshold=10, given_walltime_only=True,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name) input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "many_following" test_name = "many_following"
run_script(delim="arrival", threshold=0, run_script(delim="arrival", threshold=0, given_walltime_only=True,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name) input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "many_preceding" test_name = "many_preceding"
run_script(delim="arrival", threshold=0, run_script(delim="arrival", threshold=0, given_walltime_only=True,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name) input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "no_session" test_name = "no_session"
run_script(delim="max", threshold=42, run_script(delim="max", threshold=42, given_walltime_only=True,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name) input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
with pytest.raises(FileNotFoundError): with pytest.raises(FileNotFoundError):
load_expected_output(test_name) load_expected_output(test_name)
test_name = "one_session_many_jobs" test_name = "one_session_many_jobs"
run_script(delim="last", threshold=10, run_script(delim="last", threshold=10, given_walltime_only=True,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name) input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
test_name = "zero_think_time" test_name = "zero_think_time"
run_script(delim="last", threshold=0, run_script(delim="last", threshold=0, given_walltime_only=True,
input_swf=f"test/workload/{test_name}.swf", test_name=test_name) input_swf=f"test/workload/{test_name}.swf", test_name=test_name)
compare_with_expected_output(test_name) compare_with_expected_output(test_name)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment