about summary refs log tree commit diff
path: root/support/README-testing.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-12-09 08:18:27 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-12-09 08:18:27 +0100
commitc23de0aacbeaa7a091609b35764bed931475a16d (patch)
treebe4396f71292ee7a509912d70e74323d1587d227 /support/README-testing.c
parentc03073774f915fe7841c2b551fe304544143470f (diff)
downloadglibc-c23de0aacbeaa7a091609b35764bed931475a16d.tar.gz
glibc-c23de0aacbeaa7a091609b35764bed931475a16d.tar.xz
glibc-c23de0aacbeaa7a091609b35764bed931475a16d.zip
support: Introduce new subdirectory for test infrastructure
The new test driver in <support/test-driver.c> has feature parity with
the old one.  The main difference is that its hooking mechanism is
based on functions and function pointers instead of macros.  This
commit also implements a new environment variable, TEST_COREDUMPS,
which disables the code which disables coredumps (that is, it enables
them if the invocation environment has not disabled them).

<test-skeleton.c> defines wrapper functions so that it is possible to
use existing macros with the new-style hook functionality.

This commit changes only a few test cases to the new test driver, to
make sure that it works as expected.
Diffstat (limited to 'support/README-testing.c')
-rw-r--r--support/README-testing.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/support/README-testing.c b/support/README-testing.c
new file mode 100644
index 0000000000..9d289c3020
--- /dev/null
+++ b/support/README-testing.c
@@ -0,0 +1,19 @@
+/* This file contains an example test case which shows minimal use of
+   the test framework.  Additional testing hooks are described in
+   <support/test-driver.c>.  */
+
+/* This function will be called from the test driver.  */
+static int
+do_test (void)
+{
+  if (3 == 5)
+    /* Indicate failure.  */
+    return 1;
+  else
+    /* Indicate success.  */
+    return 0;
+}
+
+/* This file references do_test above and contains the definition of
+   the main function.  */
+#include <support/test-driver.c>