]> granicus.if.org Git - check/commitdiff
consolidate all output tests into ex_output.c
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 27 Dec 2013 18:18:17 +0000 (18:18 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 27 Dec 2013 18:18:17 +0000 (18:18 +0000)
This way, it will be simpler to add more outputs. Simply extend
this file. Further, if any bugs are found and needed to be
regression tested, they are added to only one place.

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@980 64e312b2-a51f-0410-8e61-82d0ca0eb02a

tests/ex_log_output.c [deleted file]
tests/ex_output.c
tests/ex_tap_output.c [deleted file]
tests/ex_xml_output.c [deleted file]
tests/test_log_output.sh
tests/test_output.sh
tests/test_tap_output.sh
tests/test_xml_output.sh

diff --git a/tests/ex_log_output.c b/tests/ex_log_output.c
deleted file mode 100644 (file)
index 4850056..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "../lib/libcompat.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <check.h>
-
-START_TEST(test_pass)
-{
-  ck_assert_msg (1==1, "Shouldn't see this");
-}
-END_TEST
-
-START_TEST(test_fail)
-{
-  ck_abort_msg("Failure");
-}
-END_TEST
-
-/*
- * This test will fail without fork, as it will result in the
- * unit test runniner exiting early.
- */
-#if defined(HAVE_FORK) && HAVE_FORK==1
-START_TEST(test_exit)
-{
-  exit(1);
-}
-END_TEST
-#endif /* HAVE_FORK */
-
-START_TEST(test_pass2)
-{
-  ck_assert_msg (1==1, "Shouldn't see this");
-}
-END_TEST
-
-static Suite *make_s1_suite (void)
-{
-  Suite *s;
-  TCase *tc;
-
-  s = suite_create("S1");
-  tc = tcase_create ("Core");
-  suite_add_tcase(s, tc);
-  tcase_add_test (tc, test_pass);
-  tcase_add_test (tc, test_fail);
-#if defined(HAVE_FORK) && HAVE_FORK==1
-  tcase_add_test (tc, test_exit);
-#endif /* HAVE_FORK */
-
-  return s;
-}
-
-static Suite *make_s2_suite (void)
-{
-  Suite *s;
-  TCase *tc;
-
-  s = suite_create("S2");
-  tc = tcase_create ("Core");
-  suite_add_tcase(s, tc);
-  tcase_add_test (tc, test_pass2);
-
-  return s;
-}
-
-static void run_tests (int printmode)
-{
-  SRunner *sr;
-
-  sr = srunner_create(make_s1_suite());
-  srunner_add_suite(sr, make_s2_suite());
-  srunner_set_log(sr, "test.log");
-  srunner_run_all(sr, printmode);
-  srunner_free(sr);
-}
-
-static void usage(void)
-{
-  printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE)\n");
-}
-
-int main (int argc, char **argv)
-{
-  
-  if (argc != 2) {
-    usage();
-    return EXIT_FAILURE;
-  }
-
-  if (strcmp (argv[1], "CK_SILENT") == 0)
-    run_tests(CK_SILENT);
-  else if (strcmp (argv[1], "CK_MINIMAL") == 0)
-    run_tests(CK_MINIMAL);
-  else if (strcmp (argv[1], "CK_NORMAL") == 0)
-    run_tests(CK_NORMAL);
-  else if (strcmp (argv[1], "CK_VERBOSE") == 0)
-    run_tests(CK_VERBOSE);
-  else {
-    usage();
-    return EXIT_FAILURE;
-  }    
-    
-
-  return EXIT_SUCCESS;
-}
-  
index 1382b513633aca012eb994cc68239d0530927b0a..2347a6faf049edafcb8e4d7cbc2018e59adc1daa 100644 (file)
@@ -30,12 +30,41 @@ START_TEST(test_exit)
 END_TEST
 #endif /* HAVE_FORK */
 
-static Suite *make_suite (void)
+/*
+ * This test will intentionally mess up the unit testing program
+ * when fork is unavailable. The purpose of including it is to
+ * ensure that the tap output is correct when a test crashes.
+ */
+START_TEST(test_abort)
+{
+  exit(1);
+}
+END_TEST
+
+START_TEST(test_pass2)
+{
+  ck_assert_msg (1==1, "Shouldn't see this");
+}
+END_TEST
+
+START_TEST(test_loop)
+{
+  ck_assert_msg (_i==1, "Iteration %d failed", _i);
+}
+END_TEST
+
+START_TEST(test_xml_esc_fail_msg)
+{
+  ck_abort_msg("fail \" ' < > & message");
+}
+END_TEST
+
+static Suite *make_log1_suite (void)
 {
   Suite *s;
   TCase *tc;
 
-  s = suite_create("Master");
+  s = suite_create("S1");
   tc = tcase_create ("Core");
   suite_add_tcase(s, tc);
   tcase_add_test (tc, test_pass);
@@ -43,55 +72,145 @@ static Suite *make_suite (void)
 #if defined(HAVE_FORK) && HAVE_FORK==1
   tcase_add_test (tc, test_exit);
 #endif /* HAVE_FORK */
+
   return s;
 }
 
-static void run_tests (int printmode)
+static Suite *make_log2_suite (int include_exit_test)
 {
-  SRunner *sr;
   Suite *s;
+  TCase *tc;
+
+  s = suite_create("S2");
+  tc = tcase_create ("Core");
+  suite_add_tcase(s, tc);
+  if(include_exit_test == 1)
+  {
+     tcase_add_test (tc, test_abort);
+  }
+  tcase_add_test (tc, test_pass2);
+  tcase_add_loop_test(tc, test_loop, 0, 3);
 
-  s = make_suite();
-  sr = srunner_create(s);
-  srunner_run_all(sr, printmode);
-  srunner_free(sr);
+  return s;
 }
 
+/* check that XML special characters are properly escaped in XML log file */
+static Suite *make_xml_esc_suite (void)
+{
+  Suite *s;
+  TCase *tc;
+
+  s = suite_create("XML escape \" ' < > & tests");
+  tc = tcase_create ("description \" ' < > &");
+  suite_add_tcase(s, tc);
+
+  tcase_add_test (tc, test_xml_esc_fail_msg);
+
+  return s;
+}
+
+
 static void print_usage(void)
 {
     printf ("Usage: ex_output (CK_SILENT | CK_MINIMAL | CK_NORMAL | CK_VERBOSE");
 #if ENABLE_SUBUNIT
     printf (" | CK_SUBUNIT");
 #endif
-    printf (")\n");
+    printf (") (STDOUT | LOG | TAP | XML) (NORMAL | EXIT_TEST)\n");
 }
 
+static void run_tests (int printmode, char * log_type, int include_exit_test)
+{
+    SRunner *sr;
+
+    sr = srunner_create(make_log1_suite());
+    srunner_add_suite(sr, make_log2_suite(include_exit_test));
+    srunner_add_suite(sr, make_xml_esc_suite());
+
+    if(strcmp(log_type, "STDOUT") == 0)
+    {
+        /* Nothing else to do here */
+    }
+    else if(strcmp(log_type, "LOG") == 0)
+    {
+        srunner_set_log(sr, "test.log");
+    }
+    else if(strcmp(log_type, "TAP") == 0)
+    {
+        srunner_set_tap(sr, "test.tap");
+    }
+    else if(strcmp(log_type, "XML") == 0)
+    {
+        srunner_set_xml(sr, "test.xml");
+    }
+    else
+    {
+        print_usage();
+        exit(EXIT_FAILURE);
+    }
+
+    srunner_run_all(sr, printmode);
+    srunner_free(sr);
+}
+
+#define OUTPUT_TYPE_ARG       1
+#define LOG_TYPE_ARG          2
+#define INCLUDE_EXIT_TEST_ARG 3
 int main (int argc, char **argv)
 {
-  
-  if (argc != 2) {
-    print_usage();
-    return EXIT_FAILURE;
-  }
+    int printmode;
+    int include_exit_test;
 
-  if (strcmp (argv[1], "CK_SILENT") == 0)
-    run_tests(CK_SILENT);
-  else if (strcmp (argv[1], "CK_MINIMAL") == 0)
-    run_tests(CK_MINIMAL);
-  else if (strcmp (argv[1], "CK_NORMAL") == 0)
-    run_tests(CK_NORMAL);
-  else if (strcmp (argv[1], "CK_VERBOSE") == 0)
-    run_tests(CK_VERBOSE);
-#if ENABLE_SUBUNIT
-  else if (strcmp (argv[1], "CK_SUBUNIT") == 0)
-    run_tests(CK_SUBUNIT);
-#endif
-  else {
-    print_usage();
-    return EXIT_FAILURE;
-  }    
-    
+    if (argc != 4)
+    {
+        print_usage();
+        return EXIT_FAILURE;
+    }
+
+    if (strcmp (argv[OUTPUT_TYPE_ARG], "CK_SILENT") == 0)
+    {
+        printmode = CK_SILENT;
+    }
+    else if (strcmp (argv[OUTPUT_TYPE_ARG], "CK_MINIMAL") == 0)
+    {
+        printmode = CK_MINIMAL;
+    }
+    else if (strcmp (argv[OUTPUT_TYPE_ARG], "CK_NORMAL") == 0)
+    {
+        printmode = CK_NORMAL;
+    }
+    else if (strcmp (argv[OUTPUT_TYPE_ARG], "CK_VERBOSE") == 0)
+    {
+        printmode = CK_VERBOSE;
+    }
+    #if ENABLE_SUBUNIT
+    else if (strcmp (argv[OUTPUT_TYPE_ARG], "CK_SUBUNIT") == 0)
+    {
+        printmode = CK_SUBUNIT;
+    }
+    #endif
+    else
+    {
+        print_usage();
+        return EXIT_FAILURE;
+    }
 
-  return EXIT_SUCCESS;
+    if (strcmp (argv[INCLUDE_EXIT_TEST_ARG], "NORMAL") == 0)
+    {
+        include_exit_test = 0;
+    }
+    else if (strcmp (argv[INCLUDE_EXIT_TEST_ARG], "EXIT_TEST") == 0)
+    {
+        include_exit_test = 1;
+    }
+    else
+    {
+        print_usage();
+        return EXIT_FAILURE;
+    }
+
+    run_tests(printmode, argv[LOG_TYPE_ARG], include_exit_test);
+
+    return EXIT_SUCCESS;
 }
-  
+
diff --git a/tests/ex_tap_output.c b/tests/ex_tap_output.c
deleted file mode 100644 (file)
index 6928ef2..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#include "../lib/libcompat.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <check.h>
-
-START_TEST(test_pass)
-{
-  ck_assert_msg (1==1, "Shouldn't see this");
-}
-END_TEST
-
-START_TEST(test_fail)
-{
-  ck_abort_msg("Failure");
-}
-END_TEST
-
-/*
- * This test will fail without fork, as it will result in the
- * unit test runniner exiting early.
- */
-#if defined(HAVE_FORK) && HAVE_FORK==1
-START_TEST(test_exit)
-{
-  exit(1);
-}
-END_TEST
-#endif /* HAVE_FORK */
-
-/*
- * This test will intentionally mess up the unit testing program
- * when fork is unavailable. The purpose of including it is to
- * ensure that the tap output is correct when a test crashes.
- */
-START_TEST(test_abort)
-{
-  exit(1);
-}
-END_TEST
-
-START_TEST(test_pass2)
-{
-  ck_assert_msg (1==1, "Shouldn't see this");
-}
-END_TEST
-
-static Suite *make_s1_suite (void)
-{
-  Suite *s;
-  TCase *tc;
-
-  s = suite_create("S1");
-  tc = tcase_create ("Core");
-  suite_add_tcase(s, tc);
-  tcase_add_test (tc, test_pass);
-  tcase_add_test (tc, test_fail);
-#if defined(HAVE_FORK) && HAVE_FORK==1
-  tcase_add_test (tc, test_exit);
-#endif /* HAVE_FORK */
-
-  return s;
-}
-
-static Suite *make_s2_suite (int include_abort_test)
-{
-  Suite *s;
-  TCase *tc;
-
-  s = suite_create("S2");
-  tc = tcase_create ("Core");
-  suite_add_tcase(s, tc);
-  if(include_abort_test == 1)
-  {
-     tcase_add_test (tc, test_abort);
-  }
-  tcase_add_test (tc, test_pass2);
-
-  return s;
-}
-
-static void run_tests (int include_abort_test)
-{
-  SRunner *sr;
-
-  sr = srunner_create(make_s1_suite());
-  srunner_add_suite(sr, make_s2_suite(include_abort_test));
-  srunner_set_tap(sr, "test.tap");
-  srunner_run_all(sr, CK_SILENT);
-  srunner_free(sr);
-}
-
-static void usage(void)
-{
-  printf ("Usage: ex_tap_output (NORMAL | TEST_ABORT)\n");
-}
-
-int main (int argc, char **argv)
-{
-
-  if (argc != 2)
-  {
-    usage();
-    return EXIT_FAILURE;
-  }
-
-  if (strcmp (argv[1], "NORMAL") == 0)
-  {
-    run_tests(0 /* run only tests that will behave properly*/);
-  }
-  else if (strcmp (argv[1], "TEST_ABORT") == 0)
-  {
-    run_tests(1 /* Include a test that will fail without fork()*/);
-  }
-  else
-  {
-    usage();
-    return EXIT_FAILURE;
-  }
-
-  return EXIT_SUCCESS;
-}
diff --git a/tests/ex_xml_output.c b/tests/ex_xml_output.c
deleted file mode 100644 (file)
index 173cffb..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#include "../lib/libcompat.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <check.h>
-
-START_TEST(test_pass)
-{
-  ck_assert_msg (1==1, "Shouldn't see this");
-}
-END_TEST
-
-START_TEST(test_fail)
-{
-  ck_abort_msg("Failure");
-}
-END_TEST
-
-/*
- * This test will fail without fork, as it will result in the
- * unit test runniner exiting early.
- */
-#if defined(HAVE_FORK) && HAVE_FORK==1
-START_TEST(test_exit)
-{
-  exit(1);
-}
-END_TEST
-#endif /* HAVE_FORK */
-
-START_TEST(test_pass2)
-{
-  ck_assert_msg (1==1, "Shouldn't see this");
-}
-END_TEST
-
-START_TEST(test_loop)
-{
-  ck_assert_msg (_i==1, "Iteration %d failed", _i);
-}
-END_TEST
-
-START_TEST(test_xml_esc_fail_msg)
-{
-  ck_abort_msg("fail \" ' < > & message");
-}
-END_TEST
-
-static Suite *make_s1_suite (void)
-{
-  Suite *s;
-  TCase *tc;
-
-  s = suite_create("S1");
-  tc = tcase_create ("Core");
-  suite_add_tcase(s, tc);
-  tcase_add_test (tc, test_pass);
-  tcase_add_test (tc, test_fail);
-#if defined(HAVE_FORK) && HAVE_FORK==1
-  tcase_add_test (tc, test_exit);
-#endif /* HAVE_FORK */
-
-  return s;
-}
-
-static Suite *make_s2_suite (void)
-{
-  Suite *s;
-  TCase *tc;
-
-  s = suite_create("S2");
-  tc = tcase_create ("Core");
-  suite_add_tcase(s, tc);
-  tcase_add_test (tc, test_pass2);
-  tcase_add_loop_test(tc, test_loop, 0, 3);
-
-  return s;
-}
-
-/* check that XML special characters are properly escaped in XML log file */
-static Suite *make_xml_esc_suite (void)
-{
-  Suite *s;
-  TCase *tc;
-
-  s = suite_create("XML escape \" ' < > & tests");
-  tc = tcase_create ("description \" ' < > &");
-  suite_add_tcase(s, tc);
-
-  tcase_add_test (tc, test_xml_esc_fail_msg);
-
-  return s;
-}
-
-static void run_tests (int printmode)
-{
-  SRunner *sr;
-
-  sr = srunner_create(make_s1_suite());
-  srunner_add_suite(sr, make_s2_suite());
-  srunner_add_suite(sr, make_xml_esc_suite());
-
-  srunner_set_xml(sr, "test.log.xml");
-  srunner_run_all(sr, printmode);
-  srunner_free(sr);
-}
-
-
-int main (int argc CK_ATTRIBUTE_UNUSED, char **argv CK_ATTRIBUTE_UNUSED)
-{
-  run_tests(CK_SILENT);                /* not considered in XML output */
-
-  return EXIT_SUCCESS;
-}
-  
index b17490bd4b9ca9ea1b37ca40b219bf38669050b7..8c890b53fa44e6cee8bb6d3a9b0467f8f2fdfca8 100755 (executable)
@@ -12,29 +12,39 @@ fi
 
 if [ $HAVE_FORK -eq 1 ]; then
 expected="Running suite S1
-${SRCDIR}ex_log_output.c:10:P:Core:test_pass:0: Passed
-${SRCDIR}ex_log_output.c:16:F:Core:test_fail:0: Failure
-${SRCDIR}ex_log_output.c:25:E:Core:test_exit:0: (after this point) Early exit with return value 1
+${SRCDIR}ex_output.c:11:P:Core:test_pass:0: Passed
+${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure
+${SRCDIR}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1
 Running suite S2
-${SRCDIR}ex_log_output.c:34:P:Core:test_pass2:0: Passed
+${SRCDIR}ex_output.c:46:P:Core:test_pass2:0: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:0: Iteration 0 failed
+${SRCDIR}ex_output.c:52:P:Core:test_loop:1: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:2: Iteration 2 failed
+Running suite XML escape \" ' < > & tests
+${SRCDIR}ex_output.c:58:F:description \" ' < > &:test_xml_esc_fail_msg:0: fail \" ' < > & message
 Results for all suites run:
-50%: Checks: 4, Failures: 1, Errors: 1"
+37%: Checks: 8, Failures: 4, Errors: 1"
 else
 expected="Running suite S1
-${SRCDIR}ex_log_output.c:10:P:Core:test_pass:0: Passed
-${SRCDIR}ex_log_output.c:16:F:Core:test_fail:0: Failure
+${SRCDIR}ex_output.c:11:P:Core:test_pass:0: Passed
+${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure
 Running suite S2
-${SRCDIR}ex_log_output.c:34:P:Core:test_pass2:0: Passed
+${SRCDIR}ex_output.c:46:P:Core:test_pass2:0: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:0: Iteration 0 failed
+${SRCDIR}ex_output.c:52:P:Core:test_loop:1: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:2: Iteration 2 failed
+Running suite XML escape \" ' < > & tests
+${SRCDIR}ex_output.c:58:F:description \" ' < > &:test_xml_esc_fail_msg:0: fail \" ' < > & message
 Results for all suites run:
-66%: Checks: 3, Failures: 1, Errors: 0"
+42%: Checks: 7, Failures: 4, Errors: 0"
 fi
 
 test_log_output ( ) {
     rm -f ${OUTPUT_FILE}
-    ./ex_log_output${EXEEXT} "${1}" > /dev/null
+    ./ex_output${EXEEXT} "${1}" "LOG" "NORMAL" > /dev/null
     actual=`cat ${OUTPUT_FILE} | tr -d "\r"`
     if [ x"${expected}" != x"${actual}" ]; then
-       echo "Problem with ex_log_output${EXEEXT} ${1}";
+       echo "Problem with ex_log_output${EXEEXT} ${1} LOG NORMAL";
        echo "Expected:";
        echo "${expected}";
        echo "Got:";
index 8199d4b062308568b0164250fc60ddfdcb24b98b..0958ec17b9bf491ad5fa50ba29637182ffb82cfc 100755 (executable)
@@ -11,35 +11,63 @@ fi
 t0="x"
 
 if [ $HAVE_FORK -eq 1 ]; then
-t1="xRunning suite(s): Master
-33%: Checks: 3, Failures: 1, Errors: 1"
+t1="xRunning suite(s): S1
+ S2
+ XML escape \" ' < > & tests
+37%: Checks: 8, Failures: 4, Errors: 1"
 else
-t1="xRunning suite(s): Master
-50%: Checks: 2, Failures: 1, Errors: 0"
+t1="xRunning suite(s): S1
+ S2
+ XML escape \" ' < > & tests
+42%: Checks: 7, Failures: 4, Errors: 0"
 fi
 
 if [ $HAVE_FORK -eq 1 ]; then
-t2="xRunning suite(s): Master
-33%: Checks: 3, Failures: 1, Errors: 1
+t2="xRunning suite(s): S1
+ S2
+ XML escape \" ' < > & tests
+37%: Checks: 8, Failures: 4, Errors: 1
 ${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure
-${SRCDIR}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1"
+${SRCDIR}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1
+${SRCDIR}ex_output.c:52:F:Core:test_loop:0: Iteration 0 failed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:2: Iteration 2 failed
+${SRCDIR}ex_output.c:58:F:description \" ' < > &:test_xml_esc_fail_msg:0: fail \" ' < > & message"
 else
-t2="xRunning suite(s): Master
-50%: Checks: 2, Failures: 1, Errors: 0
-${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure"
+t2="xRunning suite(s): S1
+ S2
+ XML escape \" ' < > & tests
+42%: Checks: 7, Failures: 4, Errors: 0
+${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure
+${SRCDIR}ex_output.c:52:F:Core:test_loop:0: Iteration 0 failed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:2: Iteration 2 failed
+${SRCDIR}ex_output.c:58:F:description \" ' < > &:test_xml_esc_fail_msg:0: fail \" ' < > & message"
 fi
 
 if [ $HAVE_FORK -eq 1 ]; then
-t3="xRunning suite(s): Master
-33%: Checks: 3, Failures: 1, Errors: 1
+t3="xRunning suite(s): S1
+ S2
+ XML escape \" ' < > & tests
+37%: Checks: 8, Failures: 4, Errors: 1
 ${SRCDIR}ex_output.c:11:P:Core:test_pass:0: Passed
 ${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure
-${SRCDIR}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1"
+${SRCDIR}ex_output.c:26:E:Core:test_exit:0: (after this point) Early exit with return value 1
+${SRCDIR}ex_output.c:46:P:Core:test_pass2:0: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:0: Iteration 0 failed
+${SRCDIR}ex_output.c:52:P:Core:test_loop:1: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:2: Iteration 2 failed
+${SRCDIR}ex_output.c:58:F:description \" ' < > &:test_xml_esc_fail_msg:0: fail \" ' < > & message"
 else
-t3="xRunning suite(s): Master
-50%: Checks: 2, Failures: 1, Errors: 0
+t3="xRunning suite(s): S1
+ S2
+ XML escape \" ' < > & tests
+42%: Checks: 7, Failures: 4, Errors: 0
 ${SRCDIR}ex_output.c:11:P:Core:test_pass:0: Passed
-${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure"
+${SRCDIR}ex_output.c:17:F:Core:test_fail:0: Failure
+${SRCDIR}ex_output.c:46:P:Core:test_pass2:0: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:0: Iteration 0 failed
+${SRCDIR}ex_output.c:52:P:Core:test_loop:1: Passed
+${SRCDIR}ex_output.c:52:F:Core:test_loop:2: Iteration 2 failed
+${SRCDIR}ex_output.c:58:F:description \" ' < > &:test_xml_esc_fail_msg:0: fail \" ' < > & message"
 fi
 
 if [ $HAVE_FORK -eq 1 ]; then
@@ -52,6 +80,22 @@ ${SRCDIR}ex_output.c:17: Failure
 test: Core:test_exit
 error: Core:test_exit [
 ${SRCDIR}ex_output.c:26: (after this point) Early exit with return value 1
+]
+test: Core:test_pass2
+success: Core:test_pass2
+test: Core:test_loop
+failure: Core:test_loop [
+${SRCDIR}ex_output.c:52: Iteration 0 failed
+]
+test: Core:test_loop
+success: Core:test_loop
+test: Core:test_loop
+failure: Core:test_loop [
+${SRCDIR}ex_output.c:52: Iteration 2 failed
+]
+test: description \" ' < > &:test_xml_esc_fail_msg
+failure: description \" ' < > &:test_xml_esc_fail_msg [
+${SRCDIR}ex_output.c:58: fail \" ' < > & message
 ]"
 else
 t4="xtest: Core:test_pass
@@ -59,15 +103,31 @@ success: Core:test_pass
 test: Core:test_fail
 failure: Core:test_fail [
 ${SRCDIR}ex_output.c:17: Failure
+]
+test: Core:test_pass2
+success: Core:test_pass2
+test: Core:test_loop
+failure: Core:test_loop [
+${SRCDIR}ex_output.c:52: Iteration 0 failed
+]
+test: Core:test_loop
+success: Core:test_loop
+test: Core:test_loop
+failure: Core:test_loop [
+${SRCDIR}ex_output.c:52: Iteration 2 failed
+]
+test: description \" ' < > &:test_xml_esc_fail_msg
+failure: description \" ' < > &:test_xml_esc_fail_msg [
+${SRCDIR}ex_output.c:58: fail \" ' < > & message
 ]"
 fi
 
-op0=`./ex_output${EXEEXT} CK_SILENT   | tr -d "\r"`
-op1=`./ex_output${EXEEXT} CK_MINIMAL  | tr -d "\r"`
-op2=`./ex_output${EXEEXT} CK_NORMAL   | tr -d "\r"`
-op3=`./ex_output${EXEEXT} CK_VERBOSE  | tr -d "\r"`
+op0=`./ex_output${EXEEXT} CK_SILENT STDOUT NORMAL  | tr -d "\r"`
+op1=`./ex_output${EXEEXT} CK_MINIMAL STDOUT NORMAL | tr -d "\r"`
+op2=`./ex_output${EXEEXT} CK_NORMAL  STDOUT NORMAL | tr -d "\r"`
+op3=`./ex_output${EXEEXT} CK_VERBOSE STDOUT NORMAL | tr -d "\r"`
 if test 1 -eq $ENABLE_SUBUNIT; then
-op4=`./ex_output${EXEEXT} CK_SUBUNIT  | tr -d "\r"`
+op4=`./ex_output${EXEEXT} CK_SUBUNIT STDOUT NORMAL | tr -d "\r"`
 fi
 
 
@@ -83,11 +143,11 @@ test_output ( ) {
     
 }
 
-test_output "$t0" x"$op0" "CK_SILENT";
-test_output "$t1" x"$op1" "CK_MINIMAL";
-test_output "$t2" x"$op2" "CK_NORMAL";
-test_output "$t3" x"$op3" "CK_VERBOSE";
+test_output "$t0" x"$op0" "CK_SILENT STDOUT NORMAL";
+test_output "$t1" x"$op1" "CK_MINIMAL STDOUT NORMAL";
+test_output "$t2" x"$op2" "CK_NORMAL STDOUT NORMAL";
+test_output "$t3" x"$op3" "CK_VERBOSE STDOUT NORMAL";
 if test 1 -eq $ENABLE_SUBUNIT; then
-test_output "$t4" x"$op4" "CK_SUBUNIT";
+test_output "$t4" x"$op4" "CK_SUBUNIT STDOUT NORMAL";
 fi
 exit 0
index 2672b2f64f0db626fadb829e76840e25d0732452..c7071e36fc2710259ab5929c2ea55e7907e2752d 100755 (executable)
@@ -11,35 +11,47 @@ else
 fi
 
 if [ $HAVE_FORK -eq 1 ]; then
-expected_normal_tap="ok 1 - ${SRCDIR}ex_tap_output.c:Core:test_pass: Passed
-not ok 2 - ${SRCDIR}ex_tap_output.c:Core:test_fail: Failure
-not ok 3 - ${SRCDIR}ex_tap_output.c:Core:test_exit: Early exit with return value 1
-ok 4 - ${SRCDIR}ex_tap_output.c:Core:test_pass2: Passed
-1..4"
-expected_aborted_tap="ok 1 - ${SRCDIR}ex_tap_output.c:Core:test_pass: Passed
-not ok 2 - ${SRCDIR}ex_tap_output.c:Core:test_fail: Failure
-not ok 3 - ${SRCDIR}ex_tap_output.c:Core:test_exit: Early exit with return value 1
-not ok 4 - ${SRCDIR}ex_tap_output.c:Core:test_abort: Early exit with return value 1
-ok 5 - ${SRCDIR}ex_tap_output.c:Core:test_pass2: Passed
-1..5"
+expected_normal_tap="ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
+not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure
+not ok 3 - ${SRCDIR}ex_output.c:Core:test_exit: Early exit with return value 1
+ok 4 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed
+not ok 5 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed
+ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Passed
+not ok 7 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed
+not ok 8 - ${SRCDIR}ex_output.c:description \" ' < > &:test_xml_esc_fail_msg: fail \" ' < > & message
+1..8"
+expected_aborted_tap="ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
+not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure
+not ok 3 - ${SRCDIR}ex_output.c:Core:test_exit: Early exit with return value 1
+not ok 4 - ${SRCDIR}ex_output.c:Core:test_abort: Early exit with return value 1
+ok 5 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed
+not ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed
+ok 7 - ${SRCDIR}ex_output.c:Core:test_loop: Passed
+not ok 8 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed
+not ok 9 - ${SRCDIR}ex_output.c:description \" ' < > &:test_xml_esc_fail_msg: fail \" ' < > & message
+1..9"
 else
-expected_normal_tap="ok 1 - ${SRCDIR}ex_tap_output.c:Core:test_pass: Passed
-not ok 2 - ${SRCDIR}ex_tap_output.c:Core:test_fail: Failure
-ok 3 - ${SRCDIR}ex_tap_output.c:Core:test_pass2: Passed
-1..3"
+expected_normal_tap="ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
+not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure
+ok 3 - ${SRCDIR}ex_output.c:Core:test_pass2: Passed
+not ok 4 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 0 failed
+ok 5 - ${SRCDIR}ex_output.c:Core:test_loop: Passed
+not ok 6 - ${SRCDIR}ex_output.c:Core:test_loop: Iteration 2 failed
+not ok 7 - ${SRCDIR}ex_output.c:description \" ' < > &:test_xml_esc_fail_msg: fail \" ' < > & message
+1..7"
 # When fork() is unavailable, one of the tests
 # will invoke exit() which will terminate the
 # unit testing program. In that case, the tap
 # results will be incomplete, but the required
 # test plan will be missing, signaling that
 # something bad happened.
-expected_aborted_tap="ok 1 - ${SRCDIR}ex_tap_output.c:Core:test_pass: Passed
-not ok 2 - ${SRCDIR}ex_tap_output.c:Core:test_fail: Failure"
+expected_aborted_tap="ok 1 - ${SRCDIR}ex_output.c:Core:test_pass: Passed
+not ok 2 - ${SRCDIR}ex_output.c:Core:test_fail: Failure"
 fi
 
 test_tap_output ( ) {
     rm -f ${OUTPUT_FILE}
-    ./ex_tap_output${EXEEXT} "${1}" > /dev/null
+    ./ex_output${EXEEXT} "CK_SILENT" "TAP" "${1}" > /dev/null
     actual_tap=`cat ${OUTPUT_FILE} | tr -d "\r"`
     expected_tap="${2}"
     if [ x"${expected_tap}" != x"${actual_tap}" ]; then
@@ -54,6 +66,6 @@ test_tap_output ( ) {
 }
 
 test_tap_output "NORMAL"     "${expected_normal_tap}"
-test_tap_output "TEST_ABORT" "${expected_aborted_tap}"
+test_tap_output "EXIT_TEST" "${expected_aborted_tap}"
 
 exit 0
index 6a3aa291fcd821a5a395da219ee5f707d6ff868c..766c9770ba896a31bd7c5d83c4853837122db082 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-OUTPUT_FILE=test.log.xml
+OUTPUT_FILE=test.xml
 CK_DEFAULT_TIMEOUT=4
 
 . ./test_vars
@@ -12,21 +12,21 @@ expected_xml="<?xml version=\"1.0\"?>
   <suite>
     <title>S1</title>
     <test result=\"success\">
-      <fn>ex_xml_output.c:10</fn>
+      <fn>ex_output.c:11</fn>
       <id>test_pass</id>
       <iteration>0</iteration>
       <description>Core</description>
       <message>Passed</message>
     </test>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:16</fn>
+      <fn>ex_output.c:17</fn>
       <id>test_fail</id>
       <iteration>0</iteration>
       <description>Core</description>
       <message>Failure</message>
     </test>
     <test result=\"error\">
-      <fn>ex_xml_output.c:25</fn>
+      <fn>ex_output.c:26</fn>
       <id>test_exit</id>
       <iteration>0</iteration>
       <description>Core</description>
@@ -36,28 +36,28 @@ expected_xml="<?xml version=\"1.0\"?>
   <suite>
     <title>S2</title>
     <test result=\"success\">
-      <fn>ex_xml_output.c:34</fn>
+      <fn>ex_output.c:46</fn>
       <id>test_pass2</id>
       <iteration>0</iteration>
       <description>Core</description>
       <message>Passed</message>
     </test>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:40</fn>
+      <fn>ex_output.c:52</fn>
       <id>test_loop</id>
       <iteration>0</iteration>
       <description>Core</description>
       <message>Iteration 0 failed</message>
     </test>
     <test result=\"success\">
-      <fn>ex_xml_output.c:40</fn>
+      <fn>ex_output.c:52</fn>
       <id>test_loop</id>
       <iteration>1</iteration>
       <description>Core</description>
       <message>Passed</message>
     </test>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:40</fn>
+      <fn>ex_output.c:52</fn>
       <id>test_loop</id>
       <iteration>2</iteration>
       <description>Core</description>
@@ -67,7 +67,7 @@ expected_xml="<?xml version=\"1.0\"?>
   <suite>
     <title>XML escape &quot; &apos; &lt; &gt; &amp; tests</title>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:46</fn>
+      <fn>ex_output.c:58</fn>
       <id>test_xml_esc_fail_msg</id>
       <iteration>0</iteration>
       <description>description &quot; &apos; &lt; &gt; &amp;</description>
@@ -83,14 +83,14 @@ expected_xml="<?xml version=\"1.0\"?>
   <suite>
     <title>S1</title>
     <test result=\"success\">
-      <fn>ex_xml_output.c:10</fn>
+      <fn>ex_output.c:11</fn>
       <id>test_pass</id>
       <iteration>0</iteration>
       <description>Core</description>
       <message>Passed</message>
     </test>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:16</fn>
+      <fn>ex_output.c:17</fn>
       <id>test_fail</id>
       <iteration>0</iteration>
       <description>Core</description>
@@ -100,28 +100,28 @@ expected_xml="<?xml version=\"1.0\"?>
   <suite>
     <title>S2</title>
     <test result=\"success\">
-      <fn>ex_xml_output.c:34</fn>
+      <fn>ex_output.c:46</fn>
       <id>test_pass2</id>
       <iteration>0</iteration>
       <description>Core</description>
       <message>Passed</message>
     </test>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:40</fn>
+      <fn>ex_output.c:52</fn>
       <id>test_loop</id>
       <iteration>0</iteration>
       <description>Core</description>
       <message>Iteration 0 failed</message>
     </test>
     <test result=\"success\">
-      <fn>ex_xml_output.c:40</fn>
+      <fn>ex_output.c:52</fn>
       <id>test_loop</id>
       <iteration>1</iteration>
       <description>Core</description>
       <message>Passed</message>
     </test>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:40</fn>
+      <fn>ex_output.c:52</fn>
       <id>test_loop</id>
       <iteration>2</iteration>
       <description>Core</description>
@@ -131,7 +131,7 @@ expected_xml="<?xml version=\"1.0\"?>
   <suite>
     <title>XML escape &quot; &apos; &lt; &gt; &amp; tests</title>
     <test result=\"failure\">
-      <fn>ex_xml_output.c:46</fn>
+      <fn>ex_output.c:58</fn>
       <id>test_xml_esc_fail_msg</id>
       <iteration>0</iteration>
       <description>description &quot; &apos; &lt; &gt; &amp;</description>
@@ -144,7 +144,7 @@ fi
 
 rm -f ${OUTPUT_FILE}
 export CK_DEFAULT_TIMEOUT
-./ex_xml_output${EXEEXT} > /dev/null
+./ex_output${EXEEXT} CK_MINIMAL XML NORMAL > /dev/null
 actual_xml=`cat ${OUTPUT_FILE} | tr -d "\r" | grep -v \<duration\> | grep -v \<datetime\> | grep -v \<path\>`
 if [ x"${expected_xml}" != x"${actual_xml}" ]; then
     echo "Problem with ex_xml_output${EXEEXT}";