ntdll/tests: Remove some unnecessary checks in test_query_logicalprocex().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-07-17 19:12:33 -05:00 committed by Alexandre Julliard
parent 9dd1eaab44
commit 17785690c0
1 changed files with 135 additions and 164 deletions

View File

@ -774,6 +774,7 @@ static void test_query_logicalprocex(void)
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *infoex, *infoex_public, *infoex_core, *infoex_numa,
*infoex_cache, *infoex_package, *infoex_group, *ex;
DWORD relationship, len, len_public, len_core, len_numa, len_cache, len_package, len_group, len_union;
unsigned int i, j;
NTSTATUS status;
BOOL ret;
@ -821,9 +822,6 @@ static void test_query_logicalprocex(void)
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %d, error %d\n", ret, GetLastError());
ok(len == len_public, "got %u, expected %u\n", len_public, len);
if (len && len == len_public) {
int j, i;
infoex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
infoex_public = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_public);
infoex_core = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_core);
@ -841,24 +839,22 @@ static void test_query_logicalprocex(void)
ok(!memcmp(infoex, infoex_public, len), "returned info data mismatch\n");
/* Test for RelationAll. */
for(i = 0; status == STATUS_SUCCESS && i < len; ){
ex = (void*)(((char *)infoex) + i);
if (!ex->Size)
for (i = 0; status == STATUS_SUCCESS && i < len; )
{
ok(0, "got infoex[%u].Size=0\n", i);
break;
}
ex = (void *)(((char *)infoex) + i);
ok(ex->Size, "%u: got size 0\n", i);
trace("infoex[%u].Size: %u\n", i, ex->Size);
switch(ex->Relationship){
switch (ex->Relationship)
{
case RelationProcessorCore:
case RelationProcessorPackage:
trace("infoex[%u].Relationship: 0x%x (%s)\n", i, ex->Relationship, ex->Relationship == RelationProcessorCore ? "Core" : "Package");
trace("infoex[%u].Processor.Flags: 0x%x\n", i, ex->Processor.Flags);
trace("infoex[%u].Processor.EfficiencyClass: 0x%x\n", i, ex->Processor.EfficiencyClass);
trace("infoex[%u].Processor.GroupCount: 0x%x\n", i, ex->Processor.GroupCount);
for(j = 0; j < ex->Processor.GroupCount; ++j){
for (j = 0; j < ex->Processor.GroupCount; ++j)
{
trace("infoex[%u].Processor.GroupMask[%u].Mask: 0x%lx\n", i, j, ex->Processor.GroupMask[j].Mask);
trace("infoex[%u].Processor.GroupMask[%u].Group: 0x%x\n", i, j, ex->Processor.GroupMask[j].Group);
}
@ -883,7 +879,8 @@ static void test_query_logicalprocex(void)
trace("infoex[%u].Relationship: 0x%x (Group)\n", i, ex->Relationship);
trace("infoex[%u].Group.MaximumGroupCount: 0x%x\n", i, ex->Group.MaximumGroupCount);
trace("infoex[%u].Group.ActiveGroupCount: 0x%x\n", i, ex->Group.ActiveGroupCount);
for(j = 0; j < ex->Group.ActiveGroupCount; ++j){
for (j = 0; j < ex->Group.ActiveGroupCount; ++j)
{
trace("infoex[%u].Group.GroupInfo[%u].MaximumProcessorCount: 0x%x\n", i, j, ex->Group.GroupInfo[j].MaximumProcessorCount);
trace("infoex[%u].Group.GroupInfo[%u].ActiveProcessorCount: 0x%x\n", i, j, ex->Group.GroupInfo[j].ActiveProcessorCount);
trace("infoex[%u].Group.GroupInfo[%u].ActiveProcessorMask: 0x%lx\n", i, j, ex->Group.GroupInfo[j].ActiveProcessorMask);
@ -903,16 +900,11 @@ static void test_query_logicalprocex(void)
status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_core, len_core, &len_core);
ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
for(i = 0; status == STATUS_SUCCESS && i < len_core;) {
for (i = 0; status == STATUS_SUCCESS && i < len_core;)
{
ex = (void *)(((char*)infoex_core) + i);
if (ex->Size == 0) {
ok(0, "Got infoex_core[%u].Size=0\n", i);
break;
}
if (ex->Relationship != RelationProcessorCore) {
ok(0, "Expected 0x%x, got 0x%x\n", RelationProcessorCore, ex->Relationship);
break;
}
ok(ex->Size, "%u: got size 0\n", i);
ok(ex->Relationship == RelationProcessorCore, "%u: got relationship %#x\n", i, ex->Relationship);
i += ex->Size;
}
@ -920,16 +912,11 @@ static void test_query_logicalprocex(void)
status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_numa, len_numa, &len_numa);
ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
for(i = 0; status == STATUS_SUCCESS && i < len_numa;) {
for (i = 0; status == STATUS_SUCCESS && i < len_numa;)
{
ex = (void *)(((char*)infoex_numa) + i);
if (ex->Size == 0) {
ok(0, "Got infoex_numa[%u].Size=0\n", i);
break;
}
if (ex->Relationship != RelationNumaNode) {
ok(0, "Expected 0x%x, got 0x%x\n", RelationNumaNode, ex->Relationship);
break;
}
ok(ex->Size, "%u: got size 0\n", i);
ok(ex->Relationship == RelationNumaNode, "%u: got relationship %#x\n", i, ex->Relationship);
i += ex->Size;
}
@ -937,16 +924,11 @@ static void test_query_logicalprocex(void)
status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_cache, len_cache, &len_cache);
ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
for(i = 0; status == STATUS_SUCCESS && i < len_cache;) {
for (i = 0; status == STATUS_SUCCESS && i < len_cache;)
{
ex = (void *)(((char*)infoex_cache) + i);
if (ex->Size == 0) {
ok(0, "Got infoex_cache[%u].Size=0\n", i);
break;
}
if (ex->Relationship != RelationCache) {
ok(0, "Expected 0x%x, got 0x%x\n", RelationCache, ex->Relationship);
break;
}
ok(ex->Size, "%u: got size 0\n", i);
ok(ex->Relationship == RelationCache, "%u: got relationship %#x\n", i, ex->Relationship);
i += ex->Size;
}
@ -954,16 +936,11 @@ static void test_query_logicalprocex(void)
status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_package, len_package, &len_package);
ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
for(i = 0; status == STATUS_SUCCESS && i < len_package;) {
for (i = 0; status == STATUS_SUCCESS && i < len_package;)
{
ex = (void *)(((char*)infoex_package) + i);
if (ex->Size == 0) {
ok(0, "Got infoex_package[%u].Size=0\n", i);
break;
}
if (ex->Relationship != RelationProcessorPackage) {
ok(0, "Expected 0x%x, got 0x%x\n", RelationProcessorPackage, ex->Relationship);
break;
}
ok(ex->Size, "%u: got size 0\n", i);
ok(ex->Relationship == RelationProcessorPackage, "%u: got relationship %#x\n", i, ex->Relationship);
i += ex->Size;
}
@ -971,16 +948,11 @@ static void test_query_logicalprocex(void)
status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_group, len_group, &len_group);
ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
for(i = 0; status == STATUS_SUCCESS && i < len_group;) {
for (i = 0; status == STATUS_SUCCESS && i < len_group;)
{
ex = (void *)(((char *)infoex_group) + i);
if (ex->Size == 0) {
ok(0, "Got infoex_group[%u].Size=0\n", i);
break;
}
if (ex->Relationship != RelationGroup) {
ok(0, "Expected 0x%x, got 0x%x\n", RelationGroup, ex->Relationship);
break;
}
ok(ex->Size, "%u: got size 0\n", i);
ok(ex->Relationship == RelationGroup, "%u: got relationship %#x\n", i, ex->Relationship);
i += ex->Size;
}
@ -995,7 +967,6 @@ static void test_query_logicalprocex(void)
HeapFree(GetProcessHeap(), 0, infoex_package);
HeapFree(GetProcessHeap(), 0, infoex_group);
}
}
static void test_query_firmware(void)
{