chiark / gitweb /
test-tables: add new entries
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 10 Jul 2014 02:29:24 +0000 (22:29 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 16 Jul 2014 23:00:03 +0000 (19:00 -0400)
One missing string found.

A few things had to be moved around to make it possible to test them.

.gitignore
Makefile.am
src/bus-proxyd/bus-policy.c
src/libsystemd/sd-rtnl/rtnl-types.c
src/libsystemd/sd-rtnl/rtnl-types.h
src/network/test-network-tables.c [new file with mode: 0644]
src/shared/install.c
src/shared/install.h
src/shared/test-tables.h
src/test/test-tables.c

index eab1f4c322c88e0d81fe5f36f35ce7a796cf9fbd..bf53064105c52995ab71ecfba817efdc2eb34605 100644 (file)
 /test-mmap-cache
 /test-namespace
 /test-network
+/test-network-tables
 /test-ns
 /test-path-util
 /test-prioq
index 94cd402e7137dfe2ae747f636e8bb88eb22df130..702513768335585db98d123e8af3b5713dc0fa07 100644 (file)
@@ -1453,16 +1453,22 @@ test_list_LDADD = \
 
 test_tables_SOURCES = \
        src/test/test-tables.c \
-       src/shared/test-tables.h
+       src/shared/test-tables.h \
+       src/bus-proxyd/bus-policy.c \
+       src/bus-proxyd/bus-policy.h \
+       src/journal/journald-server.c \
+       src/journal/journald-server.h
 
 test_tables_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       -I$(srcdir)/src/bus-proxyd
 
 test_tables_LDADD = \
        libsystemd-logs.la \
        libsystemd-journal-internal.la \
        libsystemd-core.la \
+       libudev-core.la \
        $(RT_LIBS)
 
 test_prioq_SOURCES = \
@@ -4784,8 +4790,17 @@ test_network_CFLAGS = \
 test_network_LDADD = \
        libsystemd-networkd-core.la
 
+test_network_tables_SOURCES = \
+       src/network/test-network-tables.c \
+       src/shared/test-tables.h
+
+test_network_tables_LDADD = \
+       libsystemd-networkd-core.la \
+       libudev-core.la
+
 tests += \
-       test-network
+       test-network \
+       test-network-tables
 
 nodist_systemunit_DATA += \
        units/systemd-networkd.service \
index 3f1d7557c178a53493ad4f3755612cd433ec97b7..06c16a7eb6d2ca7ee29b9b4540bc22d679a43219 100644 (file)
@@ -724,5 +724,6 @@ static const char* const policy_item_class_table[_POLICY_ITEM_CLASS_MAX] = {
         [POLICY_ITEM_OWN_PREFIX] = "own-prefix",
         [POLICY_ITEM_USER] = "user",
         [POLICY_ITEM_GROUP] = "group",
+        [POLICY_ITEM_IGNORE] = "ignore",
 };
 DEFINE_STRING_TABLE_LOOKUP(policy_item_class, PolicyItemClass);
index 9c3430d1bf88a9c039bbefcc24543dcbcc4fef36..ff90895b1acff65f2ebbe07f4f510f170a17dbf3 100644 (file)
@@ -155,25 +155,6 @@ static const NLType rtnl_link_info_data_ipvti_types[IFLA_VTI_MAX + 1] = {
         [IFLA_VTI_REMOTE]       = { .type = NLA_IN_ADDR  },
 };
 
-typedef enum NLUnionLinkInfoData {
-        NL_UNION_LINK_INFO_DATA_BOND,
-        NL_UNION_LINK_INFO_DATA_BRIDGE,
-        NL_UNION_LINK_INFO_DATA_VLAN,
-        NL_UNION_LINK_INFO_DATA_VETH,
-        NL_UNION_LINK_INFO_DATA_DUMMY,
-        NL_UNION_LINK_INFO_DATA_MACVLAN,
-        NL_UNION_LINK_INFO_DATA_VXLAN,
-        NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
-        NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL,
-        NL_UNION_LINK_INFO_DATA_SIT_TUNNEL,
-        NL_UNION_LINK_INFO_DATA_VTI_TUNNEL,
-        _NL_UNION_LINK_INFO_DATA_MAX,
-        _NL_UNION_LINK_INFO_DATA_INVALID = -1
-} NLUnionLinkInfoData;
-
-const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
-NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;
-
 /* these strings must match the .kind entries in the kernel */
 static const char* const nl_union_link_info_data_table[_NL_UNION_LINK_INFO_DATA_MAX] = {
         [NL_UNION_LINK_INFO_DATA_BOND] = "bond",
index 7ce9597c847151eb16c0ca2839080ec77e081988..8621746015924815cb14ac4c088afbb8482283c6 100644 (file)
@@ -63,3 +63,22 @@ int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, ui
 int type_system_get_type_system(const NLTypeSystem *type_system, const NLTypeSystem **ret, uint16_t type);
 int type_system_get_type_system_union(const NLTypeSystem *type_system, const NLTypeSystemUnion **ret, uint16_t type);
 int type_system_union_get_type_system(const NLTypeSystemUnion *type_system_union, const NLTypeSystem **ret, const char *key);
+
+typedef enum NLUnionLinkInfoData {
+        NL_UNION_LINK_INFO_DATA_BOND,
+        NL_UNION_LINK_INFO_DATA_BRIDGE,
+        NL_UNION_LINK_INFO_DATA_VLAN,
+        NL_UNION_LINK_INFO_DATA_VETH,
+        NL_UNION_LINK_INFO_DATA_DUMMY,
+        NL_UNION_LINK_INFO_DATA_MACVLAN,
+        NL_UNION_LINK_INFO_DATA_VXLAN,
+        NL_UNION_LINK_INFO_DATA_IPIP_TUNNEL,
+        NL_UNION_LINK_INFO_DATA_IPGRE_TUNNEL,
+        NL_UNION_LINK_INFO_DATA_SIT_TUNNEL,
+        NL_UNION_LINK_INFO_DATA_VTI_TUNNEL,
+        _NL_UNION_LINK_INFO_DATA_MAX,
+        _NL_UNION_LINK_INFO_DATA_INVALID = -1
+} NLUnionLinkInfoData;
+
+const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
+NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;
diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
new file mode 100644 (file)
index 0000000..6f6bb37
--- /dev/null
@@ -0,0 +1,26 @@
+#include "networkd.h"
+#include "networkd-netdev-bond.h"
+#include "networkd-netdev-macvlan.h"
+#include "dhcp6-internal.h"
+#include "dhcp6-protocol.h"
+#include "rtnl-internal.h"
+#include "ethtool-util.h"
+
+#include "test-tables.h"
+
+int main(int argc, char **argv) {
+        test_table(bond_mode, NETDEV_BOND_MODE);
+        /* test_table(link_state, LINK_STATE);  -- not a reversible mapping */
+        test_table(link_operstate, LINK_OPERSTATE);
+        test_table(dhcp_support, DHCP_SUPPORT);
+        test_table(netdev_kind, NETDEV_KIND);
+        test_table(dhcp6_message_status, DHCP6_STATUS);
+        test_table(duplex, DUP);
+        test_table(wol, WOL);
+        test_table(nl_union_link_info_data, NL_UNION_LINK_INFO_DATA);
+
+        test_table_sparse(macvlan_mode, NETDEV_MACVLAN_MODE);
+        test_table_sparse(dhcp6_message_type, DHCP6_MESSAGE);
+
+        return EXIT_SUCCESS;
+}
index bc2a3779719c39f5f5b0c98a556af5a523b4b638..a2f84f893e43255f7ce674d2f6e09fc1a193eb9a 100644 (file)
@@ -1877,7 +1877,7 @@ int unit_file_preset(
 
         assert(scope >= 0);
         assert(scope < _UNIT_FILE_SCOPE_MAX);
-        assert(mode < _UNIT_FILE_PRESET_MODE_MAX);
+        assert(mode < _UNIT_FILE_PRESET_MAX);
 
         r = lookup_paths_init_from_scope(&paths, scope, root_dir);
         if (r < 0)
@@ -1945,7 +1945,7 @@ int unit_file_preset_all(
 
         assert(scope >= 0);
         assert(scope < _UNIT_FILE_SCOPE_MAX);
-        assert(mode < _UNIT_FILE_PRESET_MODE_MAX);
+        assert(mode < _UNIT_FILE_PRESET_MAX);
 
         r = lookup_paths_init_from_scope(&paths, scope, root_dir);
         if (r < 0)
@@ -2182,7 +2182,7 @@ static const char* const unit_file_change_type_table[_UNIT_FILE_CHANGE_TYPE_MAX]
 
 DEFINE_STRING_TABLE_LOOKUP(unit_file_change_type, UnitFileChangeType);
 
-static const char* const unit_file_preset_mode_table[_UNIT_FILE_PRESET_MODE_MAX] = {
+static const char* const unit_file_preset_mode_table[_UNIT_FILE_PRESET_MAX] = {
         [UNIT_FILE_PRESET_FULL] = "full",
         [UNIT_FILE_PRESET_ENABLE_ONLY] = "enable-only",
         [UNIT_FILE_PRESET_DISABLE_ONLY] = "disable-only",
index 91ce192a4f04692e4bc6852ee6a85cfff47fdf9e..ff16d9f681a993edeb79c9c5579c4c2122ff7b5b 100644 (file)
@@ -49,7 +49,7 @@ typedef enum UnitFilePresetMode {
         UNIT_FILE_PRESET_FULL,
         UNIT_FILE_PRESET_ENABLE_ONLY,
         UNIT_FILE_PRESET_DISABLE_ONLY,
-        _UNIT_FILE_PRESET_MODE_MAX,
+        _UNIT_FILE_PRESET_MAX,
         _UNIT_FILE_PRESET_INVALID = -1
 } UnitFilePresetMode;
 
index 3261302077d4cb1765fa9f477103bd7cd4d80043..3ac8729d749af090c0bdd5da9a91166a4c14ad3c 100644 (file)
@@ -49,3 +49,6 @@ static inline void _test_table(const char *name,
 
 #define test_table(lower, upper) \
         _test_table(STRINGIFY(lower), lower##_to_string, lower##_from_string, _##upper##_MAX, false)
+
+#define test_table_sparse(lower, upper) \
+        _test_table(STRINGIFY(lower), lower##_to_string, lower##_from_string, _##upper##_MAX, true)
index fb751d13bd94376e629bba969a7fc0280f968aff..9fc4d93725f64ac6275101c979a19be000dfd3f4 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "automount.h"
 #include "cgroup.h"
+#include "compress.h"
 #include "condition.h"
 #include "device.h"
 #include "execute.h"
 #include "unit-name.h"
 #include "unit.h"
 #include "util.h"
+#include "architecture.h"
+#include "link-config.h"
+#include "bus-policy.h"
+#include "journald-server.h"
 
 #include "test-tables.h"
 
 int main(int argc, char **argv) {
+        test_table(architecture, ARCHITECTURE);
         test_table(automount_result, AUTOMOUNT_RESULT);
         test_table(automount_state, AUTOMOUNT_STATE);
+        test_table(busname_policy_access, BUSNAME_POLICY_ACCESS);
+        test_table(busname_result, BUSNAME_RESULT);
+        test_table(busname_state, BUSNAME_STATE);
         test_table(cgroup_device_policy, CGROUP_DEVICE_POLICY);
         test_table(condition_type, CONDITION_TYPE);
         test_table(device_state, DEVICE_STATE);
         test_table(exec_input, EXEC_INPUT);
         test_table(exec_output, EXEC_OUTPUT);
+        test_table(failure_action, SERVICE_FAILURE_ACTION);
         test_table(job_mode, JOB_MODE);
         test_table(job_result, JOB_RESULT);
         test_table(job_state, JOB_STATE);
@@ -61,14 +71,21 @@ int main(int argc, char **argv) {
         test_table(kill_mode, KILL_MODE);
         test_table(kill_who, KILL_WHO);
         test_table(log_target, LOG_TARGET);
+        test_table(mac_policy, MACPOLICY);
+        test_table(manager_state, MANAGER_STATE);
         test_table(mount_exec_command, MOUNT_EXEC_COMMAND);
         test_table(mount_result, MOUNT_RESULT);
         test_table(mount_state, MOUNT_STATE);
+        test_table(name_policy, NAMEPOLICY);
         test_table(notify_access, NOTIFY_ACCESS);
         test_table(output_mode, OUTPUT_MODE);
         test_table(path_result, PATH_RESULT);
         test_table(path_state, PATH_STATE);
         test_table(path_type, PATH_TYPE);
+        test_table(policy_item_class, POLICY_ITEM_CLASS);
+        test_table(policy_item_type, POLICY_ITEM_TYPE);
+        test_table(protect_home, PROTECT_HOME);
+        test_table(protect_system, PROTECT_SYSTEM);
         test_table(scope_result, SCOPE_RESULT);
         test_table(scope_state, SCOPE_STATE);
         test_table(service_exec_command, SERVICE_EXEC_COMMAND);
@@ -82,7 +99,8 @@ 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(failure_action, SERVICE_FAILURE_ACTION);
+        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);
@@ -94,9 +112,12 @@ int main(int argc, char **argv) {
         test_table(unit_active_state, UNIT_ACTIVE_STATE);
         test_table(unit_dependency, UNIT_DEPENDENCY);
         test_table(unit_file_change_type, UNIT_FILE_CHANGE_TYPE);
+        test_table(unit_file_preset_mode, UNIT_FILE_PRESET);
         test_table(unit_file_state, UNIT_FILE_STATE);
         test_table(unit_load_state, UNIT_LOAD_STATE);
         test_table(unit_type, UNIT_TYPE);
 
+        test_table_sparse(object_compressed, OBJECT_COMPRESSED);
+
         return EXIT_SUCCESS;
 }