summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-09-30 12:45:27 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-10-02 03:52:45 +0200
commitd287ece7f17e1015f3ee6f17fd9fba92abc31716 (patch)
tree8a2e0482d951684fccde4680fabbd956c8d2c251
parentjournal: move several tests to libsystemd/sd-journal (diff)
downloadsystemd-d287ece7f17e1015f3ee6f17fd9fba92abc31716.tar.xz
systemd-d287ece7f17e1015f3ee6f17fd9fba92abc31716.zip
test: split test-tables into three
Let's drop dependency to libjournal_core and libudevd_core from test-tables.
-rw-r--r--src/journal/meson.build8
-rw-r--r--src/journal/test-journald-tables.c11
-rw-r--r--src/test/meson.build26
-rw-r--r--src/test/test-tables.c6
-rw-r--r--src/udev/meson.build8
-rw-r--r--src/udev/net/test-link-config-tables.c10
6 files changed, 36 insertions, 33 deletions
diff --git a/src/journal/meson.build b/src/journal/meson.build
index a3aa8ad5ee..4187dab673 100644
--- a/src/journal/meson.build
+++ b/src/journal/meson.build
@@ -28,8 +28,6 @@ libjournal_core = static_library(
userspace],
build_by_default : false)
-journal_includes = [includes, include_directories('.')]
-
if get_option('link-journalctl-shared')
journalctl_link_with = [libshared]
else
@@ -119,6 +117,12 @@ executables += [
threads,
],
},
+ journal_test_template + {
+ 'sources' : files('test-journald-tables.c'),
+ 'dependencies' : [
+ libselinux,
+ ],
+ },
journal_fuzz_template + {
'sources' : files(
'fuzz-journald-audit.c',
diff --git a/src/journal/test-journald-tables.c b/src/journal/test-journald-tables.c
new file mode 100644
index 0000000000..958beb8417
--- /dev/null
+++ b/src/journal/test-journald-tables.c
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "journald-server.h"
+#include "test-tables.h"
+
+int main(int argc, char **argv) {
+ test_table(split_mode, SPLIT);
+ test_table(storage, STORAGE);
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/test/meson.build b/src/test/meson.build
index ae80c72a8b..7e25fcdbaa 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -402,29 +402,6 @@ executables += [
'link_with' : libbasic,
},
test_template + {
- 'sources' : files('test-tables.c'),
- 'link_with' : [
- libcore,
- libjournal_core,
- libshared,
- libudevd_core,
- ],
- 'dependencies' : [
- libblkid,
- liblz4,
- libmount,
- libseccomp,
- libselinux,
- libxz,
- threads,
- ],
- 'include_directories' : [
- core_includes,
- journal_includes,
- udev_includes,
- ],
- },
- test_template + {
'sources' : files('test-time-util.c'),
'timeout' : 120,
},
@@ -571,6 +548,9 @@ executables += [
'conditions' : ['BPF_FRAMEWORK'],
},
core_test_template + {
+ 'sources' : files('test-tables.c'),
+ },
+ core_test_template + {
'sources' : files('test-unit-name.c'),
'dependencies' : common_test_dependencies,
},
diff --git a/src/test/test-tables.c b/src/test/test-tables.c
index ee8310f114..975f952a1f 100644
--- a/src/test/test-tables.c
+++ b/src/test/test-tables.c
@@ -14,13 +14,12 @@
#include "import-util.h"
#include "install.h"
#include "job.h"
-#include "journald-server.h"
#include "kill.h"
-#include "link-config.h"
#include "locale-util.h"
#include "log.h"
#include "logs-show.h"
#include "mount.h"
+#include "netif-naming-scheme.h"
#include "path.h"
#include "process-util.h"
#include "resolve-util.h"
@@ -72,7 +71,6 @@ int main(int argc, char **argv) {
test_table(kill_who, KILL_WHO);
test_table(locale_variable, VARIABLE_LC);
test_table(log_target, LOG_TARGET);
- test_table(mac_address_policy, MAC_ADDRESS_POLICY);
test_table(managed_oom_mode, MANAGED_OOM_MODE);
test_table(managed_oom_preference, MANAGED_OOM_PREFERENCE);
test_table(manager_state, MANAGER_STATE);
@@ -107,8 +105,6 @@ int main(int argc, char **argv) {
test_table(socket_exec_command, SOCKET_EXEC_COMMAND);
test_table(socket_result, SOCKET_RESULT);
test_table(socket_state, SOCKET_STATE);
- test_table(split_mode, SPLIT);
- test_table(storage, STORAGE);
test_table(swap_exec_command, SWAP_EXEC_COMMAND);
test_table(swap_result, SWAP_RESULT);
test_table(swap_state, SWAP_STATE);
diff --git a/src/udev/meson.build b/src/udev/meson.build
index e0cd47f80b..cd4d1f4277 100644
--- a/src/udev/meson.build
+++ b/src/udev/meson.build
@@ -105,13 +105,12 @@ endif
############################################################
-udev_includes = [includes, include_directories('net', '.')]
libudevd_core = static_library(
'udev-core',
libudevd_core_sources,
link_config_gperf_c,
keyboard_keys_from_name_h,
- include_directories : udev_includes,
+ include_directories : includes + include_directories('net'),
link_with : udev_link_with,
dependencies : [libblkid,
libkmod,
@@ -204,6 +203,10 @@ executables += [
'suite' : 'udev',
},
udev_test_template + {
+ 'sources' : files('net/test-link-config-tables.c'),
+ 'suite' : 'udev',
+ },
+ udev_test_template + {
'sources' : files('test-udev-builtin.c'),
},
udev_test_template + {
@@ -236,7 +239,6 @@ executables += [
},
udev_fuzz_template + {
'sources' : files('net/fuzz-link-parser.c'),
- 'include_directories' : udev_includes,
},
udev_fuzz_template + {
'sources' : files('fuzz-udev-rule-parse-value.c'),
diff --git a/src/udev/net/test-link-config-tables.c b/src/udev/net/test-link-config-tables.c
new file mode 100644
index 0000000000..4fd004607f
--- /dev/null
+++ b/src/udev/net/test-link-config-tables.c
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "link-config.h"
+#include "test-tables.h"
+
+int main(int argc, char **argv) {
+ test_table(mac_address_policy, MAC_ADDRESS_POLICY);
+
+ return EXIT_SUCCESS;
+}