coverage.sh: print script progress

This commit is contained in:
Johannes 'josch' Schauer 2018-10-24 02:37:45 +02:00
parent 88c0d40b8f
commit 3c411012be
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -44,24 +44,39 @@ export SOURCE_DATE_EPOCH=$(date --date="$(grep-dctrl -s Date -n '' mirror/dists/
CMD="perl -MDevel::Cover=-silent,-nogcov ./mmdebstrap" CMD="perl -MDevel::Cover=-silent,-nogcov ./mmdebstrap"
# create directory in sudo mode total=37
i=1
echo ------------------------------------------------------------------------------
echo "($i/$total) mode=root,variant=apt: create directory"
echo ------------------------------------------------------------------------------
i=$((i+1))
sudo $CMD --mode=root --variant=apt unstable ./debian-unstable "http://localhost:8000" sudo $CMD --mode=root --variant=apt unstable ./debian-unstable "http://localhost:8000"
sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > tar1.txt sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > tar1.txt
sudo rm -r --one-file-system ./debian-unstable sudo rm -r --one-file-system ./debian-unstable
# create a tarball echo ------------------------------------------------------------------------------
echo "($i/$total) mode=unshare,variant=apt: create tarball"
echo ------------------------------------------------------------------------------
i=$((i+1))
$CMD --mode=unshare --variant=apt unstable unstable-chroot.tar "http://localhost:8000" $CMD --mode=unshare --variant=apt unstable unstable-chroot.tar "http://localhost:8000"
tar -tf unstable-chroot.tar | sort > tar2.txt tar -tf unstable-chroot.tar | sort > tar2.txt
diff -u tar1.txt tar2.txt diff -u tar1.txt tar2.txt
rm unstable-chroot.tar rm unstable-chroot.tar
# read sources.list from standard input and write to standard output echo ------------------------------------------------------------------------------
echo "($i/$total) mode=auto,variant=apt: read from stdin, write to stdout"
echo ------------------------------------------------------------------------------
i=$((i+1))
echo "deb http://localhost:8000 unstable main" | $CMD --variant=apt > unstable-chroot.tar echo "deb http://localhost:8000 unstable main" | $CMD --variant=apt > unstable-chroot.tar
tar -tf unstable-chroot.tar | sort > tar2.txt tar -tf unstable-chroot.tar | sort > tar2.txt
diff -u tar1.txt tar2.txt diff -u tar1.txt tar2.txt
rm unstable-chroot.tar rm unstable-chroot.tar
# test aptopt echo ------------------------------------------------------------------------------
echo "($i/$total) mode=root,variant=apt: test --aptopt"
echo ------------------------------------------------------------------------------
i=$((i+1))
sudo $CMD --mode=root --variant=apt --aptopt="Acquire::Check-Valid-Until false" unstable ./debian-unstable "http://localhost:8000" sudo $CMD --mode=root --variant=apt --aptopt="Acquire::Check-Valid-Until false" unstable ./debian-unstable "http://localhost:8000"
echo "Acquire::Check-Valid-Until false;" | cmp ./debian-unstable/etc/apt/apt.conf.d/99mmdebstrap - echo "Acquire::Check-Valid-Until false;" | cmp ./debian-unstable/etc/apt/apt.conf.d/99mmdebstrap -
sudo rm ./debian-unstable/etc/apt/apt.conf.d/99mmdebstrap sudo rm ./debian-unstable/etc/apt/apt.conf.d/99mmdebstrap
@ -69,7 +84,10 @@ sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > tar2.txt
diff -u tar1.txt tar2.txt diff -u tar1.txt tar2.txt
sudo rm -r --one-file-system ./debian-unstable sudo rm -r --one-file-system ./debian-unstable
# test dpkgopt echo ------------------------------------------------------------------------------
echo "($i/$total) mode=root,variant=apt: test --dpkgopt"
echo ------------------------------------------------------------------------------
i=$((i+1))
sudo $CMD --mode=root --variant=apt --dpkgopt="path-exclude=/usr/share/doc/*" unstable ./debian-unstable "http://localhost:8000" sudo $CMD --mode=root --variant=apt --dpkgopt="path-exclude=/usr/share/doc/*" unstable ./debian-unstable "http://localhost:8000"
echo "path-exclude=/usr/share/doc/*" | cmp ./debian-unstable/etc/dpkg/dpkg.cfg.d/99mmdebstrap - echo "path-exclude=/usr/share/doc/*" | cmp ./debian-unstable/etc/dpkg/dpkg.cfg.d/99mmdebstrap -
sudo rm ./debian-unstable/etc/dpkg/dpkg.cfg.d/99mmdebstrap sudo rm ./debian-unstable/etc/dpkg/dpkg.cfg.d/99mmdebstrap
@ -77,7 +95,10 @@ sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > tar2.txt
grep -v '^./usr/share/doc/.' tar1.txt | diff -u - tar2.txt grep -v '^./usr/share/doc/.' tar1.txt | diff -u - tar2.txt
sudo rm -r --one-file-system ./debian-unstable sudo rm -r --one-file-system ./debian-unstable
# test --include echo ------------------------------------------------------------------------------
echo "($i/$total) mode=root,variant=apt: test --include"
echo ------------------------------------------------------------------------------
i=$((i+1))
sudo $CMD --mode=root --variant=apt --include=doc-debian unstable ./debian-unstable "http://localhost:8000" sudo $CMD --mode=root --variant=apt --include=doc-debian unstable ./debian-unstable "http://localhost:8000"
sudo rm ./debian-unstable/usr/share/doc-base/debian-* sudo rm ./debian-unstable/usr/share/doc-base/debian-*
sudo rm -r ./debian-unstable/usr/share/doc/debian sudo rm -r ./debian-unstable/usr/share/doc/debian
@ -92,6 +113,10 @@ sudo rm -r --one-file-system ./debian-unstable
# test all variants # test all variants
for variant in essential apt required minbase buildd important debootstrap - standard; do for variant in essential apt required minbase buildd important debootstrap - standard; do
echo ------------------------------------------------------------------------------
echo "($i/$total) mode=root,variant=$variant: create directory"
echo ------------------------------------------------------------------------------
i=$((i+1))
sudo $CMD --mode=root --variant=$variant unstable ./debian-unstable "http://localhost:8000" sudo $CMD --mode=root --variant=$variant unstable ./debian-unstable "http://localhost:8000"
sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > "$variant.txt" sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > "$variant.txt"
sudo rm -r --one-file-system ./debian-unstable sudo rm -r --one-file-system ./debian-unstable
@ -113,6 +138,10 @@ for variant in essential apt required minbase buildd important debootstrap - sta
fi fi
;; ;;
esac esac
echo ------------------------------------------------------------------------------
echo "($i/$total) mode=$mode,variant=$variant: create tarball"
echo ------------------------------------------------------------------------------
i=$((i+1))
$CMD --mode=$mode --variant=$variant unstable unstable-chroot.tar "http://localhost:8000" $CMD --mode=$mode --variant=$variant unstable unstable-chroot.tar "http://localhost:8000"
# in fakechroot mode, we use a fake ldconfig, so we have to # in fakechroot mode, we use a fake ldconfig, so we have to
# artificially add some files # artificially add some files
@ -124,6 +153,10 @@ for variant in essential apt required minbase buildd important debootstrap - sta
# with fakechroot, thus, we do an additional run where we # with fakechroot, thus, we do an additional run where we
# explicitly run mmdebstrap with fakechroot from the start # explicitly run mmdebstrap with fakechroot from the start
if [ "$mode" = "fakechroot" ]; then if [ "$mode" = "fakechroot" ]; then
echo ------------------------------------------------------------------------------
echo "($i/$total) mode=$mode,variant=$variant: create tarball (ver 2)"
echo ------------------------------------------------------------------------------
i=$((i+1))
fakechroot fakeroot $CMD --mode=$mode --variant=$variant unstable unstable-chroot.tar "http://localhost:8000" fakechroot fakeroot $CMD --mode=$mode --variant=$variant unstable unstable-chroot.tar "http://localhost:8000"
{ tar -tf unstable-chroot.tar; { tar -tf unstable-chroot.tar;
printf "./etc/ld.so.cache\n./var/cache/ldconfig/\n"; printf "./etc/ld.so.cache\n./var/cache/ldconfig/\n";
@ -183,6 +216,10 @@ for mode in root unshare fakechroot proot chrootless; do
if [ "$mode" = "root" ]; then if [ "$mode" = "root" ]; then
prefix=sudo prefix=sudo
fi fi
echo ------------------------------------------------------------------------------
echo "($i/$total) mode=$mode,variant=extract: unpack doc-debian"
echo ------------------------------------------------------------------------------
i=$((i+1))
$prefix $CMD --mode=$mode --variant=extract --include=doc-debian unstable ./debian-unstable "http://localhost:8000" $prefix $CMD --mode=$mode --variant=extract --include=doc-debian unstable ./debian-unstable "http://localhost:8000"
# delete contents of doc-debian # delete contents of doc-debian
sudo rm ./debian-unstable/usr/share/doc-base/debian-* sudo rm ./debian-unstable/usr/share/doc-base/debian-*
@ -228,7 +265,10 @@ for mode in root unshare fakechroot proot chrootless; do
sudo find ./debian-unstable -depth -print0 | xargs -0 sudo rmdir sudo find ./debian-unstable -depth -print0 | xargs -0 sudo rmdir
done done
# the custom variant only works with chrootless mode echo ------------------------------------------------------------------------------
echo "($i/$total) mode=chrootless,variant=custom: install doc-debian"
echo ------------------------------------------------------------------------------
i=$((i+1))
$CMD --mode=chrootless --variant=custom --include=doc-debian unstable ./debian-unstable "http://localhost:8000" $CMD --mode=chrootless --variant=custom --include=doc-debian unstable ./debian-unstable "http://localhost:8000"
# delete contents of doc-debian # delete contents of doc-debian
sudo rm ./debian-unstable/usr/share/doc-base/debian-* sudo rm ./debian-unstable/usr/share/doc-base/debian-*
@ -262,6 +302,10 @@ sudo find ./debian-unstable -depth -print0 | xargs -0 sudo rmdir
# create directory in sudo mode # create directory in sudo mode
# FIXME: once fakechroot and proot are fixed, we have to test more variants # FIXME: once fakechroot and proot are fixed, we have to test more variants
# than just essential # than just essential
echo ------------------------------------------------------------------------------
echo "($i/$total) mode=root,variant=essential: create directory"
echo ------------------------------------------------------------------------------
i=$((i+1))
sudo $CMD --mode=root --variant=essential unstable ./debian-unstable "http://localhost:8000" sudo $CMD --mode=root --variant=essential unstable ./debian-unstable "http://localhost:8000"
sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > tar1.txt sudo tar -C ./debian-unstable --one-file-system -c . | tar -t | sort > tar1.txt
sudo rm -r --one-file-system ./debian-unstable sudo rm -r --one-file-system ./debian-unstable
@ -279,6 +323,10 @@ for mode in root unshare fakechroot proot; do
# fakechroot from the start # fakechroot from the start
prefix="fakechroot fakeroot" prefix="fakechroot fakeroot"
fi fi
echo ------------------------------------------------------------------------------
echo "($i/$total) mode=$mode,variant=essential: create armhf tarball"
echo ------------------------------------------------------------------------------
i=$((i+1))
$prefix $CMD --mode=$mode --variant=essential --architectures=armhf unstable ./debian-unstable.tar "http://localhost:8000" $prefix $CMD --mode=$mode --variant=essential --architectures=armhf unstable ./debian-unstable.tar "http://localhost:8000"
# we ignore differences between architectures by ignoring some files # we ignore differences between architectures by ignoring some files
# and renaming others # and renaming others
@ -319,6 +367,10 @@ for f in common.js coverage.html cover.css css.js mmdebstrap--branch.html mmdebs
cp -a cover_db/$f report cp -a cover_db/$f report
done done
echo
echo open file://$(pwd)/report/coverage.html in a browser
echo
sudo umount cover_db sudo umount cover_db
sudo rmdir cover_db sudo rmdir cover_db
#rm tar1.txt tar2.txt #rm tar1.txt tar2.txt