summaryrefslogtreecommitdiff
path: root/tst/nhm-systemd-test.h
blob: 299b59cc1ccf76f29911207d4df082654127a84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* NHM - NodeHealthMonitor
 *
 * Copyright (C) 2013 Continental Automotive Systems, Inc.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Author: Jean-Pierre Bogler <Jean-Pierre.Bogler@continental-corporation.com>
 */

/*
 * This header file is used for the NHM systemd unit test. It:
 *   - Includes headers with stubbed function definitions
 *   - Redefines the name of real functions to the stub names
 *   - Includes the test file, which will be patched to use the stubs
 *   - Undefine stubs, to allow usage of the real functions for the tests
 */

#ifndef NHM_TEST_SYSTEMD_H
#define NHM_TEST_SYSTEMD_H

/* Include stub header files */
#include <tst/stubs/gio/gio-stub.h>
#include <tst/stubs/dlt/dlt-stub.h>


/* Redefine some functions to stubs */
#define dlt_register_app \
        dlt_register_app_stub

#define dlt_check_library_version \
        dlt_check_library_version_stub

#define dlt_register_context \
        dlt_register_context_stub

#define dlt_unregister_context \
        dlt_unregister_context_stub

#define dlt_unregister_app \
        dlt_unregister_app_stub

#define dlt_user_log_write_start \
        dlt_user_log_write_start_stub

#define dlt_user_log_write_finish \
        dlt_user_log_write_finish_stub

#define dlt_user_log_write_string \
        dlt_user_log_write_string_stub

#define dlt_user_log_write_int \
        dlt_user_log_write_int_stub

#define dlt_user_log_write_uint \
        dlt_user_log_write_uint_stub

#define g_bus_get_sync \
        g_bus_get_sync_stub

#define g_dbus_connection_call_sync \
        g_dbus_connection_call_sync_stub

#define g_dbus_connection_signal_subscribe \
        g_dbus_connection_signal_subscribe_stub

#define g_dbus_connection_signal_unsubscribe \
        g_dbus_connection_signal_unsubscribe_stub

/* Include the main file. */
#include <src/nhm-systemd.c>

/* Undefine previous redefinitions */
#undef dlt_check_library_version
#undef dlt_register_context
#undef dlt_unregister_context
#undef dlt_unregister_app
#undef dlt_user_log_write_start
#undef dlt_user_log_write_finish
#undef dlt_user_log_write_string
#undef dlt_user_log_write_int
#undef dlt_user_log_write_uint

#undef g_bus_get_sync
#undef g_dbus_connection_call_sync
#undef g_dbus_connection_signal_subscribe
#undef g_dbus_connection_signal_unsubscribe

#endif /* NHM_TEST_SYSTEMD_H */