-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test for proper scheduling after delay expiry
It's not obvious from the FreeRTOS source code (in tasks.c) what happens if a task's delay ends while another task of the same priority is running. This test demonstrates that the running task continues. * test-stm32f4/action_after_delay-main.adb, test-stm32f4/action_after_delay.adb, test-stm32f4/action_after_delay.ads: new test. * test-stm32f4/testbed.gpr: include action_after_delay.
- Loading branch information
1 parent
ed88765
commit 48d06b8
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- Copyright (C) 2020 Free Software Foundation, Inc. | ||
|
||
-- This file is part of the Cortex GNAT RTS package. | ||
-- | ||
-- Copying and distribution of this file, with or without | ||
-- modification, are permitted in any medium without royalty provided | ||
-- the copyright notice and this notice are preserved. This file is | ||
-- offered as-is, without any warranty. | ||
|
||
with Ada.Real_Time; | ||
procedure Action_After_Delay.Main is | ||
begin | ||
delay until Ada.Real_Time.Time_Last; | ||
end Action_After_Delay.Main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-- Copyright (C) 2020 Free Software Foundation, Inc. | ||
|
||
-- This file is part of the Cortex GNAT RTS package. | ||
-- | ||
-- Copying and distribution of this file, with or without | ||
-- modification, are permitted in any medium without royalty provided | ||
-- the copyright notice and this notice are preserved. This file is | ||
-- offered as-is, without any warranty. | ||
|
||
with Ada.Real_Time; | ||
|
||
package body Action_After_Delay is | ||
|
||
task T1; | ||
task T2; | ||
|
||
T2_Has_Run : Boolean := False with Volatile; | ||
|
||
task body T1 is | ||
begin | ||
loop | ||
exit when T2_Has_Run; | ||
end loop; | ||
-- PE here (because it's illegal in Ravenscar to exit a task) | ||
-- if T2 has run | ||
end T1; | ||
|
||
task body T2 is | ||
use type Ada.Real_Time.Time; | ||
begin | ||
delay until Ada.Real_Time.Clock + Ada.Real_Time.Seconds (1); | ||
-- Shouldn't get here, since T1 hasn't reached a dispatching | ||
-- point. | ||
T2_Has_Run := True; | ||
delay until Ada.Real_Time.Time_Last; | ||
end T2; | ||
|
||
end Action_After_Delay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- Copyright (C) 2020 Free Software Foundation, Inc. | ||
|
||
-- This file is part of the Cortex GNAT RTS package. | ||
-- | ||
-- Copying and distribution of this file, with or without | ||
-- modification, are permitted in any medium without royalty provided | ||
-- the copyright notice and this notice are preserved. This file is | ||
-- offered as-is, without any warranty. | ||
|
||
-- The purpose of this little suite is to determine what happens when | ||
-- one task is running and another, at the same priority, exits a | ||
-- delay; will it run or be blocked? | ||
|
||
package Action_After_Delay with Elaborate_Body is | ||
end Action_After_Delay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters