Merge pull request #9103 from keszybz/more-tables-tests

More tables tests
This commit is contained in:
Lennart Poettering 2018-05-28 14:24:19 +02:00 committed by GitHub
commit d32d473d66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 82 additions and 27 deletions

View file

@ -1258,6 +1258,7 @@ includes = include_directories('src/basic',
'src/shared',
'src/systemd',
'src/journal',
'src/nspawn',
'src/resolve',
'src/timesync',
'src/time-wait-sync',
@ -2461,12 +2462,10 @@ exe = executable('systemd-nspawn',
'src/core/mount-setup.h',
'src/core/loopback-setup.c',
'src/core/loopback-setup.h',
include_directories : [includes, include_directories('src/nspawn')],
link_with : [libshared],
dependencies : [libacl,
libblkid,
libseccomp,
libselinux],
include_directories : includes,
link_with : [libnspawn_core,
libshared],
dependencies : [libblkid],
install_rpath : rootlibexecdir,
install : true)
public_programs += [exe]

View file

@ -9,9 +9,9 @@
#include "test-tables.h"
int main(int argc, char **argv) {
test_table(kill_who, KILL_WHO);
test_table(machine_class, MACHINE_CLASS);
test_table(machine_state, MACHINE_STATE);
test_table(kill_who, KILL_WHO);
return EXIT_SUCCESS;
}

View file

@ -1,28 +1,42 @@
#include "dhcp6-internal.h"
#include "dhcp6-protocol.h"
#include "ethtool-util.h"
#include "netlink-internal.h"
#include "netdev/bond.h"
#include "netdev/ipvlan.h"
#include "netdev/macvlan.h"
#include "netdev/tunnel.h"
#include "netlink-internal.h"
#include "networkd-link.h"
#include "networkd-network.h"
#include "networkd-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(address_family_boolean, ADDRESS_FAMILY_BOOLEAN);
test_table(netdev_kind, NETDEV_KIND);
test_table(bond_ad_select, NETDEV_BOND_AD_SELECT);
test_table(bond_arp_all_targets, NETDEV_BOND_ARP_ALL_TARGETS);
test_table(bond_arp_validate, NETDEV_BOND_ARP_VALIDATE);
test_table(bond_fail_over_mac, NETDEV_BOND_FAIL_OVER_MAC);
test_table(bond_lacp_rate, NETDEV_BOND_LACP_RATE);
test_table(bond_mode, NETDEV_BOND_MODE);
test_table(bond_primary_reselect, NETDEV_BOND_PRIMARY_RESELECT);
test_table(bond_xmit_hash_policy, NETDEV_BOND_XMIT_HASH_POLICY);
test_table(dhcp6_message_status, DHCP6_STATUS);
test_table(dhcp_use_domains, DHCP_USE_DOMAINS);
test_table(duplex, DUP);
test_table(wol, WOL);
test_table(ip6tnl_mode, NETDEV_IP6_TNL_MODE);
test_table(ipv6_privacy_extensions, IPV6_PRIVACY_EXTENSIONS);
test_table(ipvlan_flags, NETDEV_IPVLAN_FLAGS);
test_table(link_operstate, LINK_OPERSTATE);
/* test_table(link_state, LINK_STATE); — not a reversible mapping */
test_table(lldp_mode, LLDP_MODE);
test_table(netdev_kind, NETDEV_KIND);
test_table(nl_union_link_info_data, NL_UNION_LINK_INFO_DATA);
test_table(wol, WOL);
test_table_sparse(macvlan_mode, NETDEV_MACVLAN_MODE);
test_table_sparse(ipvlan_mode, NETDEV_IPVLAN_MODE);
test_table_sparse(dhcp6_message_type, DHCP6_MESSAGE);
test_table_sparse(ipvlan_mode, NETDEV_IPVLAN_MODE);
test_table_sparse(macvlan_mode, NETDEV_MACVLAN_MODE);
return EXIT_SUCCESS;
}

View file

@ -2,7 +2,7 @@
#
# Copyright 2017 Zbigniew Jędrzejewski-Szmek
systemd_nspawn_sources = files('''
libnspawn_core_sources = files('''
nspawn-cgroup.c
nspawn-cgroup.h
nspawn-def.h
@ -24,7 +24,6 @@ systemd_nspawn_sources = files('''
nspawn-setuid.h
nspawn-stub-pid1.c
nspawn-stub-pid1.h
nspawn.c
'''.split())
nspawn_gperf_c = custom_target(
@ -33,13 +32,27 @@ nspawn_gperf_c = custom_target(
output : 'nspawn-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
systemd_nspawn_sources += [nspawn_gperf_c]
libnspawn_core_sources += [nspawn_gperf_c]
libnspawn_core = static_library(
'nspawn-core',
libnspawn_core_sources,
include_directories : includes,
dependencies : [libacl,
libseccomp,
libselinux])
systemd_nspawn_sources = files('nspawn.c')
tests += [
[['src/nspawn/test-patch-uid.c',
'src/nspawn/nspawn-patch-uid.c',
'src/nspawn/nspawn-patch-uid.h'],
[libshared],
[['src/nspawn/test-nspawn-tables.c'],
[libnspawn_core,
libshared],
[]],
[['src/nspawn/test-patch-uid.c'],
[libnspawn_core,
libshared],
[libacl],
'', 'manual'],
]

View file

@ -0,0 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "nspawn-settings.h"
#include "test-tables.h"
int main(int argc, char **argv) {
test_table(resolv_conf_mode, RESOLV_CONF_MODE);
test_table(timezone_mode, TIMEZONE_MODE);
return 0;
}

View file

@ -12,6 +12,7 @@
#include "condition.h"
#include "device.h"
#include "execute.h"
#include "import-util.h"
#include "install.h"
#include "job.h"
#include "journald-server.h"
@ -20,8 +21,11 @@
#include "locale-util.h"
#include "log.h"
#include "logs-show.h"
#include "machine-image.h"
#include "mount.h"
#include "path.h"
#include "process-util.h"
#include "resolve-util.h"
#include "rlimit-util.h"
#include "scope.h"
#include "service.h"
@ -39,36 +43,51 @@
int main(int argc, char **argv) {
test_table(architecture, ARCHITECTURE);
test_table(assert_type, CONDITION_TYPE);
test_table(automount_result, AUTOMOUNT_RESULT);
test_table(automount_state, AUTOMOUNT_STATE);
test_table(cgroup_controller, CGROUP_CONTROLLER);
test_table(cgroup_device_policy, CGROUP_DEVICE_POLICY);
test_table(condition_type, CONDITION_TYPE);
test_table(assert_type, CONDITION_TYPE);
test_table(cgroup_io_limit_type, CGROUP_IO_LIMIT_TYPE);
test_table(collect_mode, COLLECT_MODE);
test_table(condition_result, CONDITION_RESULT);
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(dnssec_mode, DNSSEC_MODE);
test_table(emergency_action, EMERGENCY_ACTION);
test_table(exec_directory_type, EXEC_DIRECTORY_TYPE);
test_table(exec_input, EXEC_INPUT);
test_table(exec_keyring_mode, EXEC_KEYRING_MODE);
test_table(exec_output, EXEC_OUTPUT);
test_table(exec_preserve_mode, EXEC_PRESERVE_MODE);
test_table(exec_utmp_mode, EXEC_UTMP_MODE);
test_table(image_type, IMAGE_TYPE);
test_table(import_verify, IMPORT_VERIFY);
test_table(job_mode, JOB_MODE);
test_table(job_result, JOB_RESULT);
test_table(job_state, JOB_STATE);
test_table(job_type, JOB_TYPE);
test_table(kill_mode, KILL_MODE);
test_table(kill_who, KILL_WHO);
test_table(locale_variable, VARIABLE_LC);
test_table(log_target, LOG_TARGET);
test_table(mac_policy, MACPOLICY);
test_table(manager_state, MANAGER_STATE);
test_table(manager_timestamp, MANAGER_TIMESTAMP);
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(namespace_type, NAMESPACE_TYPE);
test_table(notify_access, NOTIFY_ACCESS);
test_table(output_mode, OUTPUT_MODE);
test_table(partition_designator, PARTITION_DESIGNATOR);
test_table(path_result, PATH_RESULT);
test_table(path_state, PATH_STATE);
test_table(path_type, PATH_TYPE);
test_table(protect_home, PROTECT_HOME);
test_table(protect_system, PROTECT_SYSTEM);
test_table(resolve_support, RESOLVE_SUPPORT);
test_table(rlimit, RLIMIT);
test_table(scope_result, SCOPE_RESULT);
test_table(scope_state, SCOPE_STATE);
@ -98,7 +117,6 @@ int main(int argc, char **argv) {
test_table(unit_file_state, UNIT_FILE_STATE);
test_table(unit_load_state, UNIT_LOAD_STATE);
test_table(unit_type, UNIT_TYPE);
test_table(locale_variable, VARIABLE_LC);
test_table(virtualization, VIRTUALIZATION);
test_table_sparse(object_compressed, OBJECT_COMPRESSED);