new test system
[libc-test] / src / regression / pthread_create-oom.c
1 // commit: 59666802fba592a59f2f4ea4dcb053287fd55826 2011-02-15
2 // pthread_create should return EAGAIN on failure
3 #include <pthread.h>
4 #include <stdio.h>
5 #include <errno.h>
6 #include <string.h>
7 #include "test.h"
8
9 static void *start(void *arg)
10 {
11         return 0;
12 }
13
14 int main(void)
15 {
16         pthread_t td;
17         int r, arg;
18
19         r = t_vmfill(0, 0, 0);
20         if (r <= 0) {
21                 t_error("fatal: vmfill has failed\n");
22                 return 1;
23         }
24         r = pthread_create(&td, 0, start, &arg);
25         if (r == 0)
26                 t_error("pthread_create succeeded\n");
27         else if (r != EAGAIN)
28                 t_error("pthread_create should fail with EAGAIN but failed with %d (%s)\n", r, strerror(r));
29
30         return t_status;
31 }