From 629bddbe0991820ce8d897d17628a5a7826f9774 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Fri, 25 Oct 2024 00:01:32 +0900 Subject: [PATCH 1/2] Meson: extract benchmark langage objects correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Close #4100 Suggested by Jiří Techet (@techee)。 Signed-off-by: Masatake YAMATO --- Units/parser-meson.r/simple-meson.d/README | 1 - .../simple-meson.d/expected.tags | 8 ++++++++ .../simple-meson.d/input-5.meson | 19 +++++++++++++++++++ optlib/meson.c | 8 ++++---- optlib/meson.ctags | 2 +- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 Units/parser-meson.r/simple-meson.d/input-5.meson diff --git a/Units/parser-meson.r/simple-meson.d/README b/Units/parser-meson.r/simple-meson.d/README index 8fbe59c391..0b0ecff4ed 100644 --- a/Units/parser-meson.r/simple-meson.d/README +++ b/Units/parser-meson.r/simple-meson.d/README @@ -1,2 +1 @@ -* bench_mark target is not tested. * alias_target is not tested. diff --git a/Units/parser-meson.r/simple-meson.d/expected.tags b/Units/parser-meson.r/simple-meson.d/expected.tags index a103bf7751..b6f13366e0 100644 --- a/Units/parser-meson.r/simple-meson.d/expected.tags +++ b/Units/parser-meson.r/simple-meson.d/expected.tags @@ -23,3 +23,11 @@ outfile input-3.meson /^outfile = 'output.bin'$/;" variable mytarget input-3.meson /^mytarget = custom_target('targetname',$/;" variable targetname input-3.meson /^mytarget = custom_target('targetname',$/;" custom inspector input-4.meson /^run_target('inspector',$/;" run +test_kwargs input-5.meson /^test_kwargs = {$/;" variable +bench_connect input-5.meson /^bench_connect = executable('bench-connect', sources: ['bench-connect.c'], kwargs: test_kwargs)$/;" variable +bench-connect input-5.meson /^bench_connect = executable('bench-connect', sources: ['bench-connect.c'], kwargs: test_kwargs)$/;" build +bench_message input-5.meson /^bench_message = executable('bench-message', sources: ['bench-message.c'], kwargs: test_kwargs)$/;" variable +bench-message input-5.meson /^bench_message = executable('bench-message', sources: ['bench-message.c'], kwargs: test_kwargs)$/;" build +suites input-5.meson /^suites = [$/;" variable +Connection input-5.meson /^ benchmark('Connection', bench_connect, timeout: 60, kwargs: suite)$/;" benchmark +Message passing input-5.meson /^ benchmark('Message passing', bench_message, timeout: 120, kwargs: suite)$/;" benchmark diff --git a/Units/parser-meson.r/simple-meson.d/input-5.meson b/Units/parser-meson.r/simple-meson.d/input-5.meson new file mode 100644 index 0000000000..802a3899ff --- /dev/null +++ b/Units/parser-meson.r/simple-meson.d/input-5.meson @@ -0,0 +1,19 @@ +# -*- Meson -*- +# Derrived from test/dbus/meson.build of dbus-broker +test_kwargs = { + 'dependencies': [dep_test], + 'install': use_tests, + 'install_dir': conf.get('testdir') / 'dbus', +} + +bench_connect = executable('bench-connect', sources: ['bench-connect.c'], kwargs: test_kwargs) +bench_message = executable('bench-message', sources: ['bench-message.c'], kwargs: test_kwargs) + +suites = [ + { 'suite': 'dbus-broker', 'env': ['DBUS_BROKER_TEST_BROKER=' + exe_dbus_broker.full_path()]}, +] + +foreach suite : suites + benchmark('Connection', bench_connect, timeout: 60, kwargs: suite) + benchmark('Message passing', bench_message, timeout: 120, kwargs: suite) +endforeach diff --git a/optlib/meson.c b/optlib/meson.c index 88011aead4..5b2c352196 100644 --- a/optlib/meson.c +++ b/optlib/meson.c @@ -44,7 +44,7 @@ static void initializeMesonParser (const langType language) "^(alias|run)_target[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\2", "r", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "main", - "^bench_mark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", + "^benchmark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\1", "b", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "main", "^import[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", @@ -113,7 +113,7 @@ static void initializeMesonParser (const langType language) "^(alias|run)_target[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\2", "r", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "skipPair", - "^bench_mark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", + "^benchmark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\1", "b", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "skipPair", "^import[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", @@ -149,7 +149,7 @@ static void initializeMesonParser (const langType language) "^(alias|run)_target[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\2", "r", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "common", - "^bench_mark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", + "^benchmark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\1", "b", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "common", "^import[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", @@ -179,7 +179,7 @@ static void initializeMesonParser (const langType language) "^(alias|run)_target[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\2", "r", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "skipToArgEnd", - "^bench_mark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", + "^benchmark[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", "\\1", "b", "{tenter=skipToArgEnd}", NULL); addLanguageTagMultiTableRegex (language, "skipToArgEnd", "^import[ \t\n]*\\([ \t\n]*'([^']*[^\\\\])'[ \t\n]*", diff --git a/optlib/meson.ctags b/optlib/meson.ctags index 680155cb3d..1445362110 100644 --- a/optlib/meson.ctags +++ b/optlib/meson.ctags @@ -66,7 +66,7 @@ --_mtable-regex-Meson=common/(jar|executable|shared_module|(both_|shared_|static_)?library)[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\3/B/{tenter=skipToArgEnd} --_mtable-regex-Meson=common/custom_target[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\1/c/{tenter=skipToArgEnd} --_mtable-regex-Meson=common/(alias|run)_target[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\2/r/{tenter=skipToArgEnd} ---_mtable-regex-Meson=common/bench_mark[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\1/b/{tenter=skipToArgEnd} +--_mtable-regex-Meson=common/benchmark[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\1/b/{tenter=skipToArgEnd} --_mtable-regex-Meson=common/import[ \t\n]*\([ \t\n]*'([^']*[^\\])'[ \t\n]*/\1/m/{tenter=skipToArgEnd}{_role=imported} --_mtable-extend-Meson=skipPair+common From e41c5a8f4439f3b183f64b06a9843de04301aa3c Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Fri, 25 Oct 2024 00:06:18 +0900 Subject: [PATCH 2/2] Units(Meson): add a case for extracting alias_target as a run target Signed-off-by: Masatake YAMATO --- Units/parser-meson.r/simple-meson.d/README | 1 - Units/parser-meson.r/simple-meson.d/expected.tags | 4 ++++ Units/parser-meson.r/simple-meson.d/input-6.meson | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) delete mode 100644 Units/parser-meson.r/simple-meson.d/README create mode 100644 Units/parser-meson.r/simple-meson.d/input-6.meson diff --git a/Units/parser-meson.r/simple-meson.d/README b/Units/parser-meson.r/simple-meson.d/README deleted file mode 100644 index 0b0ecff4ed..0000000000 --- a/Units/parser-meson.r/simple-meson.d/README +++ /dev/null @@ -1 +0,0 @@ -* alias_target is not tested. diff --git a/Units/parser-meson.r/simple-meson.d/expected.tags b/Units/parser-meson.r/simple-meson.d/expected.tags index b6f13366e0..533a615a5b 100644 --- a/Units/parser-meson.r/simple-meson.d/expected.tags +++ b/Units/parser-meson.r/simple-meson.d/expected.tags @@ -31,3 +31,7 @@ bench-message input-5.meson /^bench_message = executable('bench-message', source suites input-5.meson /^suites = [$/;" variable Connection input-5.meson /^ benchmark('Connection', bench_connect, timeout: 60, kwargs: suite)$/;" benchmark Message passing input-5.meson /^ benchmark('Message passing', bench_message, timeout: 120, kwargs: suite)$/;" benchmark +gi_docgen input-6.meson /^gi_docgen = find_program('gi-docgen')$/;" variable +gck input-6.meson /^subdir('gck')$/;" subdir +gcr input-6.meson /^subdir('gcr')$/;" subdir +docs input-6.meson /^alias_target('docs',$/;" run diff --git a/Units/parser-meson.r/simple-meson.d/input-6.meson b/Units/parser-meson.r/simple-meson.d/input-6.meson new file mode 100644 index 0000000000..16e967e21e --- /dev/null +++ b/Units/parser-meson.r/simple-meson.d/input-6.meson @@ -0,0 +1,13 @@ +# -*- Meson -*- +# Taken from docs/meson.build of gcr +# +gi_docgen = find_program('gi-docgen') + +subdir('gck') +subdir('gcr') + +# Create a pseudo target that build all docs at once +alias_target('docs', + gck_docs, + gcr_docs, +)