87 lines
3.1 KiB
Python
87 lines
3.1 KiB
Python
|
|
import pytest
|
|
|
|
from xbc import load_xbc
|
|
|
|
def test_01():
|
|
d = {
|
|
'feature.option': False,
|
|
'feature': False,
|
|
'feature.option.foo': '1',
|
|
'feature.option.bar': '2'
|
|
}
|
|
assert load_xbc('tests/01-keyvalue.xbc') == d
|
|
|
|
def test_02():
|
|
d = {
|
|
'feature.option': False,
|
|
'feature': False,
|
|
'feature.option.foo': '1',
|
|
'feature.option.bar': '2'
|
|
}
|
|
assert load_xbc('tests/02-block-keyvalue.xbc') == d
|
|
|
|
def test_03():
|
|
d = {
|
|
'feature': False,
|
|
'feature.options': ['foo', 'bar']
|
|
}
|
|
assert load_xbc('tests/03-keyvalue-string.xbc') == d
|
|
|
|
def test_10():
|
|
d = {
|
|
'feature.option': False,
|
|
'feature': False,
|
|
'feature.option.foo': '1',
|
|
'feature.option.bar': '2'
|
|
}
|
|
assert load_xbc('tests/10-compact.xbc') == d
|
|
|
|
def test_11():
|
|
d = {
|
|
'ftrace': False,
|
|
'ftrace.event': False,
|
|
'ftrace.event.task': False,
|
|
'ftrace.event.task.task_newtask': False,
|
|
'ftrace.event.task.task_newtask.filter': "pid < 128",
|
|
'ftrace.event.task.task_newtask.enable': True,
|
|
'ftrace.event.kprobes': False,
|
|
'ftrace.event.kprobes.vfs_read': False,
|
|
'ftrace.event.kprobes.vfs_read.probes': "vfs_read $arg1 $arg2",
|
|
'ftrace.event.kprobes.vfs_read.filter': "common_pid < 200",
|
|
'ftrace.event.kprobes.vfs_read.enable': True,
|
|
'ftrace.event.synthetic': False,
|
|
'ftrace.event.synthetic.initcall_latency': False,
|
|
'ftrace.event.synthetic.initcall_latency.fields': ["unsigned long func", "u64 lat"],
|
|
'ftrace.event.synthetic.initcall_latency.actions': "hist:keys=func.sym,lat:vals=lat:sort=lat",
|
|
'ftrace.event.initcall': False,
|
|
'ftrace.event.initcall.initcall_start': False,
|
|
'ftrace.event.initcall.initcall_start.actions': "hist:keys=func:ts0=common_timestamp.usecs",
|
|
'ftrace.event.initcall.initcall_finish': False,
|
|
'ftrace.event.initcall.initcall_finish.actions': "hist:keys=func:lat=common_timestamp.usecs-$ts0:onmatch(initcall.initcall_start).initcall_latency(func,$lat)"
|
|
}
|
|
assert load_xbc('tests/11-config.xbc') == d
|
|
|
|
def test_12():
|
|
d = {
|
|
'ftrace': False,
|
|
'ftrace.event': False,
|
|
'ftrace.event.synthetic': False,
|
|
'ftrace.event.synthetic.initcall_latency': False,
|
|
'ftrace.event.synthetic.initcall_latency.fields': ["unsigned long func", "u64 lat"],
|
|
'ftrace.event.synthetic.initcall_latency.hist': False,
|
|
'ftrace.event.synthetic.initcall_latency.hist.from': False,
|
|
'ftrace.event.synthetic.initcall_latency.hist.from.event': 'initcall.initcall_start',
|
|
'ftrace.event.synthetic.initcall_latency.hist.from.key': 'func',
|
|
'ftrace.event.synthetic.initcall_latency.hist.from.assigns': "ts0=common_timestamp.usecs",
|
|
'ftrace.event.synthetic.initcall_latency.hist.to': False,
|
|
'ftrace.event.synthetic.initcall_latency.hist.to.event': 'initcall.initcall_finish',
|
|
'ftrace.event.synthetic.initcall_latency.hist.to.key': 'func',
|
|
'ftrace.event.synthetic.initcall_latency.hist.to.assigns': "lat=common_timestamp.usecs-$ts0",
|
|
'ftrace.event.synthetic.initcall_latency.hist.to.onmatch': ['func', '$lat'],
|
|
'ftrace.event.synthetic.initcall_latency.hist.keys': ['func.sym', 'lat'],
|
|
'ftrace.event.synthetic.initcall_latency.hist.vals': 'lat',
|
|
'ftrace.event.synthetic.initcall_latency.hist.sort': 'lat'
|
|
}
|
|
assert load_xbc('tests/12-config2.xbc') == d
|