}
END_TEST
+/*
+ * This test will fail without fork, as it will result in the
+ * unit test runniner exiting early.
+ */
+#if defined(HAVE_FORK)
START_TEST(test_exit)
{
exit(1);
}
END_TEST
+#endif /* HAVE_FORK */
START_TEST(test_pass2)
{
suite_add_tcase(s, tc);
tcase_add_test (tc, test_pass);
tcase_add_test (tc, test_fail);
+#if defined(HAVE_FORK)
tcase_add_test (tc, test_exit);
+#endif /* HAVE_FORK */
return s;
}
#!/bin/sh
-. ./test_vars
+# For this test script, it is assumed that HAVE_FORK=0 implies
+# running in a Windows environment. That means not only are
+# fork-related tests not run, but also line endings are important.
+# In *NIX environments line endings are \n, but in Windows they
+# are expected to be \r\n. For this reason, HAVE_FORK=0 uses
+# printf to generate the comparison strings, so the line endings
+# can be controlled.
-if [ "${srcdir}" = "." ]; then
- lsrc=""
-else
- lsrc="${srcdir}/"
-fi
+. ./test_vars
+if [ $HAVE_FORK -eq 1 ]; then
expected="Running suite S1
-${lsrc}ex_log_output.c:10:P:Core:test_pass:0: Passed
-${lsrc}ex_log_output.c:16:F:Core:test_fail:0: Failure
-${lsrc}ex_log_output.c:20:E:Core:test_exit:0: (after this point) Early exit with return value 1
+ex_log_output.c:10:P:Core:test_pass:0: Passed
+ex_log_output.c:16:F:Core:test_fail:0: Failure
+ex_log_output.c:25:E:Core:test_exit:0: (after this point) Early exit with return value 1
Running suite S2
-${lsrc}ex_log_output.c:28:P:Core:test_pass2:0: Passed
+ex_log_output.c:34:P:Core:test_pass2:0: Passed
Results for all suites run:
50%: Checks: 4, Failures: 1, Errors: 1"
-
+else
+expected=`printf "Running suite S1\r
+ex_log_output.c:10:P:Core:test_pass:0: Passed\r
+ex_log_output.c:16:F:Core:test_fail:0: Failure\r
+Running suite S2\r
+ex_log_output.c:34:P:Core:test_pass2:0: Passed\r
+Results for all suites run:\r
+66%%: Checks: 3, Failures: 1, Errors: 0\r
+"`
+fi
test_log_output ( ) {