[llvm] 2d1fe0c - [llvm][unittests] Fix ProgramEnvTest.TestExecuteAndWaitStatistics on Solaris

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 02:30:56 PDT 2020


Author: Rainer Orth
Date: 2020-07-14T11:29:47+02:00
New Revision: 2d1fe0c372473a40a81309eefdd4d47a23160736

URL: https://github.com/llvm/llvm-project/commit/2d1fe0c372473a40a81309eefdd4d47a23160736
DIFF: https://github.com/llvm/llvm-project/commit/2d1fe0c372473a40a81309eefdd4d47a23160736.diff

LOG: [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

Added: 
    

Modified: 
    llvm/unittests/Support/ProgramTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/ProgramTest.cpp b/llvm/unittests/Support/ProgramTest.cpp
index 3025e6c859a8..9052b66b5fb9 100644
--- a/llvm/unittests/Support/ProgramTest.cpp
+++ b/llvm/unittests/Support/ProgramTest.cpp
@@ -357,7 +357,6 @@ TEST_F(ProgramEnvTest, TestExecuteAndWaitStatistics) {
                                &ExecutionFailed, &ProcStat);
   ASSERT_EQ(0, RetCode);
   ASSERT_TRUE(ProcStat);
-  ASSERT_GT(ProcStat->PeakMemory, 0U);
   ASSERT_GE(ProcStat->UserTime, std::chrono::microseconds(0));
   ASSERT_GE(ProcStat->TotalTime, ProcStat->UserTime);
 }


        


More information about the llvm-commits mailing list