1 // SPDX-License-Identifier: GPL-2.0
2 #include <stdarg.h>
3 #include <stdio.h>
4 #include <perf/threadmap.h>
5 #include <internal/tests.h>
6 #include "tests.h"
7 
libperf_print(enum libperf_print_level level,const char * fmt,va_list ap)8 static int libperf_print(enum libperf_print_level level,
9 			 const char *fmt, va_list ap)
10 {
11 	return vfprintf(stderr, fmt, ap);
12 }
13 
test_threadmap(int argc,char ** argv)14 int test_threadmap(int argc, char **argv)
15 {
16 	struct perf_thread_map *threads;
17 
18 	__T_START;
19 
20 	libperf_init(libperf_print);
21 
22 	threads = perf_thread_map__new_dummy();
23 	if (!threads)
24 		return -1;
25 
26 	perf_thread_map__get(threads);
27 	perf_thread_map__put(threads);
28 	perf_thread_map__put(threads);
29 
30 	__T_END;
31 	return tests_failed == 0 ? 0 : -1;
32 }
33