1
0
mirror of https://github.com/moparisthebest/spdylay synced 2024-12-22 07:38:52 -05:00

Return nonzero exit status if test fails. Fixed failmalloc tests.

This commit is contained in:
Tatsuhiro Tsujikawa 2012-05-31 21:55:21 +09:00
parent 3c49a31a07
commit 245c7ff1b3
4 changed files with 22 additions and 4 deletions

View File

@ -41,6 +41,7 @@ static int clean_suite1(void)
int main(int argc, char* argv[])
{
CU_pSuite pSuite = NULL;
unsigned int num_tests_failed;
/* initialize the CUnit test 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 */
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
num_tests_failed = CU_get_number_of_tests_failed();
CU_cleanup_registry();
return CU_get_error();
if(CU_get_error() == CUE_SUCCESS) {
return num_tests_failed;
} else {
printf("CUnit Error: %s\n", CU_get_error_msg());
return CU_get_error();
}
}

View File

@ -151,6 +151,7 @@ static ssize_t get_credential_proof(spdylay_session *session,
#define TEST_FAILMALLOC_RUN(FUN) \
size_t nmalloc, i; \
\
spdylay_failmalloc = 0; \
spdylay_nmalloc = 0; \
FUN(); \
nmalloc = spdylay_nmalloc; \
@ -162,7 +163,8 @@ static ssize_t get_credential_proof(spdylay_session *session,
/* printf("i=%zu\n", i); */ \
FUN(); \
/* printf("nmalloc=%d\n", spdylay_nmalloc); */ \
}
} \
spdylay_failmalloc = 0;
static void run_spdylay_session_send(void)
{

View File

@ -52,6 +52,7 @@ static int clean_suite1(void)
int main(int argc, char* argv[])
{
CU_pSuite pSuite = NULL;
unsigned int num_tests_failed;
/* initialize the CUnit test 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 */
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
num_tests_failed = CU_get_number_of_tests_failed();
CU_cleanup_registry();
return CU_get_error();
if(CU_get_error() == CUE_SUCCESS) {
return num_tests_failed;
} else {
printf("CUnit Error: %s\n", CU_get_error_msg());
return CU_get_error();
}
}

View File

@ -46,7 +46,9 @@ ssize_t unpack_frame_with_nv_block(spdylay_frame_type type,
rv = spdylay_zlib_inflate_hd(inflater, &buffer,
&in[SPDYLAY_HEAD_LEN + pnvlen],
len - SPDYLAY_HEAD_LEN - pnvlen);
CU_ASSERT(rv >= 0);
if(rv < 0) {
return rv;
}
switch(type) {
case SPDYLAY_SYN_STREAM:
rv = spdylay_frame_unpack_syn_stream(&frame->syn_stream,