[PATCH] D83661: [llvm][unittests] Fix LLVM-Unit :: Support/./SupportTests/ProgramEnvTest.TestExecuteAndWaitStatistics on Solaris

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 02:34:12 PDT 2020


ro created this revision.
ro added reviewers: LLVM, sepavloff, zturner, aprantl, aganea.
ro added a project: LLVM.
Herald added a subscriber: fedor.sergeev.

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.

To deal with this, this patch changes to test to allow for `PeakMemory == 0`.

Tested on `amd64-pc-solaris2.11`.  Ok for master?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83661

Files:
  llvm/unittests/Support/ProgramTest.cpp


Index: llvm/unittests/Support/ProgramTest.cpp
===================================================================
--- llvm/unittests/Support/ProgramTest.cpp
+++ llvm/unittests/Support/ProgramTest.cpp
@@ -357,7 +357,7 @@
                                &ExecutionFailed, &ProcStat);
   ASSERT_EQ(0, RetCode);
   ASSERT_TRUE(ProcStat);
-  ASSERT_GT(ProcStat->PeakMemory, 0U);
+  ASSERT_GE(ProcStat->PeakMemory, 0U);
   ASSERT_GE(ProcStat->UserTime, std::chrono::microseconds(0));
   ASSERT_GE(ProcStat->TotalTime, ProcStat->UserTime);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83661.277351.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200713/ad3a8f04/attachment.bin>


More information about the llvm-commits mailing list