builtin-test.c 16 KB

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