This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=22ddf9c9f6c27c9639a5e4daa43551b4f37a16eb

commit 22ddf9c9f6c27c9639a5e4daa43551b4f37a16eb
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Oct 10 00:08:19 2018 +0200

    test: Add new shellcheck author test
---
 .gitlab-ci.yml           |  2 +-
 Makefile.am              |  1 +
 README                   |  1 +
 debian/changelog         |  2 ++
 t/{po.t => shellcheck.t} | 39 +++++++++++++++++++++++++++++----------
 5 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b3d16f608..20368a2e2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,7 +22,7 @@ unit-tests:
   stage: test
   script:
     - eatmydata apt install -qq -y --no-install-recommends
-      fakeroot gpg cppcheck aspell aspell-en codespell i18nspector
+      fakeroot gpg cppcheck shellcheck aspell aspell-en codespell i18nspector
       libtest-strict-perl libtest-minimumversion-perl libtest-perl-critic-perl
       libtest-pod-perl libtest-pod-coverage-perl libtest-spelling-perl
       libtest-synopsis-perl
diff --git a/Makefile.am b/Makefile.am
index cf78ed8ce..8d9c1cba4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -161,6 +161,7 @@ test_scripts = \
        t/strict.t \
        t/critic.t \
        t/codespell.t \
+       t/shellcheck.t \
        t/cppcheck.t \
        $(nil)
 
diff --git a/README b/README
index fd24d0097..1283653ff 100644
--- a/README
+++ b/README
@@ -93,6 +93,7 @@ To run the test suite («make check»):
   fakeroot (optional)
   gpg (optional)
   i18nspector (optional, author)
+  shellcheck (optional, author)
 
   Define the environment variable DPKG_DEVEL_MODE or AUTHOR_TESTING to run
   the test suite in development mode, to include tests that might not be
diff --git a/debian/changelog b/debian/changelog
index 495949961..ec6605f90 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,8 @@ dpkg (1.19.3) UNRELEASED; urgency=medium
     - run-script: Add «set -e».
     - Build.PL: Set environment variables only for CPAN tests.
     - Build.PL: Set locale for CPAN tests to C. Foxes CPAN#127314.
+  * Test suite:
+    - Add new shellcheck author test.
 
   [ Updated programs translations ]
   * German (Sven Joachim).
diff --git a/t/po.t b/t/shellcheck.t
similarity index 58%
copy from t/po.t
copy to t/shellcheck.t
index ce48395eb..e067345bc 100644
--- a/t/po.t
+++ b/t/shellcheck.t
@@ -20,32 +20,51 @@ use Test::More;
 use Test::Dpkg qw(:needs);
 
 test_needs_author();
-test_needs_command('i18nspector');
+test_needs_command('shellcheck');
 test_needs_srcdir_switch();
 
-my @files = Test::Dpkg::all_po_files();
+my @todofiles = qw(
+    dselect/methods/disk/install
+    dselect/methods/disk/setup
+    dselect/methods/disk/update
+    dselect/methods/multicd/install
+    dselect/methods/multicd/setup
+    dselect/methods/multicd/update
+);
+my @files = qw(
+    autogen
+    get-version
+    run-script
+    debian/dpkg.cron.daily
+    debian/dpkg.postinst
+    debian/dpkg.postrm
+    scripts/dpkg-maintscript-helper.sh
+);
+my @shellcheck_opts = (qw(
+    --exclude=SC2039
+    --exclude=SC2166
+    --exclude=SC2034
+));
 
-plan skip_all => 'no PO files distributed' if @files == 0;
 plan tests => scalar @files;
 
-sub po_ok {
+sub shell_syntax_ok
+{
     my $file = shift;
 
-    my $tags = qx(i18nspector \"$file\" 2>&1);
+    my $tags = qx(shellcheck @shellcheck_opts $file 2>&1);
 
     # Fixup the output:
-    $tags =~ s/^.*\.pot: boilerplate-in-initial-comments .*\n//mg;
-    $tags =~ s/^.*\.po: duplicate-header-field X-POFile-SpellExtra\n//mg;
     chomp $tags;
 
     my $ok = length $tags == 0;
 
-    ok($ok, "PO check $file");
+    ok($ok, 'shellcheck');
     if (not $ok) {
         diag($tags);
     }
 }
 
-for my $file (@files) {
-    po_ok($file);
+foreach my $file (@files) {
+    shell_syntax_ok($file);
 }

-- 
Dpkg.Org's dpkg

Reply via email to