2 * nghttp2 - HTTP/2 C Library
4 * Copyright (c) 2012 Tatsuhiro Tsujikawa
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #endif /* HAVE_CONFIG_H */
31 #include <CUnit/Basic.h>
32 /* include test cases' include files here */
34 #include "failmalloc_test.h"
36 static int init_suite1(void) { return 0; }
38 static int clean_suite1(void) { return 0; }
41 CU_pSuite pSuite = NULL;
42 unsigned int num_tests_failed;
44 /* initialize the CUnit test registry */
45 if (CUE_SUCCESS != CU_initialize_registry())
46 return (int)CU_get_error();
48 /* add a suite to the registry */
49 pSuite = CU_add_suite("libnghttp2_TestSuite", init_suite1, clean_suite1);
51 CU_cleanup_registry();
52 return (int)CU_get_error();
55 /* add the tests to the suite */
56 if (!CU_add_test(pSuite, "failmalloc_session_send",
57 test_nghttp2_session_send) ||
58 !CU_add_test(pSuite, "failmalloc_session_send_server",
59 test_nghttp2_session_send_server) ||
60 !CU_add_test(pSuite, "failmalloc_session_recv",
61 test_nghttp2_session_recv) ||
62 !CU_add_test(pSuite, "failmalloc_frame", test_nghttp2_frame) ||
63 !CU_add_test(pSuite, "failmalloc_hd", test_nghttp2_hd)) {
64 CU_cleanup_registry();
65 return (int)CU_get_error();
68 /* Run all tests using the CUnit Basic interface */
69 CU_basic_set_mode(CU_BRM_VERBOSE);
71 num_tests_failed = CU_get_number_of_tests_failed();
72 CU_cleanup_registry();
73 if (CU_get_error() == CUE_SUCCESS) {
74 return (int)num_tests_failed;
76 printf("CUnit Error: %s\n", CU_get_error_msg());
77 return (int)CU_get_error();