From b1651e73e1c521b74180e9e3c0937a3714bc0bef Mon Sep 17 00:00:00 2001 From: brarcher Date: Sun, 4 Nov 2012 03:25:57 +0000 Subject: [PATCH] replace usage of fail() with ck_abort_msg() git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@652 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- tests/check_check_exit.c | 8 ++++---- tests/check_check_fixture.c | 22 +++++++++++----------- tests/check_check_master.c | 8 ++++---- tests/check_check_sub.c | 34 +++++++++++++++++----------------- tests/check_stress.c | 2 +- tests/ex_log_output.c | 2 +- tests/ex_output.c | 2 +- tests/ex_xml_output.c | 4 ++-- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/tests/check_check_exit.c b/tests/check_check_exit.c index a738519..d2a26d4 100644 --- a/tests/check_check_exit.c +++ b/tests/check_check_exit.c @@ -9,28 +9,28 @@ START_TEST(test_early_exit_normal) { exit(0); - fail("Should've exitted..."); + ck_abort_msg("Should've exitted..."); } END_TEST START_TEST(test_early_exit_with_allowed_error) { exit(-1); - fail("Should've exitted..."); + ck_abort_msg("Should've exitted..."); } END_TEST START_TEST(loop_early_exit_normal) { exit(0); - fail("Should've exitted..."); + ck_abort_msg("Should've exitted..."); } END_TEST START_TEST(loop_early_exit_allowed_exit) { exit(-2); - fail("Should've exitted..."); + ck_abort_msg("Should've exitted..."); } END_TEST diff --git a/tests/check_check_fixture.c b/tests/check_check_fixture.c index 1a8679e..49972e7 100644 --- a/tests/check_check_fixture.c +++ b/tests/check_check_fixture.c @@ -13,7 +13,7 @@ static char errm[200]; static void fixture_sub_setup (void) { - fail("Test failure in fixture"); + ck_abort_msg("Test failure in fixture"); } static SRunner *fixture_sr; @@ -73,7 +73,7 @@ START_TEST(test_setup_failure_msg) snprintf(errm, sizeof(errm), "Bad setup tr msg (%s)", trm); - fail (errm); + ck_abort_msg (errm); } free(trm); } @@ -95,9 +95,9 @@ static void sub_ch_teardown_norm(void) START_TEST(test_sub_ch_setup_norm) { if (testval_up == 1) - fail("Setup not run correctly"); + ck_abort_msg("Setup not run correctly"); else if (testval_up > 3) - fail("Test side-effects persist across runs"); + ck_abort_msg("Test side-effects persist across runs"); testval_up++; } END_TEST @@ -126,12 +126,12 @@ END_TEST static void setup_sub_fail (void) { - fail("Failed setup"); /* check_check_fixture.c:129 */ + ck_abort_msg("Failed setup"); /* check_check_fixture.c:129 */ } static void teardown_sub_fail (void) { - fail("Failed teardown"); + ck_abort_msg("Failed teardown"); } static void setup_sub_signal (void) @@ -148,7 +148,7 @@ static void teardown_sub_signal(void) START_TEST(test_sub_fail) { - fail("Should never run"); + ck_abort_msg("Should never run"); } END_TEST @@ -194,7 +194,7 @@ START_TEST(test_ch_setup_fail) snprintf(errm, sizeof(errm), "Bad failed checked setup tr msg (%s)", trm); - fail (errm); + ck_abort_msg (errm); } } END_TEST @@ -309,7 +309,7 @@ START_TEST(test_ch_setup_sig) snprintf(errm, sizeof(errm), "Msg was (%s)", trm); - fail (errm); + ck_abort_msg (errm); } } END_TEST @@ -391,7 +391,7 @@ START_TEST(test_ch_teardown_fail) snprintf(errm, sizeof(errm), "Bad failed checked teardown tr msg (%s)", trm); - fail (errm); + ck_abort_msg (errm); } } @@ -434,7 +434,7 @@ START_TEST(test_ch_teardown_sig) snprintf(errm, sizeof(errm), "Bad msg (%s)", trm); - fail (errm); + ck_abort_msg (errm); } } diff --git a/tests/check_check_master.c b/tests/check_check_master.c index dbd2f82..b7fac4e 100644 --- a/tests/check_check_master.c +++ b/tests/check_check_master.c @@ -169,7 +169,7 @@ START_TEST(test_check_failure_msgs) char *emsg = malloc(MAXSTR); snprintf(emsg, MAXSTR,"For test %d: Expected %s, got %s", i, expected_msg, got_msg); - fail(emsg); + ck_abort_msg(emsg); free(emsg); } } @@ -197,7 +197,7 @@ START_TEST(test_check_failure_lnos) char *emsg = malloc(MAXSTR); snprintf(emsg, MAXSTR, "For test %d: Expected lno %d, got %d", i, line_no, tr_lno(tr)); - fail(emsg); + ck_abort_msg(emsg); free(emsg); } } @@ -246,7 +246,7 @@ START_TEST(test_check_tcnames) char *emsg = malloc (MAXSTR); snprintf(emsg, MAXSTR,"Expected %s, got %s", master_tests[_i].tcname, tcname); - fail(emsg); + ck_abort_msg(emsg); free(emsg); } } @@ -261,7 +261,7 @@ START_TEST(test_check_all_msgs) char *emsg = malloc (MAXSTR); snprintf(emsg, MAXSTR,"Expected %s, got %s", master_tests[_i].msg, msg); - fail(emsg); + ck_abort_msg(emsg); free(emsg); } } diff --git a/tests/check_check_sub.c b/tests/check_check_sub.c index a3c5dd7..eb9ac47 100644 --- a/tests/check_check_sub.c +++ b/tests/check_check_sub.c @@ -11,7 +11,7 @@ START_TEST(test_lno) { - fail("Failure expected"); + ck_abort_msg("Failure expected"); #define LINENO_lno _STR(__LINE__) } END_TEST @@ -326,7 +326,7 @@ START_TEST(test_mark_point) i++; mark_point(); raise(SIGFPE); - fail("Shouldn't reach here"); + ck_abort_msg("Shouldn't reach here"); } END_TEST @@ -385,7 +385,7 @@ START_TEST(test_null) srunner_create(NULL); srunner_run_all (NULL, -1); srunner_free (NULL); - fail("Completed properly"); + ck_abort_msg("Completed properly"); } END_TEST @@ -394,7 +394,7 @@ START_TEST(test_null_2) SRunner *sr = srunner_create(NULL); srunner_run_all (sr, CK_NORMAL); srunner_free (sr); - fail("Completed properly"); + ck_abort_msg("Completed properly"); } END_TEST @@ -404,7 +404,7 @@ START_TEST(test_fork1p_pass) pid_t pid; if((pid = fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid > 0) { fail_unless(1, NULL); kill(pid, SIGKILL); @@ -421,9 +421,9 @@ START_TEST(test_fork1p_fail) pid_t pid; if((pid = fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid > 0) { - fail("Expected fail"); + ck_abort_msg("Expected fail"); kill(pid, SIGKILL); } else { for (;;) { @@ -438,7 +438,7 @@ START_TEST(test_fork1c_pass) pid_t pid; if((pid = check_fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid > 0) { check_waitpid_and_exit(pid); } else { @@ -453,9 +453,9 @@ START_TEST(test_fork1c_fail) pid_t pid; if((pid = check_fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid == 0) { - fail("Expected fail"); + ck_abort_msg("Expected fail"); check_waitpid_and_exit(0); } check_waitpid_and_exit(pid); @@ -468,10 +468,10 @@ START_TEST(test_fork2_pass) pid_t pid2; if((pid = check_fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid > 0) { if((pid2 = check_fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid2 == 0) { fail_unless(1, NULL); check_waitpid_and_exit(0); @@ -488,16 +488,16 @@ START_TEST(test_fork2_fail) pid_t pid2; if((pid = check_fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid > 0) { if((pid2 = check_fork()) < 0) { - fail("Failed to fork new process"); + ck_abort_msg("Failed to fork new process"); } else if (pid2 == 0) { - fail("Expected fail"); + ck_abort_msg("Expected fail"); check_waitpid_and_exit(0); } check_waitpid_and_exit(pid2); - fail("Expected fail"); + ck_abort_msg("Expected fail"); } check_waitpid_and_exit(pid); } @@ -531,7 +531,7 @@ END_TEST START_TEST(test_2nd_suite) { - fail("We failed"); + ck_abort_msg("We failed"); } END_TEST diff --git a/tests/check_stress.c b/tests/check_stress.c index 3b44bb1..903777e 100644 --- a/tests/check_stress.c +++ b/tests/check_stress.c @@ -20,7 +20,7 @@ END_TEST START_TEST(test_fail) { - fail("This test fails"); + ck_abort_msg("This test fails"); } END_TEST diff --git a/tests/ex_log_output.c b/tests/ex_log_output.c index 1cf31b8..0b5df28 100644 --- a/tests/ex_log_output.c +++ b/tests/ex_log_output.c @@ -13,7 +13,7 @@ END_TEST START_TEST(test_fail) { - fail("Failure"); + ck_abort_msg("Failure"); } END_TEST diff --git a/tests/ex_output.c b/tests/ex_output.c index 2fc39ac..2af1f8c 100644 --- a/tests/ex_output.c +++ b/tests/ex_output.c @@ -14,7 +14,7 @@ END_TEST START_TEST(test_fail) { - fail("Failure"); + ck_abort_msg("Failure"); } END_TEST diff --git a/tests/ex_xml_output.c b/tests/ex_xml_output.c index 7b640d1..9cc0797 100644 --- a/tests/ex_xml_output.c +++ b/tests/ex_xml_output.c @@ -13,7 +13,7 @@ END_TEST START_TEST(test_fail) { - fail("Failure"); + ck_abort_msg("Failure"); } END_TEST @@ -37,7 +37,7 @@ END_TEST START_TEST(test_xml_esc_fail_msg) { - fail("fail \" ' < > & message"); + ck_abort_msg("fail \" ' < > & message"); } END_TEST -- 2.40.0