X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftest%2Ftest-sleep.c;h=1d75d05a883aa9516522c4bd9520cf80d68791ec;hb=a37e4fcf9969c36d59e2f9683079d9b08a3dcfb1;hp=545dfab92ccdd4ecf2b42f9dc0653f851b775fd8;hpb=69ab80881552d5f79ca95f6b3be48ad122ab1ec2;p=elogind.git
diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c
index 545dfab92..1d75d05a8 100644
--- a/src/test/test-sleep.c
+++ b/src/test/test-sleep.c
@@ -19,17 +19,14 @@
along with systemd; If not, see .
***/
-#include
-#include
#include
-#include
#include "util.h"
#include "log.h"
#include "sleep-config.h"
#include "strv.h"
-int main(int argc, char* argv[]) {
+static void test_sleep(void) {
_cleanup_strv_free_ char
**standby = strv_new("standby", NULL),
**mem = strv_new("mem", NULL),
@@ -52,6 +49,16 @@ int main(int argc, char* argv[]) {
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));
log_info("Hybrid-sleep configured and possible: %s", yes_no(can_sleep("hybrid-sleep") > 0));
+}
+
+int main(int argc, char* argv[]) {
+ log_parse_environment();
+ log_open();
+
+ if (getuid() != 0)
+ log_warning("This program is unlikely to work for unpriviledged users");
+
+ test_sleep();
return 0;
}