def test_time_estimate(self): sections = P(self.code_test_cycles, {'RUNTIME': 20}) sections = list(sections) etime = agent.calculate_execution_time(sections) ok(etime) == 20 * 4 + 20 * 2 + 40 * 2 ok(agent.sec_to_str(etime)) == "0:03:20"
def test_time_estimate_large(self): sections = P(self.code_test_cycles2, {'RUNTIME': 30}) sections = list(sections) ok(sections[0].name) == 'sec1' ok(len(sections)) == 7 * 4 etime = agent.calculate_execution_time(sections) # ramptime optimization expected_time = (20 + 30 + 30 * 6) * 2 expected_time += (40 + 30 + 30 * 6) * 2 ok(etime) == expected_time
def test_time_estimate_large2(self): sections = P(self.code_test_cycles3, {'RUNTIME': 30}) sections = list(sections) ok(sections[0].name) == 'sec1' ok(sections[1].name) == 'sec1' ok(len(sections)) == 7 * 4 * 2 etime = agent.calculate_execution_time(sections) # ramptime optimization expected_time = (20 + 30 + 30 * 6) * 2 expected_time += (40 + 30 + 30 * 6) * 2 ok(etime) == expected_time * 2
def test_real_tasks(self): tasks_dir = os.path.dirname(agent.__file__) fname = os.path.join(tasks_dir, 'io_scenario_ceph.cfg') fc = open(fname).read() sections = P(fc, {'FILENAME': '/dev/null'}) sections = list(sections) ok(len(sections)) == 7 * 9 * 4 + 7 etime = agent.calculate_execution_time(sections) # ramptime optimization expected_time = (60 * 7 + 30) * 9 * 4 + (60 * 7 + 30) ok(etime) == expected_time