tests: stop using files
parent
090d5191f7
commit
38614aad08
|
@ -1 +0,0 @@
|
|||
include tests/*.xbc
|
|
@ -1,2 +0,0 @@
|
|||
feature.option.foo = 1
|
||||
feature.option.bar = 2
|
|
@ -1,4 +0,0 @@
|
|||
feature.option {
|
||||
foo = 1
|
||||
bar = 2
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
feature.options = "foo", "bar"
|
|
@ -1 +0,0 @@
|
|||
feature.option{foo=1;bar=2}
|
|
@ -1,21 +0,0 @@
|
|||
ftrace.event {
|
||||
task.task_newtask {
|
||||
filter = "pid < 128"
|
||||
enable
|
||||
}
|
||||
kprobes.vfs_read {
|
||||
probes = "vfs_read $arg1 $arg2"
|
||||
filter = "common_pid < 200"
|
||||
enable
|
||||
}
|
||||
synthetic.initcall_latency {
|
||||
fields = "unsigned long func", "u64 lat"
|
||||
actions = "hist:keys=func.sym,lat:vals=lat:sort=lat"
|
||||
}
|
||||
initcall.initcall_start {
|
||||
actions = "hist:keys=func:ts0=common_timestamp.usecs"
|
||||
}
|
||||
initcall.initcall_finish {
|
||||
actions = "hist:keys=func:lat=common_timestamp.usecs-$ts0:onmatch(initcall.initcall_start).initcall_latency(func,$lat)"
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
ftrace.event.synthetic.initcall_latency {
|
||||
fields = "unsigned long func", "u64 lat"
|
||||
hist {
|
||||
from {
|
||||
event = initcall.initcall_start
|
||||
key = func
|
||||
assigns = "ts0=common_timestamp.usecs"
|
||||
}
|
||||
to {
|
||||
event = initcall.initcall_finish
|
||||
key = func
|
||||
assigns = "lat=common_timestamp.usecs-$ts0"
|
||||
onmatch = func, $lat
|
||||
}
|
||||
keys = func.sym, lat
|
||||
vals = lat
|
||||
sort = lat
|
||||
}
|
||||
}
|
|
@ -1,43 +1,77 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from xbc import load_xbc
|
||||
from xbc import loads_xbc
|
||||
|
||||
'''
|
||||
The tests in this file are samples drawn from
|
||||
https://lwn.net/Articles/806002/.
|
||||
'''
|
||||
|
||||
def test_01():
|
||||
i = '''feature.option.foo = 1
|
||||
feature.option.bar = 2'''
|
||||
d = {
|
||||
'feature.option': False,
|
||||
'feature': False,
|
||||
'feature.option.foo': '1',
|
||||
'feature.option.bar': '2'
|
||||
}
|
||||
assert load_xbc('tests/01-keyvalue.xbc') == d
|
||||
assert loads_xbc(i) == d
|
||||
|
||||
def test_02():
|
||||
i = '''feature.option {
|
||||
foo = 1
|
||||
bar = 2
|
||||
}'''
|
||||
d = {
|
||||
'feature.option': False,
|
||||
'feature': False,
|
||||
'feature.option.foo': '1',
|
||||
'feature.option.bar': '2'
|
||||
}
|
||||
assert load_xbc('tests/02-block-keyvalue.xbc') == d
|
||||
assert loads_xbc(i) == d
|
||||
|
||||
def test_03():
|
||||
i = 'feature.options = "foo", "bar"'
|
||||
d = {
|
||||
'feature': False,
|
||||
'feature.options': ['foo', 'bar']
|
||||
}
|
||||
assert load_xbc('tests/03-keyvalue-string.xbc') == d
|
||||
assert loads_xbc(i) == d
|
||||
|
||||
def test_10():
|
||||
i = 'feature.option{foo=1;bar=2}'
|
||||
d = {
|
||||
'feature.option': False,
|
||||
'feature': False,
|
||||
'feature.option.foo': '1',
|
||||
'feature.option.bar': '2'
|
||||
}
|
||||
assert load_xbc('tests/10-compact.xbc') == d
|
||||
assert loads_xbc(i) == d
|
||||
|
||||
def test_11():
|
||||
i = '''ftrace.event {
|
||||
task.task_newtask {
|
||||
filter = "pid < 128"
|
||||
enable
|
||||
}
|
||||
kprobes.vfs_read {
|
||||
probes = "vfs_read $arg1 $arg2"
|
||||
filter = "common_pid < 200"
|
||||
enable
|
||||
}
|
||||
synthetic.initcall_latency {
|
||||
fields = "unsigned long func", "u64 lat"
|
||||
actions = "hist:keys=func.sym,lat:vals=lat:sort=lat"
|
||||
}
|
||||
initcall.initcall_start {
|
||||
actions = "hist:keys=func:ts0=common_timestamp.usecs"
|
||||
}
|
||||
initcall.initcall_finish {
|
||||
actions = "hist:keys=func:lat=common_timestamp.usecs-$ts0:onmatch(initcall.initcall_start).initcall_latency(func,$lat)"
|
||||
}
|
||||
}'''
|
||||
d = {
|
||||
'ftrace': False,
|
||||
'ftrace.event': False,
|
||||
|
@ -60,9 +94,28 @@ def test_11():
|
|||
'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
|
||||
assert loads_xbc(i) == d
|
||||
|
||||
def test_12():
|
||||
i = '''ftrace.event.synthetic.initcall_latency {
|
||||
fields = "unsigned long func", "u64 lat"
|
||||
hist {
|
||||
from {
|
||||
event = initcall.initcall_start
|
||||
key = func
|
||||
assigns = "ts0=common_timestamp.usecs"
|
||||
}
|
||||
to {
|
||||
event = initcall.initcall_finish
|
||||
key = func
|
||||
assigns = "lat=common_timestamp.usecs-$ts0"
|
||||
onmatch = func, $lat
|
||||
}
|
||||
keys = func.sym, lat
|
||||
vals = lat
|
||||
sort = lat
|
||||
}
|
||||
}'''
|
||||
d = {
|
||||
'ftrace': False,
|
||||
'ftrace.event': False,
|
||||
|
@ -83,4 +136,4 @@ def test_12():
|
|||
'ftrace.event.synthetic.initcall_latency.hist.vals': 'lat',
|
||||
'ftrace.event.synthetic.initcall_latency.hist.sort': 'lat'
|
||||
}
|
||||
assert load_xbc('tests/12-config2.xbc') == d
|
||||
assert loads_xbc(i) == d
|
Loading…
Reference in New Issue