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

test: added simple tests for fb_user

parent 96cdace1
Branches
No related tags found
1 merge request!2Feature "replay with feedback" ready and tested
...@@ -11,6 +11,7 @@ empty_workload = Workload( ...@@ -11,6 +11,7 @@ empty_workload = Workload(
two_machine_platform = Platform( two_machine_platform = Platform(
name='two_machine_platform', filename='test/platforms/multicore/toy_pform_taurus_like.xml') name='two_machine_platform', filename='test/platforms/multicore/toy_pform_taurus_like.xml')
def make_user_description_file(file_path, user_name, user_category, input_json): def make_user_description_file(file_path, user_name, user_category, input_json):
user_description = { user_description = {
"users": [ "users": [
...@@ -26,6 +27,7 @@ def make_user_description_file(file_path, user_name, user_category, input_json): ...@@ -26,6 +27,7 @@ def make_user_description_file(file_path, user_name, user_category, input_json):
with open(file_path, 'w') as user_description_file: with open(file_path, 'w') as user_description_file:
json.dump(user_description, user_description_file) json.dump(user_description, user_description_file)
def launch_fb_test(user_category, test_input): def launch_fb_test(user_category, test_input):
make_user_description_file( make_user_description_file(
file_path=f'test/schedconf/{user_category}.json', file_path=f'test/schedconf/{user_category}.json',
...@@ -38,13 +40,51 @@ def launch_fb_test(user_category, test_input): ...@@ -38,13 +40,51 @@ def launch_fb_test(user_category, test_input):
assert_exec_time_equals_profile(out_dir) assert_exec_time_equals_profile(out_dir)
##### Tests ##### ##### Tests #####
def test_tt_only_no_session():
"""Empty SABjson."""
launch_fb_test(user_category='fb_user_think_time_only',
test_input='no_session')
def test_tt_only_one_session_many_jobs():
"""One session that contains ten jobs."""
launch_fb_test(user_category='fb_user_think_time_only',
test_input='one_session_many_jobs')
def test_tt_only_many_start_sessions():
"""Five start sessions with no dependency between them."""
launch_fb_test(user_category='fb_user_think_time_only',
test_input='many_start_sessions')
def test_tt_only_zero_think_time():
"""Two sessions following each other, with a think time of 0s between them."""
launch_fb_test(user_category='fb_user_think_time_only',
test_input='zero_think_time')
def test_tt_only_many_following():
"""A session (session 1) has five followers, four with a think time of 1000s and one with a think time of 2000s."""
launch_fb_test(user_category='fb_user_think_time_only',
test_input='many_following')
def test_tt_only_many_preceding():
"""A session (session 6) depends on five others, with a think time of 1000s."""
launch_fb_test(user_category='fb_user_think_time_only',
test_input='many_preceding')
def test_tt_only_simple_workload(): def test_tt_only_simple_workload():
"""A simple SAB json. See diagram https://app.diagrams.net/#G1tbo7oHahsgxTmhICucCGam5XNtshOUOb""" """A simple SAB json. See diagram https://app.diagrams.net/#G1tbo7oHahsgxTmhICucCGam5XNtshOUOb"""
launch_fb_test(user_category = 'fb_user_think_time_only', launch_fb_test(user_category='fb_user_think_time_only',
test_input = 'proto_SABjson_v2') test_input='proto_SABjson_v2')
def test_tt_only_fully_loaded_platform(): def test_tt_only_fully_loaded_platform():
"""Test feedback when platform is fully loaded.""" """Test feedback when platform is fully loaded."""
launch_fb_test(user_category = 'fb_user_think_time_only', launch_fb_test(user_category='fb_user_think_time_only',
test_input = 'load_platform') test_input='load_platform')
{
"description": "A session (session 1) has five followers, four with a think time of 1000s and one with a think time of 2000s.",
"nb_res": 16,
"sessions": [
{
"id": 1,
"first_submit_time": 0.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 1,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 2,
"first_submit_time": 2000.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [1000],
"nb_jobs": 1,
"jobs": [
{
"id": 2,
"profile": "2000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 3,
"first_submit_time": 2000.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [1000],
"nb_jobs": 1,
"jobs": [
{
"id": 3,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 4,
"first_submit_time": 2000.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [1000],
"nb_jobs": 1,
"jobs": [
{
"id": 4,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 5,
"first_submit_time": 2000.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [1000],
"nb_jobs": 1,
"jobs": [
{
"id": 5,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 6,
"first_submit_time": 3000.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [2000],
"nb_jobs": 1,
"jobs": [
{
"id": 6,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
}
]
}
\ No newline at end of file
{
"description": "A session (session 6) depends on five others, with a think time of 1000s.",
"nb_res": 16,
"sessions": [
{
"id": 1,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 1,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 2,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 2,
"profile": "2000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 3,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 3,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 4,
"first_submit_time": 1500.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 4,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 5,
"first_submit_time": 2000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 5,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 6,
"first_submit_time": 2000.0,
"preceding_sessions": [1,2,3,4,5],
"thinking_time_after_preceding_session": [1000,1000,1000,1000,1000],
"nb_jobs": 1,
"jobs": [
{
"id": 6,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
}
]
}
\ No newline at end of file
{
"description": "Five start sessions with no dependency between them.",
"nb_res": 16,
"sessions": [
{
"id": 1,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 1,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 2,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 2,
"profile": "2000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 3,
"first_submit_time": 1000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 3,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 4,
"first_submit_time": 1500.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 4,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 5,
"first_submit_time": 2000.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 5,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
}
]
}
\ No newline at end of file
{
"description": "Empty SABjson.",
"nb_res": 0,
"sessions": []
}
\ No newline at end of file
{
"description": "One session that contains ten jobs.",
"nb_res": 16,
"sessions": [
{
"id": 1,
"first_submit_time": 0.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 10,
"jobs": [
{
"id": 750,
"profile": "450",
"res": 16,
"subtime": 0.0,
"walltime": 86400.0
},
{
"id": 751,
"profile": "210",
"res": 16,
"subtime": 591.0,
"walltime": 86400.0
},
{
"id": 752,
"profile": "81540",
"res": 16,
"subtime": 767.0,
"walltime": 163068.0
},
{
"id": 757,
"profile": "86140",
"res": 16,
"subtime": 895.0,
"walltime": 172260.0
},
{
"id": 758,
"profile": "86130",
"res": 16,
"subtime": 959.0,
"walltime": 172250.0
},
{
"id": 768,
"profile": "920",
"res": 16,
"subtime": 1537.0,
"walltime": 86400.0
},
{
"id": 781,
"profile": "290",
"res": 16,
"subtime": 1841.0,
"walltime": 86400.0
},
{
"id": 791,
"profile": "86130",
"res": 16,
"subtime": 2068.0,
"walltime": 172248.0
},
{
"id": 794,
"profile": "86120",
"res": 16,
"subtime": 2149.0,
"walltime": 172226.0
},
{
"id": 795,
"profile": "86130",
"res": 16,
"subtime": 2533.0,
"walltime": 172246.0
}
]
}
]
}
\ No newline at end of file
{
"description": "Two sessions following each other, with a think time of 0s between them.",
"nb_res": 16,
"sessions": [
{
"id": 1,
"first_submit_time": 0.0,
"preceding_sessions": [],
"thinking_time_after_preceding_session": [],
"nb_jobs": 1,
"jobs": [
{
"id": 1,
"profile": "1000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
},
{
"id": 2,
"first_submit_time": 2000.0,
"preceding_sessions": [1],
"thinking_time_after_preceding_session": [0],
"nb_jobs": 1,
"jobs": [
{
"id": 2,
"profile": "2000",
"res": 16,
"subtime": 0.0,
"walltime": 2592000.0
}
]
}
]
}
\ 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