mirror of https://github.com/nirenjan/pinelog.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`switch-to-meson
parent
8a5a431635
commit
05ecc7698e
24
meson.build
24
meson.build
|
|
@ -21,10 +21,8 @@ level_class = ['nolvl', 'lvl']
|
|||
backtrace_class = ['notr', 'tr']
|
||||
|
||||
test_files = []
|
||||
test_name_template = '@0@-@1@-@2@-@3@'
|
||||
foreach test_type: ['bench', 'test']
|
||||
test_src = test_type + '_pinelog.c'
|
||||
foreach date_arg: [0, 1]
|
||||
test_name_template = '-@0@-@1@-@2@'
|
||||
foreach date_arg: [0, 1]
|
||||
date_def = '-DPINELOG_SHOW_DATE=' + date_arg.to_string()
|
||||
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_name = backtrace_arg == 1 ? 'tr' : 'notr'
|
||||
|
||||
test_name = test_name_template.format(test_type,
|
||||
date_name, level_name, backtrace_name)
|
||||
test_exe = executable(test_name, test_src, 'pinelog.c',
|
||||
c_args: [
|
||||
c_args = [
|
||||
'-DPINELOG_FATAL_STR="F"',
|
||||
'-DPINELOG_ERROR_STR="E"',
|
||||
'-DPINELOG_WARNING_STR="W"',
|
||||
|
|
@ -50,10 +45,17 @@ foreach test_type: ['bench', 'test']
|
|||
'-DPINELOG_DEFAULT_STREAM=stderr',
|
||||
'-DPINELOG_TEST',
|
||||
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')
|
||||
endforeach
|
||||
test_exe = executable('test' + test_name, 'test_pinelog.c', 'pinelog.c',
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue