perl: Add basic test support
Signed-off-by: Marcel Denia <naoir@gmx.net>
This commit is contained in:
parent
008585be94
commit
95058be605
4 changed files with 106 additions and 1 deletions
12
lang/perl/Config.in
Normal file
12
lang/perl/Config.in
Normal file
|
@ -0,0 +1,12 @@
|
|||
menu "Configuration"
|
||||
depends on PACKAGE_perl
|
||||
|
||||
config PERL_TESTS
|
||||
bool "Include perl tests"
|
||||
default n
|
||||
help
|
||||
Include test suites for all perl packages.
|
||||
This will make perl related packages much bigger, so
|
||||
use with care.
|
||||
|
||||
endmenu
|
|
@ -44,6 +44,9 @@ endif
|
|||
TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS))
|
||||
TARGET_CPPFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CPPFLAGS))
|
||||
|
||||
# A list of disabled testss
|
||||
PERL_DISABLEDTESTS:=
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include perlmod.mk
|
||||
|
@ -63,6 +66,10 @@ define Package/perl/description
|
|||
and is widely used to program web applications of all needs.
|
||||
endef
|
||||
|
||||
define Package/perl/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
# Static host perl
|
||||
define Host/Configure
|
||||
( cd $(HOST_BUILD_DIR); ./Configure -der -Uusedl -Duserelocatableinc -Dprefix=$(HOST_PERL_PREFIX) )
|
||||
|
@ -128,3 +135,37 @@ $(eval $(call BuildPackage,perl))
|
|||
$(eval $(call HostBuild))
|
||||
|
||||
-include perlbase.mk
|
||||
|
||||
# A helper package that includes all sort of supplementary files for tests
|
||||
define Package/perl-tests-common
|
||||
$(call Package/perlbase-template)
|
||||
TITLE:=Common test support files
|
||||
DEPENDS:=@PERL_TESTS
|
||||
endef
|
||||
|
||||
define Package/perl-tests-common/install
|
||||
$(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)
|
||||
$(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting
|
||||
$(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen
|
||||
$(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/XS
|
||||
$(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/auto/XS
|
||||
$(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/unicore
|
||||
|
||||
$(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/5.20/
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/5.20/auto
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/5.20/
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/5.20/unicore
|
||||
$(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh
|
||||
sed -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' -i $(1)/$(PERL_TESTSDIR)/run_tests.sh
|
||||
$(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR)
|
||||
$(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,perl-tests-common))
|
||||
|
|
24
lang/perl/files/perl-run_tests.sh
Executable file
24
lang/perl/files/perl-run_tests.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
PERL_TESTSDIR="/usr/share/perl/perl-tests"
|
||||
PERL_LIBDIR="/usr/lib/perl5/5.20/"
|
||||
PERL_DISABLEDTESTS="%%PERL_DISABLEDTESTS%%"
|
||||
|
||||
if [ ! -f "$PERL_TESTSDIR/__prepared" ]; then
|
||||
ln -s "$PERL_LIBDIR" "$PERL_TESTSDIR/lib"
|
||||
ln -s /usr/bin/perl "$PERL_TESTSDIR/perl"
|
||||
ln -s /usr/bin/perl "$PERL_TESTSDIR/t/perl"
|
||||
touch "$PERL_TESTSDIR/__prepared"
|
||||
|
||||
for i in $PERL_DISABLEDTESTS; do
|
||||
echo "Disabling $i tests"
|
||||
sed 's!^'$i'.*$!!' -i $PERL_TESTSDIR/MANIFEST
|
||||
done
|
||||
|
||||
cat $PERL_TESTSDIR/MANIFEST | grep -v '^$' > $PERL_TESTSDIR/MANIFEST_NEW
|
||||
rm $PERL_TESTSDIR/MANIFEST
|
||||
mv $PERL_TESTSDIR/MANIFEST_NEW $PERL_TESTSDIR/MANIFEST
|
||||
fi
|
||||
|
||||
cd "$PERL_TESTSDIR/t"
|
||||
./perl TEST
|
|
@ -11,6 +11,9 @@ PERL_CMD:=$(STAGING_DIR_HOST)/usr/bin/perl5.20.0
|
|||
|
||||
# Module install prefix
|
||||
PERL_SITELIB:=/usr/lib/perl5/5.20
|
||||
PERL_TESTSDIR:=/usr/share/perl/perl-tests
|
||||
PERLBASE_TESTSDIR:=/usr/share/perl/perlbase-tests
|
||||
PERLMOD_TESTSDIR:=/usr/share/perl/perlmod-tests
|
||||
|
||||
define perlmod/host/relink
|
||||
rm -f $(1)/Makefile.aperl
|
||||
|
@ -105,7 +108,7 @@ define perlmod/Compile
|
|||
install
|
||||
endef
|
||||
|
||||
define perlmod/Install
|
||||
define perlmod/Install/NoStrip
|
||||
$(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB)
|
||||
(cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \
|
||||
rsync --relative -rlHp --itemize-changes \
|
||||
|
@ -116,6 +119,11 @@ define perlmod/Install
|
|||
$(strip $(2)) $(strip $(1))$(PERL_SITELIB))
|
||||
|
||||
chmod -R u+w $(strip $(1))$(PERL_SITELIB)
|
||||
endef
|
||||
|
||||
|
||||
define perlmod/Install
|
||||
$(call perlmod/Install/NoStrip,$(1),$(2),$(3))
|
||||
|
||||
@echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
|
||||
find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
|
||||
|
@ -125,3 +133,23 @@ define perlmod/Install
|
|||
-e '/^#$$$$/d' \
|
||||
-e '/^#[^!"'"'"']/d'
|
||||
endef
|
||||
|
||||
# You probably don't want to use this directly. Look at perlmod/InstallTests
|
||||
define perlmod/_InstallTests
|
||||
$(INSTALL_DIR) $(strip $(1))
|
||||
(cd $(PKG_BUILD_DIR)/$(2) && \
|
||||
rsync --relative -rlHp --itemize-changes \
|
||||
--exclude=.packlist \
|
||||
--prune-empty-dirs \
|
||||
$(strip $(3)) $(strip $(1)))
|
||||
|
||||
chmod -R u+w $(strip $(1))
|
||||
endef
|
||||
|
||||
define perlmod/InstallBaseTests
|
||||
$(if $(CONFIG_PERL_TESTS),$(call perlmod/_InstallTests,$(1)$(PERL_TESTSDIR),,$(2)))
|
||||
endef
|
||||
|
||||
define perlmod/InstallTests
|
||||
$(if $(CONFIG_PERL_TESTS),$(call perlmod/_InstallTests,$(1)$(PERL_TESTSDIR),$(2),$(3)))
|
||||
endef
|
||||
|
|
Loading…
Reference in a new issue