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

François Perrad francois.perrad at gadz.org
Mon Nov 19 19:29:21 UTC 2018


Le lun. 19 nov. 2018 à 02:14, Ricardo Martincoski <
ricardo.martincoski at gmail.com> a écrit :

> Hello,
>
> Just giving an example of what I mentioned in a reply to the cover
> letter...
>
> On Sat, Nov 17, 2018 at 03:52 PM, Francois Perrad wrote:
>
> [snip]
> > +class TestPerlTimeHiRes(TestPerl):
> > +    config = TestPerl.config + \
> > +        """
> > +        BR2_PACKAGE_PERL_TIME_HIRES=y
> > +        """
> > +
> > +    def test_run(self):
> > +        self.login()
> > +        self.module_test("Time::HiRes")
>
> 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.

François


>
> Regards,
> Ricardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181119/cf8991c4/attachment.html>


More information about the buildroot mailing list