[llvm][unittests] Fix ProgramEnvTest.TestExecuteAndWaitStatistics on Solaris

The new `LLVM-Unit :: Support/./SupportTests/ProgramEnvTest.TestExecuteAndWaitStatistics` test currently FAILs on Solaris:

  [ RUN      ] ProgramEnvTest.TestExecuteAndWaitStatistics
  /vol/llvm/src/llvm-project/local/llvm/unittests/Support/ProgramTest.cpp:360: Failure
  Expected: (ProcStat->PeakMemory) > (0U), actual: 0 vs 0
  [  FAILED  ] ProgramEnvTest.TestExecuteAndWaitStatistics (22 ms)

According to `llvm/lib/Support/Unix/Program.inc (llvm::sys::Wait)`, `PeakMemory`
corresponds to `struct rusage.ru_maxrss`.

However, Solaris `getrusage(3C)` documents

  NOTES
         The ru_maxrss, ru_ixrss, ru_idrss, and ru_isrss members of  the  rusage
         structure are set to 0 in this implementation.

Since changing the test to check for `PeakMemory >= 0` instead is pointless
and would generate a warning on targets where `ru_maxrss` is unsigned, this
patch removes the check.

Tested on `amd64-pc-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D83661
This commit is contained in:
Rainer Orth 2020-07-14 11:29:47 +02:00
parent 57909b0a53
commit 2d1fe0c372
1 changed files with 0 additions and 1 deletions

View File

@ -357,7 +357,6 @@ TEST_F(ProgramEnvTest, TestExecuteAndWaitStatistics) {
&ExecutionFailed, &ProcStat); &ExecutionFailed, &ProcStat);
ASSERT_EQ(0, RetCode); ASSERT_EQ(0, RetCode);
ASSERT_TRUE(ProcStat); ASSERT_TRUE(ProcStat);
ASSERT_GT(ProcStat->PeakMemory, 0U);
ASSERT_GE(ProcStat->UserTime, std::chrono::microseconds(0)); ASSERT_GE(ProcStat->UserTime, std::chrono::microseconds(0));
ASSERT_GE(ProcStat->TotalTime, ProcStat->UserTime); ASSERT_GE(ProcStat->TotalTime, ProcStat->UserTime);
} }