}
END_TEST
+#if defined(HAVE_FORK)
int testval_up;
int testval_down;
static void setup_sub_fail (void)
{
- ck_abort_msg("Failed setup"); /* check_check_fixture.c:129 */
+ ck_abort_msg("Failed setup"); /* check_check_fixture.c:130 */
}
static void teardown_sub_fail (void)
free(strstat);
trm = tr_str(srunner_failures(sr)[0]);
- /* Search for check_check_fixture.c:129 if this fails. */
+ /* Search for check_check_fixture.c:130 if this fails. */
if (strstr(trm,
- "check_check_fixture.c:129:S:Setup Fail:test_sub_fail:0: Failed setup")
+ "check_check_fixture.c:130:S:Setup Fail:test_sub_fail:0: Failed setup")
== 0) {
snprintf(errm, sizeof(errm),
"Bad failed checked setup tr msg (%s)", trm);
}
END_TEST
+/*
+ * This test will fail without fork, as it results in a checked
+ * fixture raising a signal, which terminates the test runner early.
+ */
START_TEST(test_ch_setup_sig)
{
TCase *tc;
trm = tr_str(srunner_failures(sr)[0]);
if (strstr(trm,
- "check_check_fixture.c:139:S:Setup Sig:test_sub_fail:0: "
+ "check_check_fixture.c:140:S:Setup Sig:test_sub_fail:0: "
"(after this point) Received signal 8")
== 0) {
snprintf(errm, sizeof(errm),
}
END_TEST
+/*
+ * This test will not work without fork, as checked fixtures are
+ * not supported
+ */
START_TEST(test_ch_setup_two_setups_fork)
{
TCase *tc;
}
END_TEST
+/*
+ * This test will fail without fork. It expects a checked teardown
+ * fixture to call ck_abort_msg. In fork mode this results in exit()
+ * being called, which signals to the parent process that the test
+ * failed. However, without fork, ck_abort_msg call longjmp, which
+ * jumps to right before the checked teardown fixtures are called.
+ * This results in an infinate loop.
+ */
START_TEST(test_ch_teardown_fail)
{
TCase *tc;
trm = tr_str(srunner_failures(sr)[0]);
if (strstr(trm,
- "check_check_fixture.c:134:S:Teardown Fail:test_sub_pass:0: Failed teardown")
+ "check_check_fixture.c:135:S:Teardown Fail:test_sub_pass:0: Failed teardown")
== 0) {
snprintf(errm, sizeof(errm),
"Bad failed checked teardown tr msg (%s)", trm);
}
END_TEST
+/*
+ * This test will fail without fork, as it results in a checked
+ * fixture raising a signal, which terminates the test runner early.
+ */
+
START_TEST(test_ch_teardown_sig)
{
TCase *tc;
trm = tr_str(srunner_failures(sr)[0]);
if (strstr(trm,
- "check_check_fixture.c:145:S:Teardown Sig:test_sub_pass:0: "
+ "check_check_fixture.c:146:S:Teardown Sig:test_sub_pass:0: "
"(after this point) Received signal 8")
== 0) {
snprintf(errm, sizeof(errm),
}
END_TEST
+/*
+ * This test will not work without fork, as checked fixtures are
+ * not supported
+ */
START_TEST(test_ch_teardown_two_teardowns_fork)
{
TCase *tc;
srunner_free(sr);
}
END_TEST
+#endif /* HAVE_FORK */
Suite *make_fixture_suite (void)
{
tcase_add_test(tc,test_fixture_fail_counts);
tcase_add_test(tc,test_print_counts);
tcase_add_test(tc,test_setup_failure_msg);
+
+#if defined(HAVE_FORK)
tcase_add_test(tc,test_ch_setup);
tcase_add_test(tc,test_ch_setup_fail);
tcase_add_test(tc,test_ch_setup_fail_nofork);
tcase_add_test(tc,test_ch_teardown_fail);
tcase_add_test(tc,test_ch_teardown_sig);
tcase_add_test(tc,test_ch_teardown_two_teardowns_fork);
+#endif
+
return s;
}