[Buildroot] [RFC 2/4] support/testing: add perl-time-hires test

Ricardo Martincoski ricardo.martincoski at gmail.com
Mon Nov 19 22:57:32 UTC 2018


Hello,

On Mon, Nov 19, 2018 at 05:29 PM, François Perrad wrote:

> Le lun. 19 nov. 2018 à 02:14, Ricardo Martincoski <
> ricardo.martincoski at gmail.com> a écrit :
[snip]
>> Another way to test a perl package would be to have an script added to the
>> image
>> in build time, something like this:
>> sample_perl_time_hires.pl:
>> |use Time::HiRes;
>> |
>> |Time::HiRes::usleep(1_000_000)
>>
>> And call:
>> perl sample_perl_time_hires.pl
>>
>> This way we could test scripts with a few lines of code and keep it
>> readable in
>> the tree.
>>
>>
> With the current TestPerl class, this test could be written as:
>         self.module_test("Time::HiRes", "Time::HiRes::usleep(1_000_000);")
> A long oneliner script could be written with a multiline layout, like this:
>         self.module_test("Time::HiRes", "use strict;" +
>                                         "use warnings;" +
>                                         "Time::HiRes::usleep(1_000_000);")
> So, we don't need to handle sample_perl_*.pl scripts.
> Same thing with Lua.

This is (kind of) how we were handling the tests for python packages before.

But you have a point.

Testing python packages got really messy when a class was needed in the script
because of the indentation. In those cases a oneliner was not enough.
Lua and Perl packages can always be tested with oneliners AFAIK.

Another issue that made python scripts less readable was the escaping for string
delimiters.
I guess that for lua and perl scripts we can always use those fancy quotes
([[string]], q{string}) when needed.

If Thomas and Arnout don't disagree, let's keep using oneliners to test lua and
perl packages, as you originally proposed.


Regards,
Ricardo


More information about the buildroot mailing list