Bug 8383 - Need test to check that Perl files will compile
Summary: Need test to check that Perl files will compile
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P1 - high normal (vote)
Target Milestone: ---
Assignee: Jared Camins-Esakov
QA Contact: Mason James
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-09 02:01 UTC by Jared Camins-Esakov
Modified: 2013-12-05 20:04 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 8383: Add test to check that Perl scripts compile (2.75 KB, patch)
2012-07-09 02:31 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8383: Add test to check that Perl scripts compile (2.92 KB, patch)
2012-07-09 11:46 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Signed-off patch (3.01 KB, patch)
2012-07-09 17:13 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 8383: Add test to check that Perl scripts (2.18 KB, patch)
2013-03-26 18:22 UTC, Mason James
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2012-07-09 02:01:10 UTC
We have t/00-load.t to make sure that C4 and Koha modules can be loaded, but right now there is no test to prevent the inclusion of a Perl script that does not compile in Koha. There should be one.
Comment 1 Jared Camins-Esakov 2012-07-09 02:31:28 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2012-07-09 02:57:03 UTC
I like it, except this does more than check they will compile.

eg
not ok 28 - Syntax check acqui/modordernotes.pl
#   Failed test 'Syntax check acqui/modordernotes.pl'
#   at /usr/share/perl5/Test/Strict.pm line 305.
# DBI connect('dbname=koha;host=localhost;port=3306','kohaadmin',...) failed: Access denied for user 'kohaadmin'@'localhost' (using password: YES) at C4/Context.pm line 758


Because they use C4::Context, to do a test like this we need a database, hence we need this script in t/db_dependent/
Comment 3 Jared Camins-Esakov 2012-07-09 11:46:05 UTC Comment hidden (obsolete)
Comment 4 Frédéric Demians 2012-07-09 17:13:45 UTC Comment hidden (obsolete)
Comment 5 Mason James 2012-07-09 20:26:54 UTC
(In reply to comment #4)
> Created attachment 10723 [details] [review]
> Signed-off patch

QA comment...

passing QA, patch applies and works perfect
Comment 6 Chris Cormack 2012-07-10 20:47:53 UTC
Very useful test, pushing to 3.8.x
Comment 7 Mason James 2013-03-26 18:15:13 UTC
(In reply to comment #6)
> Very useful test, pushing to 3.8.x

woops!, this patch missed out on getting pushed to master

Jared, i'll attach a rebased patch for master
Comment 8 Mason James 2013-03-26 18:22:11 UTC
Created attachment 16900 [details] [review]
Bug 8383: Add test to check that Perl scripts

This patch adds t/db_dependent/00-strict.pl which tests that all Perl
scripts compile. I chose to use Test::Strict so that in the future we
can also have the test check that "use strict" and "use warnings" are
enabled.

To test:
1. Run t/db_dependent/00-strict.pl.
2. Run around waving your arms in the air that we have a couple of
   scripts that don't compile.
3. Actually, that's about it. You could test my patch for bug 8384 next.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Moved test to t/db_dependent

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Comment 9 Mason James 2013-03-26 18:23:34 UTC
passing QA on this patch...
Comment 10 Jared Camins-Esakov 2013-03-28 02:09:37 UTC
This patch was pushed to master during the 3.10 release cycle.