# Worker unit test suite (component-failover-adoption, task 2.1). White-box # tests #include the production .c file(s) under test directly (same pattern # as scheduler/testsuite's test_handlers.c etc.), so they link the same # dependency set the real xcecd/xcecd_worker executables use rather than a # subset of xcecd_srcs -- see test_controller_connector.c's header comment # for why controller_connector.c is not also listed in xcecd_srcs here (it # would double-define every symbol in that file). # unity.pc's Cflags only adds -I${includedir}/unity, so resolves # but (used by every suite) does not — add the parent # includedir as well (same fix as src/lib/meson.build). worker_test_incdir = include_directories('../include', '../../include', '.', '../src', '../../lib', unity_dep.get_variable('includedir')) worker_test_deps = [xcecd_worker_deps, unity_dep] controller_connector_test = executable('controller_connector_test', 'test_controller_connector.c', c_args: ['-DDBUS_MANAGER', '-DXCE_CONTROLLER_CONNECTOR_C_PATH="' + (meson.current_source_dir() / '..' / 'src' / 'controller_connector.c') + '"'], include_directories: [worker_test_incdir], dependencies: worker_test_deps, install: false) test('worker controller_connector test', controller_connector_test, suite: 'worker', timeout: 60, env: ['ASAN_OPTIONS=detect_leaks=0']) # bug-1569: collect_load_indices() (resource_sync.c) must tag every periodic # resource report with xcecd_ctx.virtual_name (the worker's own join # identity), not gethostname()'s raw OS/container hostname -- see # test_resource_sync.c's own header comment for the full mechanism trace. resource_sync_test = executable('resource_sync_test', 'test_resource_sync.c', include_directories: [worker_test_incdir], dependencies: worker_test_deps, install: false) test('worker resource_sync test', resource_sync_test, suite: 'worker', timeout: 60, env: ['ASAN_OPTIONS=detect_leaks=0']) # component-failover-adoption task 2.2: worker startup-ordering white-box # test. #include's xcecd.c directly (same technique as controller_connector_ # test above, but a separate binary/file -- xcecd.c and controller_connector.c # cannot both be #include-d into one TU, see test_xcecd_startup_order.c's # header comment). Same -DDBUS_MANAGER + -DVIRTUAL_CLUSTER flag pair the real # `xcecd_virtual` executable already uses (see xcecd_virtual target above). xcecd_startup_order_test = executable('xcecd_startup_order_test', 'test_xcecd_startup_order.c', c_args: ['-DDBUS_MANAGER', '-DVIRTUAL_CLUSTER'], include_directories: [worker_test_incdir], dependencies: worker_test_deps, install: false) test('worker xcecd_startup_order test', xcecd_startup_order_test, suite: 'worker', timeout: 60, env: ['ASAN_OPTIONS=detect_leaks=0']) # bug-1589: dbus_workers_update() (xcecd_dbus_manager.c) worker-list # traversal regression test -- see test_dbus_workers_update.c's header # comment for the full root-cause trace. Same -DDBUS_MANAGER # -DVIRTUAL_CLUSTER flag pair the real `xcecd_virtual` executable uses # (worker/meson.build); DBUS_MANAGER has no effect on xcecd_dbus_manager.c # itself (no #ifdef DBUS_MANAGER branches there) but is included to match # production's exact build flags. dbus_workers_update_test = executable('dbus_workers_update_test', 'test_dbus_workers_update.c', c_args: ['-DDBUS_MANAGER', '-DVIRTUAL_CLUSTER'], include_directories: [worker_test_incdir], dependencies: worker_test_deps, install: false) test('worker dbus_workers_update test', dbus_workers_update_test, suite: 'worker', timeout: 60, env: ['ASAN_OPTIONS=detect_leaks=0']) # User-reported log-severity bug: a deliberately-killed job (SIGTERM/SIGKILL # via worker_signal_callback(), xcecd_worker.c) was logged at ERROR by # ipc_worker_send_status() (uv_ipc.c) even though process_exit_callback() # two lines earlier already judges the same event INFO-worthy. See # test_uv_ipc_job_exit_severity.c's own header comment. uv_ipc_job_exit_severity_test = executable('uv_ipc_job_exit_severity_test', 'test_uv_ipc_job_exit_severity.c', include_directories: [worker_test_incdir], dependencies: worker_test_deps, install: false) test('worker uv_ipc job_exit_severity test', uv_ipc_job_exit_severity_test, suite: 'worker', timeout: 60, env: ['ASAN_OPTIONS=detect_leaks=0'])