summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-fileio.c20
-rw-r--r--src/test/test-sleep.c16
2 files changed, 28 insertions, 8 deletions
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 1184e7e02f..4a4ed79c11 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -229,9 +229,29 @@ static void test_executable_is_script(void) {
unlink(t);
}
+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/meminfo", "MemTotal:", &p) == 0);
+ puts(p);
+ assert_se(safe_atollu(p, &total) == 0);
+
+ assert_se(get_status_field("/proc/meminfo", "\nBuffers:", &s) == 0);
+ puts(s);
+ assert_se(safe_atollu(s, &buffers) == 0);
+
+ assert(buffers < total);
+}
+
int main(int argc, char *argv[]) {
test_parse_env_file();
test_parse_multiline_env_file();
test_executable_is_script();
+ test_status_field();
return 0;
}
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c
index c3cb9c531d..545dfab92c 100644
--- a/src/test/test-sleep.c
+++ b/src/test/test-sleep.c
@@ -40,14 +40,14 @@ int main(int argc, char* argv[]) {
**shutdown = strv_new("shutdown", NULL),
**freez = strv_new("freeze", NULL);
- log_info("Can Standby: %s", yes_no(can_sleep_state(standby) > 0));
- log_info("Can Suspend: %s", yes_no(can_sleep_state(mem) > 0));
- log_info("Can Hibernate: %s", yes_no(can_sleep_state(disk) > 0));
- log_info("Can Hibernate+Suspend (Hybrid-Sleep): %s", yes_no(can_sleep_disk(suspend) > 0));
- log_info("Can Hibernate+Reboot: %s", yes_no(can_sleep_disk(reboot) > 0));
- log_info("Can Hibernate+Platform: %s", yes_no(can_sleep_disk(platform) > 0));
- log_info("Can Hibernate+Shutdown: %s", yes_no(can_sleep_disk(shutdown) > 0));
- log_info("Can Freeze: %s", yes_no(can_sleep_disk(freez) > 0));
+ log_info("Standby configured: %s", yes_no(can_sleep_state(standby) > 0));
+ log_info("Suspend configured: %s", yes_no(can_sleep_state(mem) > 0));
+ log_info("Hibernate configured: %s", yes_no(can_sleep_state(disk) > 0));
+ log_info("Hibernate+Suspend (Hybrid-Sleep) configured: %s", yes_no(can_sleep_disk(suspend) > 0));
+ log_info("Hibernate+Reboot configured: %s", yes_no(can_sleep_disk(reboot) > 0));
+ log_info("Hibernate+Platform configured: %s", yes_no(can_sleep_disk(platform) > 0));
+ log_info("Hibernate+Shutdown configured: %s", yes_no(can_sleep_disk(shutdown) > 0));
+ log_info("Freeze configured: %s", yes_no(can_sleep_state(freez) > 0));
log_info("Suspend configured and possible: %s", yes_no(can_sleep("suspend") > 0));
log_info("Hibernation configured and possible: %s", yes_no(can_sleep("hibernate") > 0));