summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-25 13:14:12 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-25 13:19:18 +0100
commit3ffd4af22052963e7a29431721ee204e634bea75 (patch)
treefe60142dfddd37cfc02b7a135542107e772b36c3 /src/test
parent04c0136989b7eb896bfb0fb176e11233d69e1453 (diff)
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them over.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-btrfs.c7
-rw-r--r--src/test/test-capability.c12
-rw-r--r--src/test/test-cgroup-util.c5
-rw-r--r--src/test/test-copy.c1
-rw-r--r--src/test/test-fdset.c3
-rw-r--r--src/test/test-fileio.c13
-rw-r--r--src/test/test-namespace.c1
-rw-r--r--src/test/test-path-util.c1
-rw-r--r--src/test/test-path.c1
-rw-r--r--src/test/test-sigbus.c3
-rw-r--r--src/test/test-socket-util.c1
-rw-r--r--src/test/test-terminal-util.c1
-rw-r--r--src/test/test-tmpfiles.c1
-rw-r--r--src/test/test-unit-file.c1
-rw-r--r--src/test/test-util.c1
15 files changed, 34 insertions, 18 deletions
diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c
index b772e31963..afe3ff8fc2 100644
--- a/src/test/test-btrfs.c
+++ b/src/test/test-btrfs.c
@@ -21,11 +21,12 @@
#include <fcntl.h>
-#include "log.h"
-#include "fileio.h"
-#include "util.h"
#include "btrfs-util.h"
+#include "fd-util.h"
+#include "fileio.h"
+#include "log.h"
#include "string-util.h"
+#include "util.h"
int main(int argc, char *argv[]) {
BtrfsQuotaInfo quota;
diff --git a/src/test/test-capability.c b/src/test/test-capability.c
index f47452ce72..09d7e61e92 100644
--- a/src/test/test-capability.c
+++ b/src/test/test-capability.c
@@ -17,20 +17,22 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <sys/wait.h>
-#include <sys/capability.h>
-#include <sys/socket.h>
#include <netinet/in.h>
#include <pwd.h>
+#include <sys/capability.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
#include <unistd.h>
#include "capability.h"
-#include "util.h"
+#include "fd-util.h"
#include "macro.h"
+#include "util.h"
static uid_t test_uid = -1;
static gid_t test_gid = -1;
-// We keep CAP_DAC_OVERRIDE to avoid errors with gcov when doing test coverage
+
+/* We keep CAP_DAC_OVERRIDE to avoid errors with gcov when doing test coverage */
static uint64_t test_flags = 1ULL << CAP_DAC_OVERRIDE;
static void fork_test(void (*test_func)(void)) {
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index 267dda651d..7bf59a0aa2 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -19,12 +19,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "util.h"
#include "cgroup-util.h"
-#include "test-helper.h"
+#include "fd-util.h"
#include "formats-util.h"
#include "process-util.h"
#include "string-util.h"
+#include "test-helper.h"
+#include "util.h"
static void check_p_d_u(const char *path, int code, const char *result) {
_cleanup_free_ char *unit = NULL;
diff --git a/src/test/test-copy.c b/src/test/test-copy.c
index 000d407db1..1bd50edca2 100644
--- a/src/test/test-copy.c
+++ b/src/test/test-copy.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include "copy.h"
+#include "fd-util.h"
#include "fileio.h"
#include "macro.h"
#include "mkdir.h"
diff --git a/src/test/test-fdset.c b/src/test/test-fdset.c
index 242c5d9dc2..96d5e38177 100644
--- a/src/test/test-fdset.c
+++ b/src/test/test-fdset.c
@@ -20,9 +20,10 @@
#include <fcntl.h>
#include <unistd.h>
+#include "fd-util.h"
#include "fdset.h"
-#include "util.h"
#include "macro.h"
+#include "util.h"
static void test_fdset_new_fill(void) {
int fd = -1;
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index a72e84bc66..a40f013491 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -23,14 +23,15 @@
#include <fcntl.h>
#include <unistd.h>
-#include "util.h"
-#include "process-util.h"
-#include "fileio.h"
-#include "strv.h"
-#include "env-util.h"
-#include "def.h"
#include "ctype.h"
+#include "def.h"
+#include "env-util.h"
+#include "fd-util.h"
+#include "fileio.h"
+#include "process-util.h"
#include "string-util.h"
+#include "strv.h"
+#include "util.h"
static void test_parse_env_file(void) {
char t[] = "/tmp/test-fileio-in-XXXXXX",
diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c
index de11443c7a..a060a7ba6f 100644
--- a/src/test/test-namespace.c
+++ b/src/test/test-namespace.c
@@ -21,6 +21,7 @@
#include <sys/socket.h>
+#include "fd-util.h"
#include "namespace.h"
#include "process-util.h"
#include "string-util.h"
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
index 2977487c88..89129c9894 100644
--- a/src/test/test-path-util.c
+++ b/src/test/test-path-util.c
@@ -23,6 +23,7 @@
#include <sys/mount.h>
#include <unistd.h>
+#include "fd-util.h"
#include "macro.h"
#include "path-util.h"
#include "rm-rf.h"
diff --git a/src/test/test-path.c b/src/test/test-path.c
index 19796bd6cb..e9e0bfd41d 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -28,6 +28,7 @@
#include "strv.h"
#include "unit.h"
#include "util.h"
+#include "fd-util.h"
typedef void (*test_function_t)(Manager *m);
diff --git a/src/test/test-sigbus.c b/src/test/test-sigbus.c
index f5bae65bef..b3ccc7509d 100644
--- a/src/test/test-sigbus.c
+++ b/src/test/test-sigbus.c
@@ -21,8 +21,9 @@
#include <sys/mman.h>
-#include "util.h"
+#include "fd-util.h"
#include "sigbus.h"
+#include "util.h"
int main(int argc, char *argv[]) {
_cleanup_close_ int fd = -1;
diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c
index ba1c7e6877..4a2d952c86 100644
--- a/src/test/test-socket-util.c
+++ b/src/test/test-socket-util.c
@@ -18,6 +18,7 @@
***/
#include "async.h"
+#include "fd-util.h"
#include "in-addr-util.h"
#include "log.h"
#include "macro.h"
diff --git a/src/test/test-terminal-util.c b/src/test/test-terminal-util.c
index d81fdb9923..a41de59719 100644
--- a/src/test/test-terminal-util.c
+++ b/src/test/test-terminal-util.c
@@ -25,6 +25,7 @@
#include "macro.h"
#include "util.h"
#include "log.h"
+#include "fd-util.h"
static void test_default_term_for_tty(void) {
puts(default_term_for_tty("/dev/tty23"));
diff --git a/src/test/test-tmpfiles.c b/src/test/test-tmpfiles.c
index ab255c7c83..6aa9cc8473 100644
--- a/src/test/test-tmpfiles.c
+++ b/src/test/test-tmpfiles.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <unistd.h>
+#include "fd-util.h"
#include "formats-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index e4573956a5..226453d06e 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -26,6 +26,7 @@
#include <string.h>
#include <unistd.h>
+#include "fd-util.h"
#include "fileio.h"
#include "hashmap.h"
#include "hostname-util.h"
diff --git a/src/test/test-util.c b/src/test/test-util.c
index 49a30601bc..ddfcdd857b 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -44,6 +44,7 @@
#include "strv.h"
#include "util.h"
#include "virt.h"
+#include "fd-util.h"
static void test_streq_ptr(void) {
assert_se(streq_ptr(NULL, NULL));