def test_analysisBW1(): t1 = Task(3, 6) t2 = Task(2, 8) t3 = Task(3, 12) taskset = Taskset(t1, t2, t3) policy = dichotomicPromotionSearch(taskset) expectedPolicy = DualPrioritySchedulingPolicy( (t1, DualPriorityTaskInfo(3, 3, -3)), (t2, DualPriorityTaskInfo(2, 4, -2)), (t3, DualPriorityTaskInfo(1))) assert expectedPolicy == policy
def test_counterExample1(): t1 = Task(23, 40) t2 = Task(23, 58) t3 = Task(1, 60) taskset = Taskset(t1, t2, t3) dPolicy = dichotomicPromotionSearch(taskset) dSetup = SimulationSetup(taskset, taskset.hyperperiod, schedulingPolicy=dPolicy, trackHistory=True, trackPreemptions=False) dHistory = SimulationRun(dSetup).result().history assert not dHistory.hasDeadlineMiss()
def test_analysisBW3(): t1 = Task(4, 16) t2 = Task(5, 20) t3 = Task(11, 28) t4 = Task(6, 56) taskset = Taskset(t1, t2, t3, t4) policy = dichotomicPromotionSearch(taskset) expectedPolicy = DualPrioritySchedulingPolicy( (t1, DualPriorityTaskInfo(4, 8, -4)), (t2, DualPriorityTaskInfo(3, 10, -3)), (t3, DualPriorityTaskInfo(2, 3, -2)), (t4, DualPriorityTaskInfo(1))) assert policy == expectedPolicy
def test_damien4(): t1 = Task(8, 20, displayName='t1') t2 = Task(15, 28, displayName='t2') t3 = Task(8, 136, displayName='t3') taskset = Taskset(t1, t2, t3) policy = dichotomicPromotionSearch(taskset) setup = SimulationSetup(taskset, taskset.hyperperiod, schedulingPolicy=policy, trackHistory=True, trackPreemptions=False) result = SimulationRun(setup).result() history = result.history assert not history.hasDeadlineMiss()
def test_example5AnyPromo(): t1 = Task(13, 51) t2 = Task(83, 128) t3 = Task(16, 183) taskset = Taskset(t1, t2, t3) policy = dichotomicPromotionSearch(taskset) setup = SimulationSetup(taskset, taskset.hyperperiod, schedulingPolicy=policy, trackHistory=False, trackPreemptions=False) result = SimulationRun(setup).result() history = result.history assert not history.hasDeadlineMiss()
def assertRMm1RM(taskset, success=True): raised = False try: policy = dichotomicPromotionSearch(taskset) if success: setup = SimulationSetup(taskset, taskset.hyperperiod, schedulingPolicy=policy, deadlineMissFilter=True) result = SimulationRun(setup).result() history = result.history assert not history.hasDeadlineMiss() except ValidPromotionNotFound: raised = True assert not raised if success else raised
def test_analysisBW4(): t1 = Task(1, 4) t2 = Task(1, 6) t3 = Task(3, 12) t4 = Task(5, 30) t5 = Task(6, 36) taskset = Taskset(t1, t2, t3, t4, t5) policy = dichotomicPromotionSearch(taskset) expectedPolicy = DualPrioritySchedulingPolicy( (t1, DualPriorityTaskInfo(5, 2, -5)), (t2, DualPriorityTaskInfo(4, 3, -4)), (t3, DualPriorityTaskInfo(3, 6, -3)), (t4, DualPriorityTaskInfo(2, 15, -2)), (t5, DualPriorityTaskInfo(1))) assert policy == expectedPolicy