mirror of https://github.com/nirenjan/libx52.git
fix(pinelog): Mark benchmark tests as such in Meson
Prior to this change, the pinelog benchmark suite was running as a regular test, however, this is not ideal since it can result in timing issues and giving false data to the runners. This change explicitly marks them as benchmarks, so they can run using `meson test --benchmark`pull/64/head
parent
a1098bc134
commit
b626a9367f
|
|
@ -21,10 +21,8 @@ level_class = ['nolvl', 'lvl']
|
||||||
backtrace_class = ['notr', 'tr']
|
backtrace_class = ['notr', 'tr']
|
||||||
|
|
||||||
test_files = []
|
test_files = []
|
||||||
test_name_template = '@0@-@1@-@2@-@3@'
|
test_name_template = '-@0@-@1@-@2@'
|
||||||
foreach test_type: ['bench', 'test']
|
foreach date_arg: [0, 1]
|
||||||
test_src = test_type + '_pinelog.c'
|
|
||||||
foreach date_arg: [0, 1]
|
|
||||||
date_def = '-DPINELOG_SHOW_DATE=' + date_arg.to_string()
|
date_def = '-DPINELOG_SHOW_DATE=' + date_arg.to_string()
|
||||||
date_name = date_arg == 1 ? 'ts' : 'nots'
|
date_name = date_arg == 1 ? 'ts' : 'nots'
|
||||||
|
|
||||||
|
|
@ -36,10 +34,7 @@ foreach test_type: ['bench', 'test']
|
||||||
backtrace_def = '-DPINELOG_SHOW_BACKTRACE=' + backtrace_arg.to_string()
|
backtrace_def = '-DPINELOG_SHOW_BACKTRACE=' + backtrace_arg.to_string()
|
||||||
backtrace_name = backtrace_arg == 1 ? 'tr' : 'notr'
|
backtrace_name = backtrace_arg == 1 ? 'tr' : 'notr'
|
||||||
|
|
||||||
test_name = test_name_template.format(test_type,
|
c_args = [
|
||||||
date_name, level_name, backtrace_name)
|
|
||||||
test_exe = executable(test_name, test_src, 'pinelog.c',
|
|
||||||
c_args: [
|
|
||||||
'-DPINELOG_FATAL_STR="F"',
|
'-DPINELOG_FATAL_STR="F"',
|
||||||
'-DPINELOG_ERROR_STR="E"',
|
'-DPINELOG_ERROR_STR="E"',
|
||||||
'-DPINELOG_WARNING_STR="W"',
|
'-DPINELOG_WARNING_STR="W"',
|
||||||
|
|
@ -50,10 +45,17 @@ foreach test_type: ['bench', 'test']
|
||||||
'-DPINELOG_DEFAULT_STREAM=stderr',
|
'-DPINELOG_DEFAULT_STREAM=stderr',
|
||||||
'-DPINELOG_TEST',
|
'-DPINELOG_TEST',
|
||||||
date_def, level_def, backtrace_def
|
date_def, level_def, backtrace_def
|
||||||
])
|
]
|
||||||
|
test_name = test_name_template.format(
|
||||||
|
date_name, level_name, backtrace_name)
|
||||||
|
|
||||||
test(test_name, test_exe, protocol: 'tap')
|
test_exe = executable('test' + test_name, 'test_pinelog.c', 'pinelog.c',
|
||||||
endforeach
|
c_args: c_args)
|
||||||
|
test('test' + test_name, test_exe, protocol: 'tap')
|
||||||
|
|
||||||
|
bench_exe = executable('bench' + test_name, 'bench_pinelog.c', 'pinelog.c',
|
||||||
|
c_args: c_args)
|
||||||
|
benchmark('bench' + test_name, bench_exe, protocol: 'tap')
|
||||||
endforeach
|
endforeach
|
||||||
endforeach
|
endforeach
|
||||||
endforeach
|
endforeach
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue