def test_no_double_accounting_spin_msrp(self): "test that spin delay and arrival blocking are correctly accounted for" lb.apply_msrp_bounds_holistic(self.ts) self.assertTrue(rta.is_schedulable(1, self.p0)) self.assertTrue(rta.is_schedulable(1, self.p1)) # Expected inflated WCET and response times: # - for highest-priority task: # - arrival blocking of up to 2ms # - spin blocking of up to 1ms self.assertEqual(self.p0[0].cost, 10 + 1) self.assertEqual(self.p1[0].cost, 10 + 1) self.assertEqual(self.p0[0].response_time, 10 + 2 + 1) self.assertEqual(self.p1[0].response_time, 10 + 2 + 1) # - for lower-priority task: # - no arrival blocking # - interference of up to 10ms + 1ms # - spin blocking of up to 1ms self.assertEqual(self.p0[1].cost, 10 + 1) self.assertEqual(self.p1[1].cost, 10 + 1) self.assertEqual(self.p0[1].response_time, 10 + 10 + 1 + 1) self.assertEqual(self.p1[1].response_time, 10 + 10 + 1 + 1)
def test_no_double_accounting_saw_lp(self): "test that LP-based s-aware analysis is correctly accounted for" lb.apply_lp_part_fmlp_bounds(self.ts) self.assertTrue(rta.is_schedulable(1, self.p0)) self.assertTrue(rta.is_schedulable(1, self.p1)) # Expected inflated WCET and response times: # - for highest-priority task: # - no WCET inflation # - local pi-blocking of up to 1ms # - remote pi-blocking of up to (1 + 1) ms self.assertEqual(self.p0[0].cost, 10) self.assertEqual(self.p1[0].cost, 10) self.assertEqual(self.p0[0].response_time, 10 + 1 + 2) self.assertEqual(self.p1[0].response_time, 10 + 1 + 2) # - for lower-priority task: # - no WCET inflation # - no arrival blocking # - interference of up to 10ms (no inflation) # - remote pi-blocking of up to (1 + 1) ms self.assertEqual(self.p0[1].cost, 10) self.assertEqual(self.p1[1].cost, 10) self.assertEqual(self.p0[1].response_time, 10 + 10 + 2) self.assertEqual(self.p1[1].response_time, 10 + 10 + 2)
def test_no_double_accounting_mpcp(self): "test that s-aware MPCP analysis is correctly accounted for" lb.apply_lp_mpcp_bounds(self.ts) self.assertTrue(rta.is_schedulable(1, self.p0)) self.assertTrue(rta.is_schedulable(1, self.p1)) for t in self.ts: print t.partition, t.preemption_level, t.blocked, t.suspended, t.response_time, t # Expected inflated WCET and response times: # - for highest-priority task: # - no WCET inflation # - local pi-blocking of up to 1ms # - remote pi-blocking of up to 1 ms // one lower-prio remote CS self.assertEqual(self.p0[0].cost, 10) self.assertEqual(self.p0[0].response_time, 10 + 1 + 1) # on other core, can be blocked by multiple remote tasks due to lower # priority => up to 2ms remote, 1ms local self.assertEqual(self.p1[0].cost, 10) self.assertEqual(self.p1[0].response_time, 10 + 1 + 2) # - for lower-priority task on P0: # - no WCET inflation # - no arrival blocking # - interference of up to 10ms (no inflation) # - remote pi-blocking of up to up to 1 ms // one lower-prio remote CS self.assertEqual(self.p0[1].cost, 10) self.assertEqual(self.p0[1].response_time, 10 + 10 + 1) # on other core, repeated blocking is again possible self.assertEqual(self.p1[1].cost, 10) self.assertEqual(self.p1[1].response_time, 10 + 10 + 2)
def test_no_double_accounting_sob(self): "test that suspension-oblivious analysis is correctly accounted for" lb.apply_clustered_omlp_bounds(self.ts, 1) self.assertTrue(rta.is_schedulable(1, self.p0)) self.assertTrue(rta.is_schedulable(1, self.p1)) # Expected inflated WCET and response times: # - for highest-priority task: # - arrival sob pi-blocking of up to 2ms # - sob pi-blocking of up to 1ms self.assertEqual(self.p0[0].cost, 10 + 2 + 1) self.assertEqual(self.p1[0].cost, 10 + 2 + 1) self.assertEqual(self.p0[0].response_time, 10 + 2 + 1) self.assertEqual(self.p1[0].response_time, 10 + 2 + 1) # - for lower-priority task: # - no arrival blocking # - interference of up to 10ms + 3ms (sob inflation) # - spin blocking of up to 1ms self.assertEqual(self.p0[1].cost, 10 + 1) self.assertEqual(self.p1[1].cost, 10 + 1) self.assertEqual(self.p0[1].response_time, 10 + 13 + 1) self.assertEqual(self.p1[1].response_time, 10 + 13 + 1)
def test_times_with_legacy_blocked(self): self.ts[0].blocked = 1 self.ts[1].blocked = 5 self.assertTrue(rta.is_schedulable(1, self.ts)) self.assertEqual(self.ts[0].response_time, 2) self.assertEqual(self.ts[1].response_time, 20) self.assertEqual(self.ts[2].response_time, 12)
def test_times(self): self.assertTrue(rta.is_schedulable(1, self.ts)) self.assertEqual(self.ts[0].response_time, 1) self.assertEqual(self.ts[1].response_time, 2) self.assertEqual(self.ts[2].response_time, 7) self.assertEqual(self.ts[3].response_time, 18)
def test_times_with_legacy_suspension(self): self.ts[1].blocked = 5 self.ts[1].suspended = 5 self.assertFalse(rta.is_schedulable(1, self.ts)) self.assertEqual(self.ts[0].response_time, 1) self.assertEqual(self.ts[1].response_time, 20)
def test_times_no_suspension(self): self.assertTrue(rta.is_schedulable(1, self.ts)) self.assertEqual(self.ts[0].response_time, 1) self.assertEqual(self.ts[1].response_time, 10) self.assertEqual(self.ts[2].response_time, 12)
def test_bound_is_integral(self): self.assertTrue(rta.is_schedulable(1, self.ts)) self.assertTrue(is_integral(self.ts[0].response_time)) self.assertTrue(is_integral(self.ts[1].response_time)) self.assertTrue(is_integral(self.ts[2].response_time))
def test_procs(self): self.assertTrue(rta.is_schedulable(1, self.ts)) self.assertFalse(rta.is_schedulable(2, self.ts))
def test_times(self): for t in self.ts: t.prio_inversion = t.pcp self.assertTrue(rta.is_schedulable(1, self.ts)) for t in self.ts: self.assertEqual(t.response_time, t.expected)
def test_times_with_legacy_blocked(self): for t in self.ts: t.blocked = t.pcp self.assertTrue(rta.is_schedulable(1, self.ts)) for t in self.ts: self.assertEqual(t.response_time, t.expected)