]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/unittest/private_exe.c
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / prometheus-cpp / 3rdparty / civetweb / unittest / private_exe.c
1 /* Copyright (c) 2015-2020 the Civetweb developers
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 */
21
22 /**
23 * We include the source file so that we have access to the internal private
24 * static functions.
25 */
26 #ifdef _MSC_VER
27 #ifndef _CRT_SECURE_NO_WARNINGS
28 #define _CRT_SECURE_NO_WARNINGS
29 #endif
30 #endif
31
32 #include "private_exe.h"
33
34 /* This is required for "realpath". According to
35 * http://man7.org/linux/man-pages/man3/realpath.3.html
36 * defining _XOPEN_SOURCE 600 should be enough, but in
37 * practice this does not work. */
38 extern char *realpath(const char *path, char *resolved_path);
39
40 /* main is already used in the test suite,
41 * so this define will rename main in main.c */
42 #define main exe_main
43
44 /* Set this define, so all functions are included, that might be unused
45 * and excluded with the current compile options otherwise. */
46 #define MAIN_C_UNIT_TEST
47
48 /* Include the C file, so all static functions in main.c are available for
49 * unit testing */
50 #include "../src/main.c"
51
52 #include <stdlib.h>
53
54 /* This unit test file uses the excellent Check unit testing library.
55 * The API documentation is available here:
56 * http://check.sourceforge.net/doc/check_html/index.html
57 */
58
59 START_TEST(test_helper_funcs)
60 {
61 const char *psrc = "test str";
62 char *pdst;
63
64 /* test sdup */
65 pdst = sdup(psrc);
66 ck_assert(pdst != NULL);
67 ck_assert_str_eq(pdst, psrc);
68 ck_assert_ptr_ne(pdst, psrc);
69 free(pdst);
70 }
71 END_TEST
72
73
74 #if !defined(REPLACE_CHECK_FOR_LOCAL_DEBUGGING)
75 Suite *
76 make_private_exe_suite(void)
77 {
78 Suite *const suite = suite_create("EXE");
79
80 TCase *const tcase_helper_funcs = tcase_create("Helper funcs");
81
82 tcase_add_test(tcase_helper_funcs, test_helper_funcs);
83 tcase_set_timeout(tcase_helper_funcs, civetweb_min_test_timeout);
84 suite_add_tcase(suite, tcase_helper_funcs);
85
86 return suite;
87 }
88 #endif