Differences From Artifact [2e657633ab]:
- File
tests/natools-cron-tests.adb
— part of check-in
[3267d1247d]
at
2017-04-12 20:54:47
on branch trunk
— cron-tests: new test to show an issue with unsafe access to Event_List
Thanks to OpenBSD for providing an environment where this issue could happen accidentally. Now to find a fix... (user: nat, size: 9496) [annotate] [blame] [check-ins using]
To Artifact [c715546381]:
- File tests/natools-cron-tests.adb — part of check-in [908d0e14c9] at 2017-06-22 21:10:52 on branch trunk — cron-tests: add a test showing a bug in event list fusion (user: nat, size: 11326) [annotate] [blame] [check-ins using]
︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | + | procedure All_Tests (Report : in out NT.Reporter'Class) is begin Basic_Usage (Report); Delete_While_Busy (Report); Insert_While_Busy (Report); Time_Collision (Report); Delete_While_Collision (Report); Event_List_Fusion (Report); end All_Tests; ----------------------- -- Inidividual Tests -- ----------------------- |
︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 234 235 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Check (Test, Get (Log), "("); delay 4 * Tick; Check (Test, Get (Log), "()<>"); exception when Error : others => Test.Report_Exception (Error); end Delete_While_Collision; procedure Event_List_Fusion (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Fusion of synchronized callbacks"); Total : constant Duration := 0.25; Log : aliased Bounded_String (256); begin declare use type Ada.Calendar.Time; First_Tick : constant Periodic_Time := (Origin => Ada.Calendar.Clock + Total / 8, Period => Total / 4); Second_Tick : constant Periodic_Time := (Origin => First_Tick.Origin + First_Tick.Period, Period => First_Tick.Period); A_Head, A_Tail, B_Head, B_Tail : Cron_Entry; begin A_Head.Set (First_Tick, Long_Callback' (Backend => Log'Access, Open => '(', Close => ')', Wait => Total / 8)); A_Tail.Set (First_Tick, Test_Callback' (Backend => Log'Access, Symbol => 'A')); delay Total / 8 + Total / 16; Check (Test, Get (Log), "("); B_Head.Set (Second_Tick, Test_Callback' (Backend => Log'Access, Symbol => 'B')); B_Tail.Set (Second_Tick, Test_Callback' (Backend => Log'Access, Symbol => 'b')); delay Total / 4 + Total / 8; Check (Test, Get (Log), "()ABb()A"); A_Tail.Reset; B_Tail.Reset; delay Total / 4; Check (Test, Get (Log), "()ABb()AB()"); end; -- Timeline: 0 . 1/4 . 1/2 . 3/4 . 1 -- Log: ( )A Bb( )A B( ) -- Code: * * * * * delay Total / 8; Check (Test, Get (Log), "()ABb()AB()"); exception when Error : others => Test.Report_Exception (Error); end Event_List_Fusion; procedure Insert_While_Busy (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Insert entry while callback is running"); Total : constant Duration := 1.0; Log : aliased Bounded_String (256); begin declare |
︙ |