diff --git a/test/conftest.py b/test/conftest.py index b80d588aa6d96313b89e00790e583df6a6ac6a60..d599332c17bb26d8022da1d97f9fee18a024cba5 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -36,6 +36,7 @@ def pytest_generate_tests(metafunc): if 'sched_mono' in metafunc.fixturenames: scheds = [ Scheduler('easy_bf', 'easy'), + Scheduler('easy_bf_fast', 'easy_fast'), Scheduler('fcfs', 'fcfs') ] metafunc.parametrize('sched_mono', scheds) diff --git a/test/test_broker.py b/test/test_broker.py index 2effe5f4d376aba507da9b7d125347c03fe4d953..5da510c829b6561ef517e6dd7256b5fd3d6d4051 100644 --- a/test/test_broker.py +++ b/test/test_broker.py @@ -26,6 +26,17 @@ def test_broker_mono(platform_monoC, workload_static, sched_mono): if has_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): """Test the broker mode with multicore platform files and schedulers""" diff --git a/test/test_schedulers_mono.py b/test/test_schedulers_mono.py index 467fefdf2ab46ff3d7b22f6e4491046d0d1f10c6..d268d5b5aab16dbe61c778991f1edf097e7a30da 100755 --- a/test/test_schedulers_mono.py +++ b/test/test_schedulers_mono.py @@ -40,3 +40,32 @@ def test_easy_bf(platform_monoC, workload_static): instance.to_file(robin_filename) ret = run_robin(robin_filename) 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."