mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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.
This commit is contained in:
@ -18,21 +18,18 @@
|
||||
|
||||
/* sync_file_range is only define for LFS. */
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
static void do_prepare (void);
|
||||
#define PREPARE(argc, argv) do_prepare ()
|
||||
static int do_test (void);
|
||||
#define TEST_FUNCTION do_test ()
|
||||
|
||||
#define TIMEOUT 20 /* sec. */
|
||||
#include <support/temp_file.h>
|
||||
#include <support/check.h>
|
||||
|
||||
#define XSTR(s) STR(S)
|
||||
#define STR(s) #s
|
||||
|
||||
#include <test-skeleton.c>
|
||||
|
||||
static char *temp_filename;
|
||||
static int temp_fd;
|
||||
|
||||
@ -40,7 +37,7 @@ static char fifoname[] = "/tmp/tst-posix_fadvise-fifo-XXXXXX";
|
||||
static int fifofd;
|
||||
|
||||
void
|
||||
do_prepare (void)
|
||||
do_prepare (int argc, char **argv)
|
||||
{
|
||||
temp_fd = create_temp_file ("tst-file_sync_range.", &temp_filename);
|
||||
if (temp_fd == -1)
|
||||
@ -57,6 +54,7 @@ do_prepare (void)
|
||||
if (fifofd == -1)
|
||||
FAIL_EXIT1 ("cannot open fifo: %m");
|
||||
}
|
||||
#define PREPARE do_prepare
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
@ -129,3 +127,5 @@ do_test (void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
|
Reference in New Issue
Block a user