From 2baf058198c29bf9be02f1dbaf72f0fa7b315eb0 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 9 Nov 2023 04:04:53 +0100 Subject: [PATCH] Scheduler: high-level schedule-Render-Job test complete --- tests/vault/gear/scheduler-service-test.cpp | 66 ++++++---- wiki/thinkPad.ichthyo.mm | 134 +++++++++++--------- 2 files changed, 117 insertions(+), 83 deletions(-) diff --git a/tests/vault/gear/scheduler-service-test.cpp b/tests/vault/gear/scheduler-service-test.cpp index 548d357a7..b39dd3001 100644 --- a/tests/vault/gear/scheduler-service-test.cpp +++ b/tests/vault/gear/scheduler-service-test.cpp @@ -69,7 +69,8 @@ namespace test { /*************************************************************************//** - * @test Scheduler component integration test: add and process dependent jobs. + * @test Scheduler component integration test: use the service API for + * state control and to add Jobs and watch processing patterns. * @see SchedulerActivity_test * @see SchedulerInvocation_test * @see SchedulerCommutator_test @@ -456,9 +457,17 @@ namespace test { - /** @test TODO schedule a render job through the high-level Job-builder API. + /** @test Schedule a render job through the high-level Job-builder API. * - use the mock Job-Functor provided by the ActivityDetector - * @todo WIP 11/23 ✔ define ⟶ 🔁 implement + * - manipulate the WorkForce to prevent it from scaling up + * - this allows us to investigate the queue entry created + * through the public regular API for scheduling Render Jobs + * - after that, the test manually invokes the work-pulling function + * and verifies the mock Job-Functor has been invoked + * - note however that this time a complete Activity chain + * was created, including a Gate and all state transitions, + * since we used the high-level API of the SchedulerService + * @todo WIP 11/23 ✔ define ⟶ ✔ implement */ void scheduleRenderJob() @@ -478,34 +487,43 @@ namespace test { ActivityDetector detector; Job testJob{detector.buildMockJob("testJob", nominal, 1337)}; - auto anchor = RealClock::now(); - auto offset = [&](Time when =RealClock::now()){ return _raw(when) - _raw(anchor); }; -////////////////////////////////// CHECK (scheduler.empty()); -SHOW_EXPR(offset()) - auto buidl= + + // use the public Render-Job builder API scheduler.defineSchedule(testJob) .startOffset(400us) - .lifeWindow (2ms); -SHOW_EXPR(offset()) - buidl .post(); + .lifeWindow (2ms) + .post(); CHECK (not scheduler.empty()); -// CHECK (detector.ensureNoInvocation("testJob")); -SHOW_EXPR(offset()) - sleep_for(400us); -// CHECK (detector.ensureNoInvocation("testJob")); -SHOW_EXPR(offset()) - auto res= scheduler.getWork(); -SHOW_EXPR(offset()) -SHOW_EXPR(res) -SHOW_EXPR(offset(scheduler.layer1_.headTime())) -// CHECK (activity::PASS == scheduler.getWork()); -// CHECK (scheduler.empty()); + // cause the new entry to migrate to the priority queue... + scheduler.layer2_.maybeFeed(scheduler.layer1_); - cout << detector.showLog()<is(Activity::POST)); + CHECK (entry.activity->next->is(Activity::GATE)); + CHECK (entry.activity->next->next->is(Activity::WORKSTART)); + CHECK (entry.activity->next->next->next->is(Activity::INVOKE)); + CHECK (entry.startTime() - now < _uTicks( 400us)); + CHECK (entry.deathTime() - now < _uTicks(2400us)); + CHECK (entry.manifestation == 0); + CHECK (entry.isCompulsory == false); + + + sleep_for(400us); // wait to be sure the new entry has reached maturity + detector.incrementSeq(); // mark this point in the detector-log... + + // Explicitly invoke the work-Function (normally done by the workers) + CHECK (activity::PASS == scheduler.getWork()); + + CHECK (detector.verifySeqIncrement(1) + .beforeInvocation("testJob").arg("7.007", 1337)); + +// cout << detector.showLog()< - + @@ -82077,9 +82077,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + @@ -82171,7 +82171,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -82194,10 +82194,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -82328,9 +82328,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + @@ -82395,7 +82395,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -82763,8 +82763,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -82779,7 +82779,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -82966,12 +82966,12 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -83013,7 +83013,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83032,7 +83032,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83049,7 +83049,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83061,7 +83061,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83154,7 +83154,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83210,14 +83210,14 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + - + @@ -83234,7 +83234,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83261,7 +83261,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83285,12 +83285,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ +
- + - @@ -83616,7 +83617,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -83918,7 +83919,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -84263,8 +84264,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -84315,11 +84316,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -84341,8 +84342,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -84427,10 +84428,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + @@ -84564,7 +84565,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -84586,11 +84587,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - - + + @@ -84598,16 +84599,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + - + - + + @@ -84849,7 +84851,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -84865,7 +84867,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -85018,7 +85020,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -85152,7 +85154,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -85168,6 +85170,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + @@ -88469,6 +88476,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + @@ -88739,6 +88749,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ @@ -88926,8 +88937,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + + @@ -88944,11 +88956,15 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + +
- + @@ -90036,7 +90052,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -90451,8 +90467,8 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + @@ -92552,13 +92568,13 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + - +