mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
test(libkernel): keep setstack cases separate from stacksize tests
This commit is contained in:
@@ -19,8 +19,6 @@ int APS5_VABI scePthreadAttrGetschedparam(const PthreadAttr* attr, KernelSchedPa
|
||||
int APS5_VABI scePthreadAttrGetaffinity(const PthreadAttr* attr, KernelCpumask* mask);
|
||||
int APS5_VABI scePthreadAttrGetstacksize(const PthreadAttr* attr, std::size_t* stackSize);
|
||||
int APS5_VABI scePthreadAttrGetdetachstate(const PthreadAttr* attr, int* state);
|
||||
int APS5_VABI pthread_attr_setstack_nid_postfix(PthreadAttr* attr, void* addr, std::size_t size);
|
||||
int APS5_VABI pthread_attr_getstack_nid_postfix(const PthreadAttr* attr, void** addr, std::size_t* size);
|
||||
}
|
||||
|
||||
static constexpr int SCE_OK = 0;
|
||||
@@ -42,6 +40,11 @@ struct ReportedAttributes {
|
||||
int detachState = -1;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
int APS5_VABI pthread_attr_setstack_nid_postfix(PthreadAttr* attr, void* addr, std::size_t size);
|
||||
int APS5_VABI pthread_attr_getstack_nid_postfix(const PthreadAttr* attr, void** addr, std::size_t* size);
|
||||
}
|
||||
|
||||
static ReportedAttributes Query(Pthread thread) {
|
||||
PthreadAttr attr = nullptr;
|
||||
Require(scePthreadAttrInit(&attr) == SCE_OK);
|
||||
@@ -63,21 +66,6 @@ static void* APS5_VABI Worker(void* arg) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
PthreadAttr stackAttr = nullptr;
|
||||
char stackMarker;
|
||||
Require(pthread_attr_setstack_nid_postfix(nullptr, &stackMarker, STACK_SIZE) == 22);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, STACK_SIZE) == 22);
|
||||
Require(scePthreadAttrInit(&stackAttr) == SCE_OK);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, STACK_SIZE) == 0);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, nullptr, STACK_SIZE) == 22);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, 16383) == 22);
|
||||
void* reportedAddress = nullptr;
|
||||
std::size_t reportedSize = 0;
|
||||
Require(pthread_attr_getstack_nid_postfix(&stackAttr, &reportedAddress, &reportedSize) == 0);
|
||||
Require(reportedAddress == &stackMarker && reportedSize == STACK_SIZE);
|
||||
Require(scePthreadAttrDestroy(&stackAttr) == SCE_OK);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, STACK_SIZE) == 22);
|
||||
|
||||
PthreadAttr attr = nullptr;
|
||||
Require(scePthreadAttrInit(&attr) == SCE_OK);
|
||||
Require(scePthreadAttrSetinheritsched(&attr, EXPLICIT_SCHED) == SCE_OK);
|
||||
@@ -115,4 +103,19 @@ int main() {
|
||||
|
||||
release.set_value();
|
||||
Require(scePthreadJoin(thread, nullptr) == SCE_OK);
|
||||
|
||||
PthreadAttr stackAttr = nullptr;
|
||||
char stackMarker;
|
||||
Require(pthread_attr_setstack_nid_postfix(nullptr, &stackMarker, STACK_SIZE) == 22);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, STACK_SIZE) == 22);
|
||||
Require(scePthreadAttrInit(&stackAttr) == SCE_OK);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, STACK_SIZE) == 0);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, nullptr, STACK_SIZE) == 22);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, 16383) == 22);
|
||||
void* reportedAddress = nullptr;
|
||||
std::size_t reportedSize = 0;
|
||||
Require(pthread_attr_getstack_nid_postfix(&stackAttr, &reportedAddress, &reportedSize) == 0);
|
||||
Require(reportedAddress == &stackMarker && reportedSize == STACK_SIZE);
|
||||
Require(scePthreadAttrDestroy(&stackAttr) == SCE_OK);
|
||||
Require(pthread_attr_setstack_nid_postfix(&stackAttr, &stackMarker, STACK_SIZE) == 22);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user