From ff58ec8cefcb7ccf5b9a37b2f4763bb610f7cc64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 18 Jan 2021 14:57:47 +0100 Subject: [PATCH] Flag missing pairwise testing markers Make the Danger GitLab CI job fail when a merge request adds a new ./configure switch without also adding a "# [pairwise: ...]" marker that the relevant GitLab CI job uses for preparing the pairwise testing model. This helps to ensure that any newly added ./configure switches are tested by the pairwise testing GitLab CI job. --- dangerfile.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dangerfile.py b/dangerfile.py index df1ae1a8e1..7cec7162cc 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -238,3 +238,18 @@ if lines_containing(changes_added_lines, '[security]'): if not lines_containing(notes_added_lines, 'CVE-20'): fail('This merge request fixes a security issue. ' 'Please add a release note which includes a CVE identifier.') + +############################################################################### +# PAIRWISE TESTING +############################################################################### +# +# FAIL if the merge request adds any new ./configure switch without an +# associated annotation used for pairwise testing. + +configure_added_lines = added_lines(target_branch, ['configure.ac']) +switches_added = (lines_containing(configure_added_lines, 'AC_ARG_ENABLE') + + lines_containing(configure_added_lines, 'AC_ARG_WITH')) +annotations_added = lines_containing(configure_added_lines, '# [pairwise: ') +if len(switches_added) > len(annotations_added): + fail('This merge request adds at least one new `./configure` switch that ' + 'is not annotated for pairwise testing purposes.')