27 #include <gtest/gtest.h>
31 TEST(LinuxProcess, accessing_proc_stats_works)
34 [](){
while(
true);
return core::posix::exit::Status::success;},
35 core::posix::StandardStream::empty);
38 EXPECT_NO_THROW(child >> stat);
42 TEST(LinuxProcess, accessing_proc_oom_score_works)
48 TEST(LinuxProcess, accessing_proc_oom_score_adj_works)
60 ::testing::AssertionResult is_approximately_equal(
int a,
int b)
62 static const int error_margin = 10;
65 return ::testing::AssertionSuccess() << ::abs(a-b) <<
" <= " << error_margin;
67 return ::testing::AssertionFailure() << ::abs(a-b) <<
" > " << error_margin;
71 TEST(LinuxProcess, adjusting_proc_oom_score_adj_works)
88 TEST(LinuxProcess, adjusting_proc_oom_score_adj_to_privileged_values_only_works_if_root)
104 TEST(LinuxProcess, trying_to_write_an_invalid_oom_score_adj_throws)
114 TEST(LinuxProcess, adjusting_proc_oom_adj_works)
134 TEST(LinuxProcess, adjusting_proc_oom_adj_to_privileged_values_does_not_work)
150 TEST(LinuxProcess, trying_to_write_an_invalid_oom_adj_throws)