xref: /netbsd-src/external/gpl3/gcc/dist/libbacktrace/test_format.c (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1181254a7Smrg /* test_format.c -- Test for libbacktrace library
2*b1e83836Smrg    Copyright (C) 2018-2022 Free Software Foundation, Inc.
3181254a7Smrg 
4181254a7Smrg Redistribution and use in source and binary forms, with or without
5181254a7Smrg modification, are permitted provided that the following conditions are
6181254a7Smrg met:
7181254a7Smrg 
8181254a7Smrg     (1) Redistributions of source code must retain the above copyright
9181254a7Smrg     notice, this list of conditions and the following disclaimer.
10181254a7Smrg 
11181254a7Smrg     (2) Redistributions in binary form must reproduce the above copyright
12181254a7Smrg     notice, this list of conditions and the following disclaimer in
13181254a7Smrg     the documentation and/or other materials provided with the
14181254a7Smrg     distribution.
15181254a7Smrg 
16181254a7Smrg     (3) The name of the author may not be used to
17181254a7Smrg     endorse or promote products derived from this software without
18181254a7Smrg     specific prior written permission.
19181254a7Smrg 
20181254a7Smrg THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21181254a7Smrg IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22181254a7Smrg WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23181254a7Smrg DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24181254a7Smrg INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25181254a7Smrg (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26181254a7Smrg SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27181254a7Smrg HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28181254a7Smrg STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29181254a7Smrg IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30181254a7Smrg POSSIBILITY OF SUCH DAMAGE.  */
31181254a7Smrg 
32181254a7Smrg /* This program tests the externally visible interfaces of the
33181254a7Smrg    libbacktrace library.  */
34181254a7Smrg 
35181254a7Smrg #include <assert.h>
36181254a7Smrg #include <stdio.h>
37181254a7Smrg #include <stdlib.h>
38181254a7Smrg #include <string.h>
39181254a7Smrg #include <unistd.h>
40181254a7Smrg 
41181254a7Smrg #include "filenames.h"
42181254a7Smrg 
43181254a7Smrg #include "backtrace.h"
44181254a7Smrg #include "backtrace-supported.h"
45181254a7Smrg 
46181254a7Smrg #include "testlib.h"
47181254a7Smrg 
48181254a7Smrg int
main(int argc ATTRIBUTE_UNUSED,char ** argv)49181254a7Smrg main (int argc ATTRIBUTE_UNUSED, char **argv)
50181254a7Smrg {
51181254a7Smrg   state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
52181254a7Smrg 				  error_callback_create, NULL);
53181254a7Smrg 
54181254a7Smrg   exit (failures ? EXIT_FAILURE : EXIT_SUCCESS);
55181254a7Smrg }
56