#include <string.h>
#include <signal.h>
-static int do_test (void);
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/xthread.h>
+#include <support/temp_file.h>
+#include <support/test-driver.h>
enum {
/* Number of threads which call fork. */
create_threads (pthread_t *threads, size_t count, void *(*func) (void *))
{
for (size_t i = 0; i < count; ++i)
- {
- int ret = pthread_create (threads + i, NULL, func, NULL);
- if (ret != 0)
- {
- errno = ret;
- printf ("error: pthread_create: %m\n");
- abort ();
- }
- }
+ threads[i] = xpthread_create (NULL, func, NULL);
}
static void
join_threads (pthread_t *threads, size_t count)
{
for (size_t i = 0; i < count; ++i)
- {
- int ret = pthread_join (threads[i], NULL);
- if (ret != 0)
- {
- errno = ret;
- printf ("error: pthread_join: %m\n");
- abort ();
- }
- }
+ xpthread_join (threads[i]);
}
/* Create a file which consists of a single long line, and assigns
/* Leave some room for shutting down all threads gracefully. */
int timeout = 3;
- if (timeout > TIMEOUT)
- timeout = TIMEOUT - 1;
+ if (timeout > DEFAULT_TIMEOUT)
+ timeout = DEFAULT_TIMEOUT - 1;
create_file_with_large_line ();
return 0;
}
+
+#include <support/test-driver.c>