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

test: add tests to see if easy_bf and easy_bf_fast have the same output. Tests fail for now.

parent d18ea3ac
No related branches found
No related tags found
1 merge request!19Use the faster implementation of easy backfilling
Pipeline #6009 passed with warnings
...@@ -36,6 +36,7 @@ def pytest_generate_tests(metafunc): ...@@ -36,6 +36,7 @@ def pytest_generate_tests(metafunc):
if 'sched_mono' in metafunc.fixturenames: if 'sched_mono' in metafunc.fixturenames:
scheds = [ scheds = [
Scheduler('easy_bf', 'easy'), Scheduler('easy_bf', 'easy'),
Scheduler('easy_bf_fast', 'easy_fast'),
Scheduler('fcfs', 'fcfs') Scheduler('fcfs', 'fcfs')
] ]
metafunc.parametrize('sched_mono', scheds) metafunc.parametrize('sched_mono', scheds)
......
...@@ -26,6 +26,17 @@ def test_broker_mono(platform_monoC, workload_static, sched_mono): ...@@ -26,6 +26,17 @@ def test_broker_mono(platform_monoC, workload_static, sched_mono):
if has_expected_output(test_name): if has_expected_output(test_name):
assert_expected_output(test_name) assert_expected_output(test_name)
def test_easy_bf_fast(platform_monoC, workload_static):
test_name_easy = f'broker-easy-{platform_monoC.name}-{workload_static.name}'
test_name_easy_fast = f'broker-easy_fast-{platform_monoC.name}-{workload_static.name}'
expected = 'test-out/' + test_name_easy + '/_jobs.csv'
obtained = 'test-out/' + test_name_easy_fast + '/_jobs.csv'
assert filecmp.cmp(expected, obtained), f"\
Files {expected} and {obtained} should be equal but are not.\n\
Run `diff {expected} {obtained}` to investigate why.\n\
Run `cp {obtained} {expected}` to override the expected file with the obtained."
def test_broker_multi(platform_multiC, workload_static, sched_multi): def test_broker_multi(platform_multiC, workload_static, sched_multi):
"""Test the broker mode with multicore platform files and schedulers""" """Test the broker mode with multicore platform files and schedulers"""
......
...@@ -40,3 +40,32 @@ def test_easy_bf(platform_monoC, workload_static): ...@@ -40,3 +40,32 @@ def test_easy_bf(platform_monoC, workload_static):
instance.to_file(robin_filename) instance.to_file(robin_filename)
ret = run_robin(robin_filename) ret = run_robin(robin_filename)
assert ret.returncode == 0 assert ret.returncode == 0
def test_easy_bf_fast(platform_monoC, workload_static):
"""Tests if easy_bf and easy_bf_fast behave the same"""
sched = "easy_bf_fast"
test_name = f'{sched}-{platform_monoC.name}-{workload_static.name}'
output_dir, robin_filename, _ = init_instance(test_name)
batcmd = gen_batsim_cmd(platform_monoC.filename, workload_static.filename, output_dir, "")
instance = RobinInstance(output_dir=output_dir,
batcmd=batcmd,
schedcmd=f"batmen -v '{sched}'",
simulation_timeout=30, ready_timeout=5,
success_timeout=10, failure_timeout=0
)
instance.to_file(robin_filename)
ret = run_robin(robin_filename)
assert ret.returncode == 0
# Test if the output are the same than with easy_bf
test_easy = f'easy_bf-{platform_monoC.name}-{workload_static.name}'
obtained = f'test-out/{test_name}/_jobs.csv'
expected = f'test-out/{test_easy}/_jobs.csv'
assert filecmp.cmp(expected, obtained), f"\
Files {expected} and {obtained} should be equal but are not.\n\
Run `diff {expected} {obtained}` to investigate why.\n\
Run `cp {obtained} {expected}` to override the expected file with the obtained."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment