mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
075167363f
Add a simple expression parser good enough to parse JSON relation expressions. The parser is implemented using bison. This is just intended as an simple parser for internal usage in the event lists, not the beginning of a "perf scripting language" v2: Use expr__ prefix instead of expr_ Support multiple free variables for parser Committer note: The v2 patch had: %define api.pure full In expr.y, that is a feature introduced in bison 2.7, to have reentrant parsers, not using global variables, which would make tools/perf stop building with the bison version shipped in older distros, so Andi realised that the other parsers (e.g. parse-events.y) were using: %pure-parser Which is present in older versions of bison and fits the bill. I added: CFLAGS_expr-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w To finally make it build, copying what was there for pmu-bison.o, another parser. Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/20170320201711.14142-8-andi@firstfloor.org [ stdlib.h is needed in tests/expr.c for free() fixing build in systems such as ubuntu:16.04-x-s390 ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
111 lines
3.3 KiB
C
111 lines
3.3 KiB
C
#ifndef TESTS_H
|
|
#define TESTS_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#define TEST_ASSERT_VAL(text, cond) \
|
|
do { \
|
|
if (!(cond)) { \
|
|
pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
|
|
return -1; \
|
|
} \
|
|
} while (0)
|
|
|
|
#define TEST_ASSERT_EQUAL(text, val, expected) \
|
|
do { \
|
|
if (val != expected) { \
|
|
pr_debug("FAILED %s:%d %s (%d != %d)\n", \
|
|
__FILE__, __LINE__, text, val, expected); \
|
|
return -1; \
|
|
} \
|
|
} while (0)
|
|
|
|
enum {
|
|
TEST_OK = 0,
|
|
TEST_FAIL = -1,
|
|
TEST_SKIP = -2,
|
|
};
|
|
|
|
struct test {
|
|
const char *desc;
|
|
int (*func)(int subtest);
|
|
struct {
|
|
bool skip_if_fail;
|
|
int (*get_nr)(void);
|
|
const char *(*get_desc)(int subtest);
|
|
} subtest;
|
|
};
|
|
|
|
/* Tests */
|
|
int test__vmlinux_matches_kallsyms(int subtest);
|
|
int test__openat_syscall_event(int subtest);
|
|
int test__openat_syscall_event_on_all_cpus(int subtest);
|
|
int test__basic_mmap(int subtest);
|
|
int test__PERF_RECORD(int subtest);
|
|
int test__perf_evsel__roundtrip_name_test(int subtest);
|
|
int test__perf_evsel__tp_sched_test(int subtest);
|
|
int test__syscall_openat_tp_fields(int subtest);
|
|
int test__pmu(int subtest);
|
|
int test__attr(int subtest);
|
|
int test__dso_data(int subtest);
|
|
int test__dso_data_cache(int subtest);
|
|
int test__dso_data_reopen(int subtest);
|
|
int test__parse_events(int subtest);
|
|
int test__hists_link(int subtest);
|
|
int test__python_use(int subtest);
|
|
int test__bp_signal(int subtest);
|
|
int test__bp_signal_overflow(int subtest);
|
|
int test__task_exit(int subtest);
|
|
int test__sw_clock_freq(int subtest);
|
|
int test__code_reading(int subtest);
|
|
int test__sample_parsing(int subtest);
|
|
int test__keep_tracking(int subtest);
|
|
int test__parse_no_sample_id_all(int subtest);
|
|
int test__dwarf_unwind(int subtest);
|
|
int test__expr(int subtest);
|
|
int test__hists_filter(int subtest);
|
|
int test__mmap_thread_lookup(int subtest);
|
|
int test__thread_mg_share(int subtest);
|
|
int test__hists_output(int subtest);
|
|
int test__hists_cumulate(int subtest);
|
|
int test__switch_tracking(int subtest);
|
|
int test__fdarray__filter(int subtest);
|
|
int test__fdarray__add(int subtest);
|
|
int test__kmod_path__parse(int subtest);
|
|
int test__thread_map(int subtest);
|
|
int test__llvm(int subtest);
|
|
const char *test__llvm_subtest_get_desc(int subtest);
|
|
int test__llvm_subtest_get_nr(void);
|
|
int test__bpf(int subtest);
|
|
const char *test__bpf_subtest_get_desc(int subtest);
|
|
int test__bpf_subtest_get_nr(void);
|
|
int test_session_topology(int subtest);
|
|
int test__thread_map_synthesize(int subtest);
|
|
int test__thread_map_remove(int subtest);
|
|
int test__cpu_map_synthesize(int subtest);
|
|
int test__synthesize_stat_config(int subtest);
|
|
int test__synthesize_stat(int subtest);
|
|
int test__synthesize_stat_round(int subtest);
|
|
int test__event_update(int subtest);
|
|
int test__event_times(int subtest);
|
|
int test__backward_ring_buffer(int subtest);
|
|
int test__cpu_map_print(int subtest);
|
|
int test__sdt_event(int subtest);
|
|
int test__is_printable_array(int subtest);
|
|
int test__bitmap_print(int subtest);
|
|
int test__perf_hooks(int subtest);
|
|
int test__clang(int subtest);
|
|
const char *test__clang_subtest_get_desc(int subtest);
|
|
int test__clang_subtest_get_nr(void);
|
|
int test__unit_number__scnprint(int subtest);
|
|
|
|
#if defined(__arm__) || defined(__aarch64__)
|
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
|
struct thread;
|
|
struct perf_sample;
|
|
int test__arch_unwind_sample(struct perf_sample *sample,
|
|
struct thread *thread);
|
|
#endif
|
|
#endif
|
|
#endif /* TESTS_H */
|