1 // SPDX-License-Identifier: GPL-2.0
4 #include <perf/cpumap.h>
5 #include <internal/tests.h>
8 static int libperf_print(enum libperf_print_level level,
9 const char *fmt, va_list ap)
11 return vfprintf(stderr, fmt, ap);
14 int test_cpumap(int argc, char **argv)
16 struct perf_cpu_map *cpus;
22 libperf_init(libperf_print);
24 cpus = perf_cpu_map__dummy_new();
28 perf_cpu_map__get(cpus);
29 perf_cpu_map__put(cpus);
30 perf_cpu_map__put(cpus);
32 cpus = perf_cpu_map__default_new();
36 perf_cpu_map__for_each_cpu(cpu, idx, cpus)
37 __T("wrong cpu number", cpu.cpu != -1);
39 perf_cpu_map__put(cpus);
42 return tests_failed == 0 ? 0 : -1;