summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
112a7f4)
Travis tests are failing, probably because /proc/meminfo is not available
in the test environment. The same might be true in some virtualized systems,
so just treat missing /proc/meminfo as a sign that hibernation is not
possible.
r = get_status_field("/proc/meminfo", "\nSwapFree:", &swapfree);
if (r < 0) {
r = get_status_field("/proc/meminfo", "\nSwapFree:", &swapfree);
if (r < 0) {
- log_error("Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
+ log_full(r == -ENOENT ? LOG_DEBUG : LOG_WARNING,
+ "Failed to retrieve SwapFree from /proc/meminfo: %s", strerror(-r));
static void test_status_field(void) {
_cleanup_free_ char *t = NULL, *p = NULL, *s = NULL;
unsigned long long total, buffers;
static void test_status_field(void) {
_cleanup_free_ char *t = NULL, *p = NULL, *s = NULL;
unsigned long long total, buffers;
assert_se(get_status_field("/proc/self/status", "\nThreads:", &t) == 0);
puts(t);
assert_se(streq(t, "1"));
assert_se(get_status_field("/proc/self/status", "\nThreads:", &t) == 0);
puts(t);
assert_se(streq(t, "1"));
- assert_se(get_status_field("/proc/meminfo", "MemTotal:", &p) == 0);
+ r = get_status_field("/proc/meminfo", "MemTotal:", &p);
+ if (r == -ENOENT)
+ return;
+ assert(r == 0);
puts(p);
assert_se(safe_atollu(p, &total) == 0);
puts(p);
assert_se(safe_atollu(p, &total) == 0);