Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] [sympa-commits] sympa[10828] trunk/t/Language.t: [dev] no need to re-add standard @INC, but relative path for src/lib helps executing the tests manually

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] [sympa-commits] sympa[10828] trunk/t/Language.t: [dev] no need to re-add standard @INC, but relative path for src/lib helps executing the tests manually
  • Date: Fri, 6 Jun 2014 21:15:30 +0900

On Fri, 06 Jun 2014 10:46:31 +0200
Guillaume Rousse <address@concealed> wrote:

> Le 06/06/2014 09:10, IKEDA Soji a écrit :
> > Hi, please tell me...
> >
> > On Wed, 4 Jun 2014 17:28:26 +0200 (CEST)
> > address@concealed wrote:
> >
> >> sympa[10828] trunk/t/Language.t: [dev] no need to re-add standard @INC,
> >> but relative path for src/lib helps executing the tests manually
> >> Revision 10828 Author rousse Date 2014-06-04 17:28:25 +0200 (mer. 04
> >> juin 2014)
> >> Log Message[dev] no need to re-add standard @INC, but relative path for
> >> src/lib helps executing the tests manually
> >> Modified Paths
> >> trunk/t/Language.t
> >> Diff
> >> Modified: trunk/t/Language.t (10827 => 10828)
> >> --- trunk/t/Language.t 2014-06-04 13:14:25 UTC (rev 10827)
> >> +++ trunk/t/Language.t 2014-06-04 15:28:25 UTC (rev 10828)
> >> @@ -9,9 +9,12 @@
> >>
> >> use strict;
> >> use warnings;
> >> +
> >> +use FindBin qw($Bin);
> >> +use lib 't/stub', "$Bin/../src/lib";
> >> +
> >> use Test::More;
> >>
> >> -use lib 't/stub', @INC;
> >> use Sympa::Language;
> >>
> >> # Lang 2 gettext locale
> >
> > @INC was unneccessary. However, I have two questions:
> >
> > - Is arrangement by FindBin required?
> >
> > Is it possible that "make check" invokes test scripts from the
> > other location than the top of source? If it is not, lib list
> > can simply contain "src/lib".
> make check, no. Direct invocation, yes.

"make check" always invokes tests from top of source.
If it is true, direct invokation can be done from the same location.
Because operator knows where is the top of source.

> > - May each test script be executable? I mean that its executable
> > bit is on and it has sh-bang line.
> >
> > Sh-bang line fixes path of Perl interpreter. Developer may wish
> > to test with other Perl executables. I guess the script
> > itself should not have sh-bang and may not be executable.
> If you want to use another interpreter, just call it explicitely, and
> pass it the test script as an argument. Neither the sh-bang, nor the
> executable bit prevent you to do it

"make check" behaves as the same. Script have neither to be
executable nor to have sh-bang.

> > Additionally, if "make check" gives default module search path
> > using PERL5LIB enviroment variable, lib list also need not contain
> > "src/lib".
> >
> > # n.b. environment variable seems better than -I option,
> > # because it will propagate to child processes (see LockedFile.t).
> Indeed, altough -I flag can also be passed to child process.

Can it? Please compare these:

$ perl -I xxx -e 'system "perl", "-e", "print shift \@INC"'

$ PERL5LIB=xxx perl -e 'system "perl", "-e", "print shift \@INC"'

> Those scripts are currenly self-contained, executable without
> configuring environment first, while not preventing any override. For
> the cost of two additional line of code... Why should we remove them,
> just because there is another way to do it ?

They are not self-contained. They depend on layout of the source
tree anyway. If t/ directory was moved to another level, they
won't run.

More simple way is to run test scripts from the top of source always.
I suppose we may not have to add any of these:
executable bit, sh-bang, FindBin and -I option for child processes.


Regards,

--- Soji

--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/




Archive powered by MHonArc 2.6.19+.

Top of Page