[llvm][unittests] Fix ProgramEnvTest.TestExecuteAndWaitStatistics on Solaris
authorRainer Orth <ro@gcc.gnu.org>
Tue, 14 Jul 2020 09:29:47 +0000 (11:29 +0200)
committerRainer Orth <ro@gcc.gnu.org>
Tue, 14 Jul 2020 09:29:47 +0000 (11:29 +0200)
commit2d1fe0c372473a40a81309eefdd4d47a23160736
tree8c2d5502d66e5a6fcbc292ad6f517a22d3f3cef6
parent57909b0a53d8167ac8f6079b53d5504c25157fdf
[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
llvm/unittests/Support/ProgramTest.cpp