Patchwork [02/12] microperl: how to test it ?

login
register
mail settings
Submitter Francois Perrad
Date Aug. 15, 2012, 2:38 p.m.
Message ID <1345041514-31539-2-git-send-email-francois.perrad@gadz.org>
Download mbox | patch
Permalink /patch/177687/
State Superseded
Headers show

Comments

Francois Perrad - Aug. 15, 2012, 2:38 p.m.
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/microperl/Config.in    |    9 +++++++++
 package/microperl/microperl.mk |   12 ++++++++++++
 2 files changed, 21 insertions(+)
Thomas Petazzoni - Aug. 15, 2012, 4:08 p.m.
Le Wed, 15 Aug 2012 16:38:24 +0200,
Francois Perrad <fperrad@gmail.com> a écrit :

> +ifdef BR2_PACKAGE_MICROPERL_INSTALL_TESTSUITE
> +define MICROPERL_INSTALL_TESTSUITE
> +	$(INSTALL) -m644 -D $(@D)/t/TEST                $(TARGET_DIR)/root/microperl/t/TEST

Isn't this one a script that should be installed 755?

> +	$(INSTALL) -m644 -D $(@D)/t/harness             $(TARGET_DIR)/root/microperl/t/harness
> +	cp -r $(@D)/lib         $(TARGET_DIR)/root/microperl/lib
> +	cp -r $(@D)/t/base      $(TARGET_DIR)/root/microperl/t/base
> +	cp -r $(@D)/t/cmd       $(TARGET_DIR)/root/microperl/t/cmd

Is /root/ really the right place to install this? Isn't
some /usr/share/perl/ or /usr/lib/perl/ a better place?

> +	echo "BEGIN { chdir 't' if -d 't'; @INC = ('../lib', '.'); } 1;" > $(TARGET_DIR)/root/microperl/TestInit.pm

I think I would prefer a TestInit.pm file added in package/microperl/
rather than echo'ing it here.

Thanks!

Thomas
Francois Perrad - Aug. 16, 2012, 7:50 a.m.
rem1: microperl is not fully supported by the Perl community.
the build in Perl 5.16 serie is broken, see
http://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg190323.html
people ask about its interest, see
http://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg190422.html

rem2: in this commit, I introduce a testing scheme, and I reuse it for
perl & miniperl packages.
I want a reproducible and documented recipe for run the
perl/miniperl/microerl test suite.

2012/8/15 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>:
> Le Wed, 15 Aug 2012 16:38:24 +0200,
> Francois Perrad <fperrad@gmail.com> a écrit :
>
>> +ifdef BR2_PACKAGE_MICROPERL_INSTALL_TESTSUITE
>> +define MICROPERL_INSTALL_TESTSUITE
>> +     $(INSTALL) -m644 -D $(@D)/t/TEST                $(TARGET_DIR)/root/microperl/t/TEST
>
> Isn't this one a script that should be installed 755?

Intentional. The help string in Config.in describes how to run the test suite.

>
>> +     $(INSTALL) -m644 -D $(@D)/t/harness             $(TARGET_DIR)/root/microperl/t/harness
>> +     cp -r $(@D)/lib         $(TARGET_DIR)/root/microperl/lib
>> +     cp -r $(@D)/t/base      $(TARGET_DIR)/root/microperl/t/base
>> +     cp -r $(@D)/t/cmd       $(TARGET_DIR)/root/microperl/t/cmd
>
> Is /root/ really the right place to install this? Isn't
> some /usr/share/perl/ or /usr/lib/perl/ a better place?

On host-dev, testing in done in the build tree, so the test suite is
never installed.
With cross-dev, a part of the build tree must be copied on target in
order to run test; but you do this only during porting or debugging
the package.
I choice the /root directory, because it is an unusual location. If
you find these files in /root directory in a final image, you see your
mistake.
I do not want to pollute /usr with test suite.
(I try the /tmp directory, but it doesn't work)

>
>> +     echo "BEGIN { chdir 't' if -d 't'; @INC = ('../lib', '.'); } 1;" > $(TARGET_DIR)/root/microperl/TestInit.pm
>
> I think I would prefer a TestInit.pm file added in package/microperl/
> rather than echo'ing it here.

TestInit.pm is a preamble for each test, and a 'standard' version is
included in the Perl distribution.
But this 'standard' version is too convoluted (for all OS, for the
whole test suite).
This one-liner version is enough for microperl test suite and make
debugging more easy.

I don't want a patch which will never merged in upstream.

François

>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Francois Perrad - Aug. 20, 2012, 7:28 a.m.
I'll send a new patch serie which supercedes this one.

François

2012/8/16 François Perrad <francois.perrad@gadz.org>:
> rem1: microperl is not fully supported by the Perl community.
> the build in Perl 5.16 serie is broken, see
> http://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg190323.html
> people ask about its interest, see
> http://www.nntp.perl.org/group/perl.perl5.porters/2012/08/msg190422.html
>
> rem2: in this commit, I introduce a testing scheme, and I reuse it for
> perl & miniperl packages.
> I want a reproducible and documented recipe for run the
> perl/miniperl/microerl test suite.
>
> 2012/8/15 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>:
>> Le Wed, 15 Aug 2012 16:38:24 +0200,
>> Francois Perrad <fperrad@gmail.com> a écrit :
>>
>>> +ifdef BR2_PACKAGE_MICROPERL_INSTALL_TESTSUITE
>>> +define MICROPERL_INSTALL_TESTSUITE
>>> +     $(INSTALL) -m644 -D $(@D)/t/TEST                $(TARGET_DIR)/root/microperl/t/TEST
>>
>> Isn't this one a script that should be installed 755?
>
> Intentional. The help string in Config.in describes how to run the test suite.
>
>>
>>> +     $(INSTALL) -m644 -D $(@D)/t/harness             $(TARGET_DIR)/root/microperl/t/harness
>>> +     cp -r $(@D)/lib         $(TARGET_DIR)/root/microperl/lib
>>> +     cp -r $(@D)/t/base      $(TARGET_DIR)/root/microperl/t/base
>>> +     cp -r $(@D)/t/cmd       $(TARGET_DIR)/root/microperl/t/cmd
>>
>> Is /root/ really the right place to install this? Isn't
>> some /usr/share/perl/ or /usr/lib/perl/ a better place?
>
> On host-dev, testing in done in the build tree, so the test suite is
> never installed.
> With cross-dev, a part of the build tree must be copied on target in
> order to run test; but you do this only during porting or debugging
> the package.
> I choice the /root directory, because it is an unusual location. If
> you find these files in /root directory in a final image, you see your
> mistake.
> I do not want to pollute /usr with test suite.
> (I try the /tmp directory, but it doesn't work)
>
>>
>>> +     echo "BEGIN { chdir 't' if -d 't'; @INC = ('../lib', '.'); } 1;" > $(TARGET_DIR)/root/microperl/TestInit.pm
>>
>> I think I would prefer a TestInit.pm file added in package/microperl/
>> rather than echo'ing it here.
>
> TestInit.pm is a preamble for each test, and a 'standard' version is
> included in the Perl distribution.
> But this 'standard' version is too convoluted (for all OS, for the
> whole test suite).
> This one-liner version is enough for microperl test suite and make
> debugging more easy.
>
> I don't want a patch which will never merged in upstream.
>
> François
>
>>
>> Thanks!
>>
>> Thomas
>> --
>> Thomas Petazzoni, Free Electrons
>> Kernel, drivers, real-time and embedded Linux
>> development, consulting, training and support.
>> http://free-electrons.com
>> _______________________________________________
>> buildroot mailing list
>> buildroot@busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot

Patch

diff --git a/package/microperl/Config.in b/package/microperl/Config.in
index 256e271..54df7e2 100644
--- a/package/microperl/Config.in
+++ b/package/microperl/Config.in
@@ -15,6 +15,15 @@  config BR2_PACKAGE_MICROPERL_MODULES
 	  Module dependencies are not automatic so check your needs.
 	  You can't use XS modules like IO.
 
+config BR2_PACKAGE_MICROPERL_INSTALL_TESTSUITE
+	bool "install testsuite"
+	help
+	  Install the test suite on target.
+		# cd /root/microperl/t
+		# rm -f perl
+		# ln -s /usr/bin/microperl perl
+		# ./perl TEST base/*.t cmd/*.t
+
 menu "module bundles"
 
 config BR2_PACKAGE_MICROPERL_BUNDLE_CGI
diff --git a/package/microperl/microperl.mk b/package/microperl/microperl.mk
index b2a912a..0269b3f 100644
--- a/package/microperl/microperl.mk
+++ b/package/microperl/microperl.mk
@@ -144,8 +144,20 @@  define MICROPERL_INSTALL_TARGET_CMDS
 	# Remove test files
 	find $(TARGET_DIR)/$(MICROPERL_MODS_DIR) -type f -name *.t \
 		-exec rm -f {} \;
+	$(MICROPERL_INSTALL_TESTSUITE)
 endef
 
+ifdef BR2_PACKAGE_MICROPERL_INSTALL_TESTSUITE
+define MICROPERL_INSTALL_TESTSUITE
+	$(INSTALL) -m644 -D $(@D)/t/TEST                $(TARGET_DIR)/root/microperl/t/TEST
+	$(INSTALL) -m644 -D $(@D)/t/harness             $(TARGET_DIR)/root/microperl/t/harness
+	cp -r $(@D)/lib         $(TARGET_DIR)/root/microperl/lib
+	cp -r $(@D)/t/base      $(TARGET_DIR)/root/microperl/t/base
+	cp -r $(@D)/t/cmd       $(TARGET_DIR)/root/microperl/t/cmd
+	echo "BEGIN { chdir 't' if -d 't'; @INC = ('../lib', '.'); } 1;" > $(TARGET_DIR)/root/microperl/TestInit.pm
+endef
+endif
+
 define MICROPERL_UNINSTALL_TARGET_CMDS
 	rm -f $(TARGET_DIR)/usr/bin/perl
 	rm -f $(TARGET_DIR)/usr/bin/microperl