Return nonzero exit status if test fails. Fixed failmalloc tests.
This commit is contained in:
parent
3c49a31a07
commit
245c7ff1b3
|
@ -41,6 +41,7 @@ static int clean_suite1(void)
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
CU_pSuite pSuite = NULL;
|
CU_pSuite pSuite = NULL;
|
||||||
|
unsigned int num_tests_failed;
|
||||||
|
|
||||||
/* initialize the CUnit test registry */
|
/* initialize the CUnit test registry */
|
||||||
if (CUE_SUCCESS != CU_initialize_registry())
|
if (CUE_SUCCESS != CU_initialize_registry())
|
||||||
|
@ -66,6 +67,12 @@ int main(int argc, char* argv[])
|
||||||
/* Run all tests using the CUnit Basic interface */
|
/* Run all tests using the CUnit Basic interface */
|
||||||
CU_basic_set_mode(CU_BRM_VERBOSE);
|
CU_basic_set_mode(CU_BRM_VERBOSE);
|
||||||
CU_basic_run_tests();
|
CU_basic_run_tests();
|
||||||
|
num_tests_failed = CU_get_number_of_tests_failed();
|
||||||
CU_cleanup_registry();
|
CU_cleanup_registry();
|
||||||
|
if(CU_get_error() == CUE_SUCCESS) {
|
||||||
|
return num_tests_failed;
|
||||||
|
} else {
|
||||||
|
printf("CUnit Error: %s\n", CU_get_error_msg());
|
||||||
return CU_get_error();
|
return CU_get_error();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,7 @@ static ssize_t get_credential_proof(spdylay_session *session,
|
||||||
#define TEST_FAILMALLOC_RUN(FUN) \
|
#define TEST_FAILMALLOC_RUN(FUN) \
|
||||||
size_t nmalloc, i; \
|
size_t nmalloc, i; \
|
||||||
\
|
\
|
||||||
|
spdylay_failmalloc = 0; \
|
||||||
spdylay_nmalloc = 0; \
|
spdylay_nmalloc = 0; \
|
||||||
FUN(); \
|
FUN(); \
|
||||||
nmalloc = spdylay_nmalloc; \
|
nmalloc = spdylay_nmalloc; \
|
||||||
|
@ -162,7 +163,8 @@ static ssize_t get_credential_proof(spdylay_session *session,
|
||||||
/* printf("i=%zu\n", i); */ \
|
/* printf("i=%zu\n", i); */ \
|
||||||
FUN(); \
|
FUN(); \
|
||||||
/* printf("nmalloc=%d\n", spdylay_nmalloc); */ \
|
/* printf("nmalloc=%d\n", spdylay_nmalloc); */ \
|
||||||
}
|
} \
|
||||||
|
spdylay_failmalloc = 0;
|
||||||
|
|
||||||
static void run_spdylay_session_send(void)
|
static void run_spdylay_session_send(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,7 @@ static int clean_suite1(void)
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
CU_pSuite pSuite = NULL;
|
CU_pSuite pSuite = NULL;
|
||||||
|
unsigned int num_tests_failed;
|
||||||
|
|
||||||
/* initialize the CUnit test registry */
|
/* initialize the CUnit test registry */
|
||||||
if (CUE_SUCCESS != CU_initialize_registry())
|
if (CUE_SUCCESS != CU_initialize_registry())
|
||||||
|
@ -223,6 +224,12 @@ int main(int argc, char* argv[])
|
||||||
/* Run all tests using the CUnit Basic interface */
|
/* Run all tests using the CUnit Basic interface */
|
||||||
CU_basic_set_mode(CU_BRM_VERBOSE);
|
CU_basic_set_mode(CU_BRM_VERBOSE);
|
||||||
CU_basic_run_tests();
|
CU_basic_run_tests();
|
||||||
|
num_tests_failed = CU_get_number_of_tests_failed();
|
||||||
CU_cleanup_registry();
|
CU_cleanup_registry();
|
||||||
|
if(CU_get_error() == CUE_SUCCESS) {
|
||||||
|
return num_tests_failed;
|
||||||
|
} else {
|
||||||
|
printf("CUnit Error: %s\n", CU_get_error_msg());
|
||||||
return CU_get_error();
|
return CU_get_error();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,9 @@ ssize_t unpack_frame_with_nv_block(spdylay_frame_type type,
|
||||||
rv = spdylay_zlib_inflate_hd(inflater, &buffer,
|
rv = spdylay_zlib_inflate_hd(inflater, &buffer,
|
||||||
&in[SPDYLAY_HEAD_LEN + pnvlen],
|
&in[SPDYLAY_HEAD_LEN + pnvlen],
|
||||||
len - SPDYLAY_HEAD_LEN - pnvlen);
|
len - SPDYLAY_HEAD_LEN - pnvlen);
|
||||||
CU_ASSERT(rv >= 0);
|
if(rv < 0) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case SPDYLAY_SYN_STREAM:
|
case SPDYLAY_SYN_STREAM:
|
||||||
rv = spdylay_frame_unpack_syn_stream(&frame->syn_stream,
|
rv = spdylay_frame_unpack_syn_stream(&frame->syn_stream,
|
||||||
|
|
Loading…
Reference in New Issue