[blfs-dev] automated perl module tests as a POC for automated full BLFS tests

Pierre Labastie pierre.labastie at neuf.fr
Sat Nov 24 07:45:31 PST 2018


Hi,

As you may have noticed from my other posts, I'd like to set up a tool
allowing automated testing of the BLFS book. This morning, I've written a
short script, which allowed me to test all the perl modules of the "Perl
Modules" page individually. That is:
-start from a known state (only perl and xml-parser installed)
-build a fake "configuration" file for jhalfs, containing only one module
-run jhalfs for that module (which means build the dependency tree and order
the package builds so that all deps are built before their dependent package
-effectively build the packages
-remove the built packages and go back to the known state

Here is the script. The script is run from the "blfs_root" directory. The file
"toto" contains the id's of the modules we want to test. The file
"instpkg.base" contains the list of installed packages in the known state.
"confbase" contains the part of the "configuration" file, which contains
general settings (whether to build as user, MTA, etc). The information saved
in the directory "logs" is somewhat redundant, but I do not think it is a problem.

This script is a proof of concept, and is far from complete: going back to the
known state after fixing the book if an error is found is not automated. Also,
the file "toto" has been generated manually. But I'm now pretty confident that
automatic testing of the book will be possible (thanks to the reorganization
of the Perl modules).

Pierre
---------------
#!/bin/bash
set -e

rm -rf logs/*

for i in $(cat toto)
  do
echo removing xml-parser
sudo porg -rb xml-parser
echo removing perl
sudo porg -rb perl
echo installing perl
sudo porgball -e -l /var/lib/packages/perl-5.28.0.porg.tar.gz
sleep 5
echo installing xml-parser
sudo porgball -e -l /var/lib/packages/xml-parser-2.44.porg.tar.gz
sleep 5
cp instpkg.base /var/lib/jhalfs/BLFS/instpkg.xml
cp confbase configuration
echo CONFIG_$i=y >> configuration
yes 'yes' | ./gen_pkg_book.sh
mkdir work && cd work
../gen-makefile.sh
make
cd ..
mkdir -p logs/$i
mv work dependencies scripts logs/$i
for j in $(ls logs/$i/scripts)
do
	k=$(echo $j | sed 's/.*-z-//')
	echo Removing $k
	sudo porg -rb $k
done
  done


More information about the blfs-dev mailing list