Skip to content

Commit

Permalink
Add diagnostics output
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Bain <peter_bain@ca.ibm.com>
  • Loading branch information
pdbain-ibm committed Mar 6, 2019
1 parent bfff1d8 commit 80d89f5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions fvtest/porttest/si.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ TEST(PortSysinfoTest, sysinfo_test_sysinfo_set_limit_CORE_FILE)
intptr_t rc = -1;
uint64_t originalSoftLimit = 0;
uint64_t finalSoftLimit = 0;
uint64_t softSetToHardLimit = 0;
uint64_t originalHardLimit = 0;
uint64_t currentLimit = 0;
const uint64_t descriptorLimit = 256;
Expand All @@ -848,6 +849,7 @@ TEST(PortSysinfoTest, sysinfo_test_sysinfo_set_limit_CORE_FILE)
reportTestExit(OMRPORTLIB, testName);
return;
}
portTestEnv->log(LEVEL_ERROR, "originalSoftLimit=%llu\n", originalSoftLimit);
finalSoftLimit = originalSoftLimit;

rc = omrsysinfo_set_limit(OMRPORT_RESOURCE_FILE_DESCRIPTORS, descriptorLimit);
Expand Down Expand Up @@ -880,6 +882,7 @@ TEST(PortSysinfoTest, sysinfo_test_sysinfo_set_limit_CORE_FILE)
reportTestExit(OMRPORTLIB, testName);
return;
}
portTestEnv->log(LEVEL_ERROR, "originalHardLimit=%llu\n", originalHardLimit);

/* set soft limit to hard limit */
rc = omrsysinfo_set_limit(OMRPORT_RESOURCE_FILE_DESCRIPTORS, originalHardLimit);
Expand All @@ -889,6 +892,15 @@ TEST(PortSysinfoTest, sysinfo_test_sysinfo_set_limit_CORE_FILE)
return;
}

/* get new soft limit */
rc = omrsysinfo_get_limit(OMRPORT_RESOURCE_FILE_DESCRIPTORS, &softSetToHardLimit);
if (OMRPORT_LIMIT_UNKNOWN == rc) {
outputErrorMessage(PORTTEST_ERROR_ARGS, "omrsysinfo_get_limit FAILED: OMRPORT_LIMIT_UNKNOWN\n");
reportTestExit(OMRPORTLIB, testName);
return;
}
portTestEnv->log(LEVEL_ERROR, "soft set to hard limit=%llu\n", softSetToHardLimit);

/* set soft limit to old value */
rc = omrsysinfo_set_limit(OMRPORT_RESOURCE_FILE_DESCRIPTORS, originalSoftLimit);
if (0 != rc) {
Expand All @@ -910,11 +922,11 @@ TEST(PortSysinfoTest, sysinfo_test_sysinfo_set_limit_CORE_FILE)
* the actual value may be much smaller than requested.
* In that case, just try setting it to the same value.
*/
uint64_t newHardLimit = (OMRPORT_LIMIT_UNLIMITED == rc) ? originalHardLimit: originalHardLimit - 1;
uint64_t newHardLimit = (OMRPORT_LIMIT_UNLIMITED == rc) ? softSetToHardLimit: softSetToHardLimit - 1;

rc = omrsysinfo_set_limit(OMRPORT_RESOURCE_FILE_DESCRIPTORS | OMRPORT_LIMIT_HARD, newHardLimit);
if (0 != rc) {
outputErrorMessage(PORTTEST_ERROR_ARGS, "omrsysinfo_set_limit set hard limit FAILED rc=%d\n", rc);
outputErrorMessage(PORTTEST_ERROR_ARGS, "omrsysinfo_set_limit set hard limit=%lld FAILED rc=%d\n", rc, newHardLimit);
reportTestExit(OMRPORTLIB, testName);
return;
}
Expand Down

0 comments on commit 80d89f5

Please sign in to comment.