]> git.ozlabs.org Git - ccan/blob - ccan/antithread/test/run-spawn-NULL.c
ccanlint clean and move endian.h to top of #includes (tests that it doesn't need...
[ccan] / ccan / antithread / test / run-spawn-NULL.c
1 #include "antithread/antithread.c"
2 #include <assert.h>
3 #include "tap/tap.h"
4
5 int main(int argc, char *argv[])
6 {
7         struct at_pool *atp;
8         struct athread *at;
9         int err;
10
11         atp = at_get_pool(&argc, argv, NULL);
12         if (atp) {
13                 at_tell_parent(atp, (void *)1UL);
14                 exit(0);
15         }
16         assert(!argv[1]);
17
18         err = errno;
19         plan_tests(3);
20         ok1(err == EINVAL);
21
22         atp = at_pool(1*1024*1024);
23         assert(atp);
24
25         /* This should work */
26         at = at_spawn(atp, NULL, argv);
27         ok1(at);
28
29         /* Should read back the magic pointer. */
30         ok1(at_read(at) == (void *)1);
31         talloc_free(at);
32
33         return exit_status();
34 }