Skip to content

Commit

Permalink
Merge pull request #208 from shenweip/suspend-sameprio
Browse files Browse the repository at this point in the history
Add test for the rescheduling after resuming from suspend when the prio are same.
  • Loading branch information
hrydgard authored Sep 1, 2020
2 parents 6efdb25 + b7b8ac3 commit 5722246
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
18 changes: 15 additions & 3 deletions tests/threads/threads/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ int testThread(SceSize argc, void *argp) {
}

int testReScheduleThread(SceSize argc, void *argp) {
checkpoint(" - Suspending");
sceKernelSuspendThread(sceKernelGetThreadId());
checkpoint(" - Resumed form suspend and rescheduled");
sceKernelSleepThread();
checkpoint(" - Resumed from suspend and rescheduled");
return 0;
}

Expand Down Expand Up @@ -64,8 +63,21 @@ int main(int argc, char *argv[]) {

checkpointNext("Reschedule after resuming:");
sceKernelStartThread(reScheduleThread, 0, NULL);
sceKernelSuspendThread(reScheduleThread);
checkpoint(" - Suspended");
sceKernelWakeupThread(reScheduleThread);
sceKernelResumeThread(reScheduleThread);
checkpoint("Exit from reSchedule");

reScheduleThread = sceKernelCreateThread("reSchedule test", &testReScheduleThread, 0x20, 0x800, 0, NULL);
checkpointNext("Reschedule after resuming(same priority):");
sceKernelStartThread(reScheduleThread, 0, NULL);
sceKernelDelayThread(1000);
sceKernelSuspendThread(reScheduleThread);
checkpoint(" - Suspended");
sceKernelWakeupThread(reScheduleThread);
sceKernelResumeThread(reScheduleThread);
checkpoint("Exit from reSchedule(same priority)");

return 0;
}
8 changes: 6 additions & 2 deletions tests/threads/threads/suspend.expected
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
[r] Delay: 00000000

[x] Reschedule after resuming:
[x] - Suspending
[x] - Resumed form suspend and rescheduled
[x] - Suspended
[x] - Resumed from suspend and rescheduled
[x] Exit from reSchedule

[x] Reschedule after resuming(same priority):
[r] - Suspended
[x] Exit from reSchedule(same priority)
Binary file modified tests/threads/threads/suspend.prx
Binary file not shown.

0 comments on commit 5722246

Please sign in to comment.