mbpfan-josie

Check root privileges before running tests

References #155.

ce3218407fbbaacd408ac251ba6f30fadf259ea7
Andrew Gaul <andrew@gaul.org> · 2018-08-15T13:14 · browse files at this commit

parents: 33e9363

diff --git a/src/main.c b/src/main.c
index d447cbd..37a852c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,6 +29,7 @@
 #include "mbpfan.h"
 #include "daemon.h"
 #include "global.h"
+#include "main.h"
 #include "minunit.h"
 
 int daemonize = 1;
diff --git a/src/main.h b/src/main.h
new file mode 100644
index 0000000..13013e8
--- /dev/null
+++ b/src/main.h
@@ -0,0 +1 @@
+void check_requirements();
diff --git a/src/minunit.c b/src/minunit.c
index 7f6e053..4b8aaca 100644
--- a/src/minunit.c
+++ b/src/minunit.c
@@ -9,6 +9,7 @@
 #include "global.h"
 #include "mbpfan.h"
 #include "settings.h"
+#include "main.h"
 #include "minunit.h"
 
 int tests_run = 0;
@@ -193,6 +194,8 @@ static const char *all_tests()
 
 int tests()
 {
+    check_requirements();
+
     printf("Starting the tests..\n");
     printf("It is normal for them to take a bit to finish.\n");