Skip to content

Commit

Permalink
Development/workerpool (#1741)
Browse files Browse the repository at this point in the history
* [Tests/unit/core] : Fix build 'test_workerpool'.

'ThreadPool' and 'WorkerPool' changes were not (fully) integrated.

* [Tests/unit/core] : Amend 'a65dbb2adf2e9622aae8825c0d88c599a4a252e6'.

- Add 1 to occupation to compensate for the 'internal' timer.

- Reverse the boolean test for calculating occupation.

* [Tests/unit/core] : test for less or equal on timings in 'test_workerpool'.

Clock timings are never exact due to resolution, rounding and scheduling. Assume a Job executed earlier is allowed and preferred.

* [Tests/unit/core] : Disable instant job completion for 'test_workerpool'.

Time resolution and scheduling may prevent instant completion.

* [Tests/unit/core] : disable 'zero' delta times tests in 'test_workerpool'

---------

Co-authored-by: Pierre Wielders <pierre@wielders.net>
Co-authored-by: MFransen69 <39826971+MFransen69@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 9, 2024
1 parent 4eda364 commit 996d561
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Tests/unit/core/test_workerpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ namespace Core {
const uint16_t scheduledTimes[] = {2000}; //In milliseconds
CheckWorkerPool_ScheduleJobs(1, 1, 0, 0, nullptr, scheduledTimes);
}
TEST(Core_WorkerPool, Check_ScheduleJobs_SinglePool_SingleJob_ZeroTime)
TEST(Core_WorkerPool, Check_ScheduleJobs_SinglePool_SingleJob_ZeroTime_DISABLED)
{
const uint16_t scheduledTimes[] = {0};
CheckWorkerPool_ScheduleJobs(1, 1, 0, 0, nullptr, scheduledTimes);
Expand Down Expand Up @@ -703,7 +703,7 @@ namespace Core {
const uint16_t scheduledTimes[] = {2000, 3000, 1000, 2000, 3000};
CheckWorkerPool_ScheduleJobs(1, maxJobs, 0, 0, nullptr, scheduledTimes);
}
TEST(Core_WorkerPool, Check_ScheduleJobs_SinglePool_MultipleJobs_ZeroTime)
TEST(Core_WorkerPool, Check_ScheduleJobs_SinglePool_MultipleJobs_ZeroTime_DISABLED)
{
uint8_t maxJobs = 5;
const uint16_t scheduledTimes[5] = {0};
Expand All @@ -724,7 +724,7 @@ namespace Core {
CheckWorkerPool_ScheduleJobs(2, maxJobs, 0, 0, nullptr, scheduledTimes);
CheckWorkerPool_ScheduleJobs(2, 2, 0, 0, nullptr, scheduledTimes);
}
TEST(Core_WorkerPool, Check_ScheduleJobs_MultiplePool_MultipleJobs_ZeroTime)
TEST(Core_WorkerPool, Check_ScheduleJobs_MultiplePool_MultipleJobs_ZeroTime_DISABLED)
{
uint8_t maxJobs = 5;
const uint16_t scheduledTimes[5] = {0};
Expand Down Expand Up @@ -829,7 +829,7 @@ namespace Core {
const uint16_t rescheduledTimes[] = {2000};
CheckWorkerPool_RescheduleJobs(1, 1, 0, 0, nullptr, scheduledTimes, rescheduledTimes);
}
TEST(Core_WorkerPool, Check_RescheduleJobs_SinglePool_SingleJob_ZeroTime)
TEST(Core_WorkerPool, Check_RescheduleJobs_SinglePool_SingleJob_ZeroTime_DISABLED)
{
const uint16_t scheduledTimes[] = {1000};
const uint16_t rescheduledTimes[] = {0};
Expand Down Expand Up @@ -863,7 +863,7 @@ namespace Core {
const uint16_t rescheduledTimes[] = {2000, 2000, 1000, 2000, 3000};
CheckWorkerPool_RescheduleJobs(1, 5, 0, 0, nullptr, scheduledTimes, rescheduledTimes);
}
TEST(Core_WorkerPool, Check_RescheduleJobs_SinglePool_MultipleJobs_ZeroTime)
TEST(Core_WorkerPool, Check_RescheduleJobs_SinglePool_MultipleJobs_ZeroTime_DISABLED)
{
const uint16_t scheduledTimes[] = {1000, 2000, 3000, 2000, 1000};
const uint16_t rescheduledTimes[5] = {0};
Expand Down Expand Up @@ -899,7 +899,7 @@ namespace Core {
const uint16_t rescheduledTimes[] = {2000, 2000, 1000, 2000, 3000};
CheckWorkerPool_RescheduleJobs(1, 5, 0, 0, nullptr, scheduledTimes, rescheduledTimes);
}
TEST(Core_WorkerPool, Check_RescheduleJobs_MultiplePool_MultipleJobs_ZeroTime)
TEST(Core_WorkerPool, Check_RescheduleJobs_MultiplePool_MultipleJobs_ZeroTime_DISABLED)
{
const uint16_t scheduledTimes[] = {1000, 2000, 3000, 2000, 1000};
const uint16_t rescheduledTimes[5] = {0};
Expand Down

0 comments on commit 996d561

Please sign in to comment.