preload/posix/generate: Replace spaces with tab
[libfiu.git] / tests / test-enable_stack_by_name.c
blob0968abac7129f4661bf8284b392a52c9cb05e7b9
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <assert.h>
6 #include <fiu.h>
7 #include <fiu-control.h>
9 void func1(int should_fail)
11 int failed;
14 int nptrs;
15 void *buffer[100];
16 nptrs = backtrace(buffer, 100);
17 backtrace_symbols_fd(buffer, nptrs, 1);
20 failed = fiu_fail("fp-1") != 0;
21 assert(failed == should_fail);
24 void func2(int should_fail)
26 func1(should_fail);
30 int main(void)
32 int r;
34 fiu_init(0);
35 r = fiu_enable_stack_by_name("fp-1", 1, NULL, 0, "func2", -1);
36 if (r != 0) {
37 printf("NOTE: fiu_enable_stack_by_name() failed, "
38 "skipping test\n");
39 return 0;
42 func1(0);
43 func2(1);
45 fiu_disable("fp-1");
47 func1(0);
48 func2(0);
50 return 0;