builtin-test.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. /*
  2. * builtin-test.c
  3. *
  4. * Builtin regression testing command: ever growing number of sanity tests
  5. */
  6. #include "builtin.h"
  7. #include "util/cache.h"
  8. #include "util/debug.h"
  9. #include "util/evlist.h"
  10. #include "util/parse-options.h"
  11. #include "util/parse-events.h"
  12. #include "util/session.h"
  13. #include "util/symbol.h"
  14. #include "util/thread.h"
  15. static long page_size;
  16. static int vmlinux_matches_kallsyms_filter(struct map *map __used, struct symbol *sym)
  17. {
  18. bool *visited = symbol__priv(sym);
  19. *visited = true;
  20. return 0;
  21. }
  22. static int test__vmlinux_matches_kallsyms(void)
  23. {
  24. int err = -1;
  25. struct rb_node *nd;
  26. struct symbol *sym;
  27. struct map *kallsyms_map, *vmlinux_map;
  28. struct machine kallsyms, vmlinux;
  29. enum map_type type = MAP__FUNCTION;
  30. struct ref_reloc_sym ref_reloc_sym = { .name = "_stext", };
  31. /*
  32. * Step 1:
  33. *
  34. * Init the machines that will hold kernel, modules obtained from
  35. * both vmlinux + .ko files and from /proc/kallsyms split by modules.
  36. */
  37. machine__init(&kallsyms, "", HOST_KERNEL_ID);
  38. machine__init(&vmlinux, "", HOST_KERNEL_ID);
  39. /*
  40. * Step 2:
  41. *
  42. * Create the kernel maps for kallsyms and the DSO where we will then
  43. * load /proc/kallsyms. Also create the modules maps from /proc/modules
  44. * and find the .ko files that match them in /lib/modules/`uname -r`/.
  45. */
  46. if (machine__create_kernel_maps(&kallsyms) < 0) {
  47. pr_debug("machine__create_kernel_maps ");
  48. return -1;
  49. }
  50. /*
  51. * Step 3:
  52. *
  53. * Load and split /proc/kallsyms into multiple maps, one per module.
  54. */
  55. if (machine__load_kallsyms(&kallsyms, "/proc/kallsyms", type, NULL) <= 0) {
  56. pr_debug("dso__load_kallsyms ");
  57. goto out;
  58. }
  59. /*
  60. * Step 4:
  61. *
  62. * kallsyms will be internally on demand sorted by name so that we can
  63. * find the reference relocation * symbol, i.e. the symbol we will use
  64. * to see if the running kernel was relocated by checking if it has the
  65. * same value in the vmlinux file we load.
  66. */
  67. kallsyms_map = machine__kernel_map(&kallsyms, type);
  68. sym = map__find_symbol_by_name(kallsyms_map, ref_reloc_sym.name, NULL);
  69. if (sym == NULL) {
  70. pr_debug("dso__find_symbol_by_name ");
  71. goto out;
  72. }
  73. ref_reloc_sym.addr = sym->start;
  74. /*
  75. * Step 5:
  76. *
  77. * Now repeat step 2, this time for the vmlinux file we'll auto-locate.
  78. */
  79. if (machine__create_kernel_maps(&vmlinux) < 0) {
  80. pr_debug("machine__create_kernel_maps ");
  81. goto out;
  82. }
  83. vmlinux_map = machine__kernel_map(&vmlinux, type);
  84. map__kmap(vmlinux_map)->ref_reloc_sym = &ref_reloc_sym;
  85. /*
  86. * Step 6:
  87. *
  88. * Locate a vmlinux file in the vmlinux path that has a buildid that
  89. * matches the one of the running kernel.
  90. *
  91. * While doing that look if we find the ref reloc symbol, if we find it
  92. * we'll have its ref_reloc_symbol.unrelocated_addr and then
  93. * maps__reloc_vmlinux will notice and set proper ->[un]map_ip routines
  94. * to fixup the symbols.
  95. */
  96. if (machine__load_vmlinux_path(&vmlinux, type,
  97. vmlinux_matches_kallsyms_filter) <= 0) {
  98. pr_debug("machine__load_vmlinux_path ");
  99. goto out;
  100. }
  101. err = 0;
  102. /*
  103. * Step 7:
  104. *
  105. * Now look at the symbols in the vmlinux DSO and check if we find all of them
  106. * in the kallsyms dso. For the ones that are in both, check its names and
  107. * end addresses too.
  108. */
  109. for (nd = rb_first(&vmlinux_map->dso->symbols[type]); nd; nd = rb_next(nd)) {
  110. struct symbol *pair, *first_pair;
  111. bool backwards = true;
  112. sym = rb_entry(nd, struct symbol, rb_node);
  113. if (sym->start == sym->end)
  114. continue;
  115. first_pair = machine__find_kernel_symbol(&kallsyms, type, sym->start, NULL, NULL);
  116. pair = first_pair;
  117. if (pair && pair->start == sym->start) {
  118. next_pair:
  119. if (strcmp(sym->name, pair->name) == 0) {
  120. /*
  121. * kallsyms don't have the symbol end, so we
  122. * set that by using the next symbol start - 1,
  123. * in some cases we get this up to a page
  124. * wrong, trace_kmalloc when I was developing
  125. * this code was one such example, 2106 bytes
  126. * off the real size. More than that and we
  127. * _really_ have a problem.
  128. */
  129. s64 skew = sym->end - pair->end;
  130. if (llabs(skew) < page_size)
  131. continue;
  132. pr_debug("%#" PRIx64 ": diff end addr for %s v: %#" PRIx64 " k: %#" PRIx64 "\n",
  133. sym->start, sym->name, sym->end, pair->end);
  134. } else {
  135. struct rb_node *nnd;
  136. detour:
  137. nnd = backwards ? rb_prev(&pair->rb_node) :
  138. rb_next(&pair->rb_node);
  139. if (nnd) {
  140. struct symbol *next = rb_entry(nnd, struct symbol, rb_node);
  141. if (next->start == sym->start) {
  142. pair = next;
  143. goto next_pair;
  144. }
  145. }
  146. if (backwards) {
  147. backwards = false;
  148. pair = first_pair;
  149. goto detour;
  150. }
  151. pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n",
  152. sym->start, sym->name, pair->name);
  153. }
  154. } else
  155. pr_debug("%#" PRIx64 ": %s not on kallsyms\n", sym->start, sym->name);
  156. err = -1;
  157. }
  158. if (!verbose)
  159. goto out;
  160. pr_info("Maps only in vmlinux:\n");
  161. for (nd = rb_first(&vmlinux.kmaps.maps[type]); nd; nd = rb_next(nd)) {
  162. struct map *pos = rb_entry(nd, struct map, rb_node), *pair;
  163. /*
  164. * If it is the kernel, kallsyms is always "[kernel.kallsyms]", while
  165. * the kernel will have the path for the vmlinux file being used,
  166. * so use the short name, less descriptive but the same ("[kernel]" in
  167. * both cases.
  168. */
  169. pair = map_groups__find_by_name(&kallsyms.kmaps, type,
  170. (pos->dso->kernel ?
  171. pos->dso->short_name :
  172. pos->dso->name));
  173. if (pair)
  174. pair->priv = 1;
  175. else
  176. map__fprintf(pos, stderr);
  177. }
  178. pr_info("Maps in vmlinux with a different name in kallsyms:\n");
  179. for (nd = rb_first(&vmlinux.kmaps.maps[type]); nd; nd = rb_next(nd)) {
  180. struct map *pos = rb_entry(nd, struct map, rb_node), *pair;
  181. pair = map_groups__find(&kallsyms.kmaps, type, pos->start);
  182. if (pair == NULL || pair->priv)
  183. continue;
  184. if (pair->start == pos->start) {
  185. pair->priv = 1;
  186. pr_info(" %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s in kallsyms as",
  187. pos->start, pos->end, pos->pgoff, pos->dso->name);
  188. if (pos->pgoff != pair->pgoff || pos->end != pair->end)
  189. pr_info(": \n*%" PRIx64 "-%" PRIx64 " %" PRIx64 "",
  190. pair->start, pair->end, pair->pgoff);
  191. pr_info(" %s\n", pair->dso->name);
  192. pair->priv = 1;
  193. }
  194. }
  195. pr_info("Maps only in kallsyms:\n");
  196. for (nd = rb_first(&kallsyms.kmaps.maps[type]);
  197. nd; nd = rb_next(nd)) {
  198. struct map *pos = rb_entry(nd, struct map, rb_node);
  199. if (!pos->priv)
  200. map__fprintf(pos, stderr);
  201. }
  202. out:
  203. return err;
  204. }
  205. #include "util/cpumap.h"
  206. #include "util/evsel.h"
  207. #include <sys/types.h>
  208. static int trace_event__id(const char *evname)
  209. {
  210. char *filename;
  211. int err = -1, fd;
  212. if (asprintf(&filename,
  213. "/sys/kernel/debug/tracing/events/syscalls/%s/id",
  214. evname) < 0)
  215. return -1;
  216. fd = open(filename, O_RDONLY);
  217. if (fd >= 0) {
  218. char id[16];
  219. if (read(fd, id, sizeof(id)) > 0)
  220. err = atoi(id);
  221. close(fd);
  222. }
  223. free(filename);
  224. return err;
  225. }
  226. static int test__open_syscall_event(void)
  227. {
  228. int err = -1, fd;
  229. struct thread_map *threads;
  230. struct perf_evsel *evsel;
  231. struct perf_event_attr attr;
  232. unsigned int nr_open_calls = 111, i;
  233. int id = trace_event__id("sys_enter_open");
  234. if (id < 0) {
  235. pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
  236. return -1;
  237. }
  238. threads = thread_map__new(-1, getpid());
  239. if (threads == NULL) {
  240. pr_debug("thread_map__new\n");
  241. return -1;
  242. }
  243. memset(&attr, 0, sizeof(attr));
  244. attr.type = PERF_TYPE_TRACEPOINT;
  245. attr.config = id;
  246. evsel = perf_evsel__new(&attr, 0);
  247. if (evsel == NULL) {
  248. pr_debug("perf_evsel__new\n");
  249. goto out_thread_map_delete;
  250. }
  251. if (perf_evsel__open_per_thread(evsel, threads, false, false) < 0) {
  252. pr_debug("failed to open counter: %s, "
  253. "tweak /proc/sys/kernel/perf_event_paranoid?\n",
  254. strerror(errno));
  255. goto out_evsel_delete;
  256. }
  257. for (i = 0; i < nr_open_calls; ++i) {
  258. fd = open("/etc/passwd", O_RDONLY);
  259. close(fd);
  260. }
  261. if (perf_evsel__read_on_cpu(evsel, 0, 0) < 0) {
  262. pr_debug("perf_evsel__open_read_on_cpu\n");
  263. goto out_close_fd;
  264. }
  265. if (evsel->counts->cpu[0].val != nr_open_calls) {
  266. pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %" PRIu64 "\n",
  267. nr_open_calls, evsel->counts->cpu[0].val);
  268. goto out_close_fd;
  269. }
  270. err = 0;
  271. out_close_fd:
  272. perf_evsel__close_fd(evsel, 1, threads->nr);
  273. out_evsel_delete:
  274. perf_evsel__delete(evsel);
  275. out_thread_map_delete:
  276. thread_map__delete(threads);
  277. return err;
  278. }
  279. #include <sched.h>
  280. static int test__open_syscall_event_on_all_cpus(void)
  281. {
  282. int err = -1, fd, cpu;
  283. struct thread_map *threads;
  284. struct cpu_map *cpus;
  285. struct perf_evsel *evsel;
  286. struct perf_event_attr attr;
  287. unsigned int nr_open_calls = 111, i;
  288. cpu_set_t cpu_set;
  289. int id = trace_event__id("sys_enter_open");
  290. if (id < 0) {
  291. pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
  292. return -1;
  293. }
  294. threads = thread_map__new(-1, getpid());
  295. if (threads == NULL) {
  296. pr_debug("thread_map__new\n");
  297. return -1;
  298. }
  299. cpus = cpu_map__new(NULL);
  300. if (cpus == NULL) {
  301. pr_debug("cpu_map__new\n");
  302. goto out_thread_map_delete;
  303. }
  304. CPU_ZERO(&cpu_set);
  305. memset(&attr, 0, sizeof(attr));
  306. attr.type = PERF_TYPE_TRACEPOINT;
  307. attr.config = id;
  308. evsel = perf_evsel__new(&attr, 0);
  309. if (evsel == NULL) {
  310. pr_debug("perf_evsel__new\n");
  311. goto out_thread_map_delete;
  312. }
  313. if (perf_evsel__open(evsel, cpus, threads, false, false) < 0) {
  314. pr_debug("failed to open counter: %s, "
  315. "tweak /proc/sys/kernel/perf_event_paranoid?\n",
  316. strerror(errno));
  317. goto out_evsel_delete;
  318. }
  319. for (cpu = 0; cpu < cpus->nr; ++cpu) {
  320. unsigned int ncalls = nr_open_calls + cpu;
  321. /*
  322. * XXX eventually lift this restriction in a way that
  323. * keeps perf building on older glibc installations
  324. * without CPU_ALLOC. 1024 cpus in 2010 still seems
  325. * a reasonable upper limit tho :-)
  326. */
  327. if (cpus->map[cpu] >= CPU_SETSIZE) {
  328. pr_debug("Ignoring CPU %d\n", cpus->map[cpu]);
  329. continue;
  330. }
  331. CPU_SET(cpus->map[cpu], &cpu_set);
  332. if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) < 0) {
  333. pr_debug("sched_setaffinity() failed on CPU %d: %s ",
  334. cpus->map[cpu],
  335. strerror(errno));
  336. goto out_close_fd;
  337. }
  338. for (i = 0; i < ncalls; ++i) {
  339. fd = open("/etc/passwd", O_RDONLY);
  340. close(fd);
  341. }
  342. CPU_CLR(cpus->map[cpu], &cpu_set);
  343. }
  344. /*
  345. * Here we need to explicitely preallocate the counts, as if
  346. * we use the auto allocation it will allocate just for 1 cpu,
  347. * as we start by cpu 0.
  348. */
  349. if (perf_evsel__alloc_counts(evsel, cpus->nr) < 0) {
  350. pr_debug("perf_evsel__alloc_counts(ncpus=%d)\n", cpus->nr);
  351. goto out_close_fd;
  352. }
  353. err = 0;
  354. for (cpu = 0; cpu < cpus->nr; ++cpu) {
  355. unsigned int expected;
  356. if (cpus->map[cpu] >= CPU_SETSIZE)
  357. continue;
  358. if (perf_evsel__read_on_cpu(evsel, cpu, 0) < 0) {
  359. pr_debug("perf_evsel__open_read_on_cpu\n");
  360. err = -1;
  361. break;
  362. }
  363. expected = nr_open_calls + cpu;
  364. if (evsel->counts->cpu[cpu].val != expected) {
  365. pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %" PRIu64 "\n",
  366. expected, cpus->map[cpu], evsel->counts->cpu[cpu].val);
  367. err = -1;
  368. }
  369. }
  370. out_close_fd:
  371. perf_evsel__close_fd(evsel, 1, threads->nr);
  372. out_evsel_delete:
  373. perf_evsel__delete(evsel);
  374. out_thread_map_delete:
  375. thread_map__delete(threads);
  376. return err;
  377. }
  378. /*
  379. * This test will generate random numbers of calls to some getpid syscalls,
  380. * then establish an mmap for a group of events that are created to monitor
  381. * the syscalls.
  382. *
  383. * It will receive the events, using mmap, use its PERF_SAMPLE_ID generated
  384. * sample.id field to map back to its respective perf_evsel instance.
  385. *
  386. * Then it checks if the number of syscalls reported as perf events by
  387. * the kernel corresponds to the number of syscalls made.
  388. */
  389. static int test__basic_mmap(void)
  390. {
  391. int err = -1;
  392. event_t *event;
  393. struct thread_map *threads;
  394. struct perf_session session;
  395. struct cpu_map *cpus;
  396. struct perf_evlist *evlist;
  397. struct perf_event_attr attr = {
  398. .type = PERF_TYPE_TRACEPOINT,
  399. .read_format = PERF_FORMAT_ID,
  400. .sample_type = PERF_SAMPLE_ID,
  401. .watermark = 0,
  402. };
  403. cpu_set_t cpu_set;
  404. const char *syscall_names[] = { "getsid", "getppid", "getpgrp",
  405. "getpgid", };
  406. pid_t (*syscalls[])(void) = { (void *)getsid, getppid, getpgrp,
  407. (void*)getpgid };
  408. #define nsyscalls ARRAY_SIZE(syscall_names)
  409. int ids[nsyscalls];
  410. unsigned int nr_events[nsyscalls],
  411. expected_nr_events[nsyscalls], i, j;
  412. struct perf_evsel *evsels[nsyscalls], *evsel;
  413. for (i = 0; i < nsyscalls; ++i) {
  414. char name[64];
  415. snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]);
  416. ids[i] = trace_event__id(name);
  417. if (ids[i] < 0) {
  418. pr_debug("Is debugfs mounted on /sys/kernel/debug?\n");
  419. return -1;
  420. }
  421. nr_events[i] = 0;
  422. expected_nr_events[i] = random() % 257;
  423. }
  424. threads = thread_map__new(-1, getpid());
  425. if (threads == NULL) {
  426. pr_debug("thread_map__new\n");
  427. return -1;
  428. }
  429. cpus = cpu_map__new(NULL);
  430. if (threads == NULL) {
  431. pr_debug("thread_map__new\n");
  432. goto out_free_threads;
  433. }
  434. CPU_ZERO(&cpu_set);
  435. CPU_SET(cpus->map[0], &cpu_set);
  436. sched_setaffinity(0, sizeof(cpu_set), &cpu_set);
  437. if (sched_setaffinity(0, sizeof(cpu_set), &cpu_set) < 0) {
  438. pr_debug("sched_setaffinity() failed on CPU %d: %s ",
  439. cpus->map[0], strerror(errno));
  440. goto out_free_cpus;
  441. }
  442. evlist = perf_evlist__new();
  443. if (threads == NULL) {
  444. pr_debug("perf_evlist__new\n");
  445. goto out_free_cpus;
  446. }
  447. /* anonymous union fields, can't be initialized above */
  448. attr.wakeup_events = 1;
  449. attr.sample_period = 1;
  450. /*
  451. * FIXME: use evsel->attr.sample_type in event__parse_sample.
  452. * This will nicely remove the requirement that we have
  453. * all the events with the same sample_type.
  454. */
  455. session.sample_type = attr.sample_type;
  456. for (i = 0; i < nsyscalls; ++i) {
  457. attr.config = ids[i];
  458. evsels[i] = perf_evsel__new(&attr, i);
  459. if (evsels[i] == NULL) {
  460. pr_debug("perf_evsel__new\n");
  461. goto out_free_evlist;
  462. }
  463. perf_evlist__add(evlist, evsels[i]);
  464. if (perf_evsel__open(evsels[i], cpus, threads, false, false) < 0) {
  465. pr_debug("failed to open counter: %s, "
  466. "tweak /proc/sys/kernel/perf_event_paranoid?\n",
  467. strerror(errno));
  468. goto out_close_fd;
  469. }
  470. }
  471. if (perf_evlist__mmap(evlist, cpus, threads, 128, true) < 0) {
  472. pr_debug("failed to mmap events: %d (%s)\n", errno,
  473. strerror(errno));
  474. goto out_close_fd;
  475. }
  476. for (i = 0; i < nsyscalls; ++i)
  477. for (j = 0; j < expected_nr_events[i]; ++j) {
  478. int foo = syscalls[i]();
  479. ++foo;
  480. }
  481. while ((event = perf_evlist__read_on_cpu(evlist, 0)) != NULL) {
  482. struct sample_data sample;
  483. if (event->header.type != PERF_RECORD_SAMPLE) {
  484. pr_debug("unexpected %s event\n",
  485. event__get_event_name(event->header.type));
  486. goto out_munmap;
  487. }
  488. event__parse_sample(event, &session, &sample);
  489. evsel = perf_evlist__id2evsel(evlist, sample.id);
  490. if (evsel == NULL) {
  491. pr_debug("event with id %" PRIu64
  492. " doesn't map to an evsel\n", sample.id);
  493. goto out_munmap;
  494. }
  495. nr_events[evsel->idx]++;
  496. }
  497. list_for_each_entry(evsel, &evlist->entries, node) {
  498. if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) {
  499. pr_debug("expected %d %s events, got %d\n",
  500. expected_nr_events[evsel->idx],
  501. event_name(evsel), nr_events[evsel->idx]);
  502. goto out_munmap;
  503. }
  504. }
  505. err = 0;
  506. out_munmap:
  507. perf_evlist__munmap(evlist, 1);
  508. out_close_fd:
  509. for (i = 0; i < nsyscalls; ++i)
  510. perf_evsel__close_fd(evsels[i], 1, threads->nr);
  511. out_free_evlist:
  512. perf_evlist__delete(evlist);
  513. out_free_cpus:
  514. cpu_map__delete(cpus);
  515. out_free_threads:
  516. thread_map__delete(threads);
  517. return err;
  518. #undef nsyscalls
  519. }
  520. static struct test {
  521. const char *desc;
  522. int (*func)(void);
  523. } tests[] = {
  524. {
  525. .desc = "vmlinux symtab matches kallsyms",
  526. .func = test__vmlinux_matches_kallsyms,
  527. },
  528. {
  529. .desc = "detect open syscall event",
  530. .func = test__open_syscall_event,
  531. },
  532. {
  533. .desc = "detect open syscall event on all cpus",
  534. .func = test__open_syscall_event_on_all_cpus,
  535. },
  536. {
  537. .desc = "read samples using the mmap interface",
  538. .func = test__basic_mmap,
  539. },
  540. {
  541. .func = NULL,
  542. },
  543. };
  544. static int __cmd_test(void)
  545. {
  546. int i = 0;
  547. page_size = sysconf(_SC_PAGE_SIZE);
  548. while (tests[i].func) {
  549. int err;
  550. pr_info("%2d: %s:", i + 1, tests[i].desc);
  551. pr_debug("\n--- start ---\n");
  552. err = tests[i].func();
  553. pr_debug("---- end ----\n%s:", tests[i].desc);
  554. pr_info(" %s\n", err ? "FAILED!\n" : "Ok");
  555. ++i;
  556. }
  557. return 0;
  558. }
  559. static const char * const test_usage[] = {
  560. "perf test [<options>]",
  561. NULL,
  562. };
  563. static const struct option test_options[] = {
  564. OPT_INTEGER('v', "verbose", &verbose,
  565. "be more verbose (show symbol address, etc)"),
  566. OPT_END()
  567. };
  568. int cmd_test(int argc, const char **argv, const char *prefix __used)
  569. {
  570. argc = parse_options(argc, argv, test_options, test_usage, 0);
  571. if (argc)
  572. usage_with_options(test_usage, test_options);
  573. symbol_conf.priv_size = sizeof(int);
  574. symbol_conf.sort_by_name = true;
  575. symbol_conf.try_vmlinux_path = true;
  576. if (symbol__init() < 0)
  577. return -1;
  578. setup_pager();
  579. return __cmd_test();
  580. }