Make test-skeleton.c grok TEST_DIRECT magic environment variable.
This commit is contained in:
parent
2902af1631
commit
b0b88abc1c
|
@ -1,3 +1,10 @@
|
||||||
|
2015-04-09 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* test-skeleton.c (TIMEOUT): Move #define to top level.
|
||||||
|
(main): Grok environment variable TEST_DIRECT. If set, print
|
||||||
|
test expectation details into that file and then behave as if
|
||||||
|
given --direct.
|
||||||
|
|
||||||
2015-04-09 Florian Weimer <fweimer@redhat.com>
|
2015-04-09 Florian Weimer <fweimer@redhat.com>
|
||||||
|
|
||||||
* malloc/tst-scratch_buffer.c (do_test): Suppress truncation
|
* malloc/tst-scratch_buffer.c (do_test): Suppress truncation
|
||||||
|
|
|
@ -45,6 +45,11 @@
|
||||||
# define TEST_DATA_LIMIT (64 << 20) /* Data limit (bytes) to run with. */
|
# define TEST_DATA_LIMIT (64 << 20) /* Data limit (bytes) to run with. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TIMEOUT
|
||||||
|
/* Default timeout is two seconds. */
|
||||||
|
# define TIMEOUT 2
|
||||||
|
#endif
|
||||||
|
|
||||||
#define OPT_DIRECT 1000
|
#define OPT_DIRECT 1000
|
||||||
#define OPT_TESTDIR 1001
|
#define OPT_TESTDIR 1001
|
||||||
|
|
||||||
|
@ -293,7 +298,7 @@ main (int argc, char *argv[])
|
||||||
/* Make sure we see all message, even those on stdout. */
|
/* Make sure we see all message, even those on stdout. */
|
||||||
setvbuf (stdout, NULL, _IONBF, 0);
|
setvbuf (stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
/* make sure temporary files are deleted. */
|
/* Make sure temporary files are deleted. */
|
||||||
atexit (delete_temp_files);
|
atexit (delete_temp_files);
|
||||||
|
|
||||||
/* Correct for the possible parameters. */
|
/* Correct for the possible parameters. */
|
||||||
|
@ -306,6 +311,46 @@ main (int argc, char *argv[])
|
||||||
PREPARE (argc, argv);
|
PREPARE (argc, argv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *envstr_direct = getenv ("TEST_DIRECT");
|
||||||
|
if (envstr_direct != NULL)
|
||||||
|
{
|
||||||
|
FILE *f = fopen (envstr_direct, "w");
|
||||||
|
if (f == NULL)
|
||||||
|
{
|
||||||
|
printf ("cannot open TEST_DIRECT output file '%s': %m\n",
|
||||||
|
envstr_direct);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (f, "timeout=%u\ntimeoutfactor=%u\n", TIMEOUT, timeoutfactor);
|
||||||
|
#ifdef EXPECTED_STATUS
|
||||||
|
fprintf (f, "exit=%u\n", EXPECTED_STATUS);
|
||||||
|
#endif
|
||||||
|
#ifdef EXPECTED_SIGNAL
|
||||||
|
switch (EXPECTED_SIGNAL)
|
||||||
|
{
|
||||||
|
default: abort ();
|
||||||
|
# define init_sig(signo, name, text) \
|
||||||
|
case signo: fprintf (f, "signal=%s\n", name); break;
|
||||||
|
# include <siglist.h>
|
||||||
|
# undef init_sig
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (temp_name_list != NULL)
|
||||||
|
{
|
||||||
|
fprintf (f, "temp_files=(\n");
|
||||||
|
for (struct temp_name_list *n = temp_name_list;
|
||||||
|
n != NULL;
|
||||||
|
n = (struct temp_name_list *) n->q.q_forw)
|
||||||
|
fprintf (f, " '%s'\n", n->name);
|
||||||
|
fprintf (f, ")\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (f);
|
||||||
|
direct = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we are not expected to fork run the function immediately. */
|
/* If we are not expected to fork run the function immediately. */
|
||||||
if (direct)
|
if (direct)
|
||||||
return TEST_FUNCTION;
|
return TEST_FUNCTION;
|
||||||
|
@ -359,10 +404,6 @@ main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set timeout. */
|
/* Set timeout. */
|
||||||
#ifndef TIMEOUT
|
|
||||||
/* Default timeout is two seconds. */
|
|
||||||
# define TIMEOUT 2
|
|
||||||
#endif
|
|
||||||
signal (SIGALRM, signal_handler);
|
signal (SIGALRM, signal_handler);
|
||||||
alarm (TIMEOUT * timeoutfactor);
|
alarm (TIMEOUT * timeoutfactor);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue