From 72075b8430b826d7dd489765c1004e4161479fa2 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 13 Oct 2015 10:26:06 +0000 Subject: move all tests under a t/ directory --- Makefile | 2 +- t/test_pbuilder-apt-config | 183 +++++++++++++++++++++++++ t/test_pbuilder-buildpackage-funcs | 137 +++++++++++++++++++ t/test_pbuilder-checkparams | 34 +++++ t/test_pbuilder-modules | 44 ++++++ t/test_pbuilder-satisfydepends-checkparams | 51 +++++++ t/test_pbuilder-satisfydepends-classic | 116 ++++++++++++++++ t/test_pbuilder-satisfydepends-funcs | 202 ++++++++++++++++++++++++++++ t/test_testlib.sh | 34 +++++ t/testlib.sh | 158 ++++++++++++++++++++++ test_pbuilder-apt-config | 191 -------------------------- test_pbuilder-buildpackage-funcs | 142 -------------------- test_pbuilder-checkparams | 41 ------ test_pbuilder-modules | 48 ------- test_pbuilder-satisfydepends-checkparams | 55 -------- test_pbuilder-satisfydepends-classic | 120 ----------------- test_pbuilder-satisfydepends-funcs | 206 ----------------------------- test_testlib.sh | 34 ----- testlib.sh | 158 ---------------------- 19 files changed, 960 insertions(+), 996 deletions(-) create mode 100755 t/test_pbuilder-apt-config create mode 100755 t/test_pbuilder-buildpackage-funcs create mode 100755 t/test_pbuilder-checkparams create mode 100755 t/test_pbuilder-modules create mode 100755 t/test_pbuilder-satisfydepends-checkparams create mode 100755 t/test_pbuilder-satisfydepends-classic create mode 100755 t/test_pbuilder-satisfydepends-funcs create mode 100755 t/test_testlib.sh create mode 100644 t/testlib.sh delete mode 100755 test_pbuilder-apt-config delete mode 100755 test_pbuilder-buildpackage-funcs delete mode 100755 test_pbuilder-checkparams delete mode 100755 test_pbuilder-modules delete mode 100755 test_pbuilder-satisfydepends-checkparams delete mode 100755 test_pbuilder-satisfydepends-classic delete mode 100755 test_pbuilder-satisfydepends-funcs delete mode 100755 test_testlib.sh delete mode 100644 testlib.sh diff --git a/Makefile b/Makefile index 32a1c2a..7e617c5 100644 --- a/Makefile +++ b/Makefile @@ -170,7 +170,7 @@ check: $(foreach script,$(CHECK_SCRIPTS),bash -n $(script)$(newline)) $(foreach mp,$(CHECK_MANPAGES),LANG=C MANWIDTH=80 man --warnings -l $(mp) >/dev/null$(newline)) # unit tests. - $(foreach test,$(wildcard ./test_*),$(test)$(newline)) + $(foreach test,$(wildcard ./t/test_*),$(test)$(newline)) full-check: # system tests that might take long. diff --git a/t/test_pbuilder-apt-config b/t/test_pbuilder-apt-config new file mode 100755 index 0000000..e00730e --- /dev/null +++ b/t/test_pbuilder-apt-config @@ -0,0 +1,183 @@ +#!/bin/bash + +set -e + +self="$(basename "$0")" + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + PBUILDER_APT_CONFIG="$PBUILDER_CHECKOUT/pbuilder-apt-config" +else + . "$TD/testlib.sh" + PBUILDER_APT_CONFIG="$PBUILDER_TEST_PKGLIBDIR/pbuilder-apt-config" +fi + +mirror_map="" + +cleanup() { + if [ -n "$mirror_map" ]; then + rm -f "$mirror_map" + fi +} + +mirror_map="$(mktemp -t "$self.XXXXXXXXXX")" +cat >"$mirror_map" < +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# On Debian systems, the full text of the GNU General Public +# License version 2 can be found in the file +# `/usr/share/common-licenses/GPL-2'. + + +# testsuite to test pbuilder-satisfydepends-funcs. + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + . "$PBUILDER_CHECKOUT/pbuilder-buildpackage-funcs" +else + . "$TD/testlib.sh" + . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-buildpackage-funcs" +fi + +DEBIAN_CONTROL="" + +cleanup() { + if [ -n "$DEBIAN_CONTROL" ]; then + rm -f "$DEBIAN_CONTROL" + fi +} + +test_getdscfilesNormal () { + + cat > "$DEBIAN_CONTROL" << EOF +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +Format: 3.0 (quilt) +Source: libeatmydata +Binary: eatmydata, libeatmydata1 +Architecture: any all +Version: 82-6 +Maintainer: Modestas Vainius +Uploaders: Mattia Rizzolo +Homepage: https://launchpad.net/libeatmydata +Standards-Version: 3.9.6 +Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/libeatmydata.git +Vcs-Git: git://anonscm.debian.org/collab-maint/libeatmydata.git +Build-Depends: autotools-dev, debhelper (>= 9), strace [!hurd-any !kfreebsd-any] +Package-List: + eatmydata deb utils optional arch=all + libeatmydata1 deb utils optional arch=any +Checksums-Sha1: + c8d3cd2d9a872302c8a1494813565639bd4c2aa8 407977 libeatmydata_82.orig.tar.gz + 4a76697591072662acee1e25d7f86c1f6ac503dd 43484 libeatmydata_82-6.debian.tar.xz +Checksums-Sha256: + 0b675f58069f912727cee5eb75f9ff1a6a8300fe7e3fe4fc6bdd03b7c2c15b29 407977 libeatmydata_82.orig.tar.gz + 3b5aede6617ed161211aee6f421d6af3c1ae22a4f4d11dc6545138359d7eea2c 43484 libeatmydata_82-6.debian.tar.xz +Files: + 56a4d342f209ab75a9ee360236e3e5bc 407977 libeatmydata_82.orig.tar.gz + 06c197d3d4142b546e836d72fbe4b895 43484 libeatmydata_82-6.debian.tar.xz + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.12 (GNU/Linux) + +iD8DBQFUfLA320zMSyow1ykRAkRxAJ4zYyuUByiYq31sxbrB902PybqADwCfd/Gd +SPXUusVdt4obPwG2sauWLlc= +=e9Vj +-----END PGP SIGNATURE----- +EOF + getdscfiles "$DEBIAN_CONTROL" +} + +test_getdscfilesWithoutNL () { + + cat > "$DEBIAN_CONTROL" << EOF +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +Format: 3.0 (quilt) +Source: golang-xmpp-dev +Binary: golang-xmpp-dev +Architecture: all +Version: 0.0~git20140304-1 +Maintainer: Jacob Appelbaum +Homepage: https://www.github.com/agl/xmpp +Standards-Version: 3.9.5 +Build-Depends: debhelper (>= 9) +Package-List: + golang-xmpp-dev deb devel extra +Checksums-Sha1: + 2175fd06e8fcf9787044036837f21b7e6c3d2ceb 10040 golang-xmpp-dev_0.0~git20140304.orig.tar.gz + 72b5180710909e30208627bd77dd899751475309 2208 golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz +Checksums-Sha256: + 41805d983433423eb967628c43f033a19f6c8363c3d40a5931a5eb28f4e9133c 10040 golang-xmpp-dev_0.0~git20140304.orig.tar.gz + 54f49f52c2c1399c8262afc582e1ce38ef99cd4d95cd06f9350a91960176a925 2208 golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz +Files: + a00613a2e965c11c9713268c25486a1b 10040 golang-xmpp-dev_0.0~git20140304.orig.tar.gz + e5bc6c49ca86922344531418dee9e5dd 2208 golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz +-----BEGIN PGP SIGNATURE----- + +iQGVAwUBUxYUR1kMfZESRfeDAQgvCwv8CM7a+LcQQnk5Gil3jHHlr4EO6NvuDMpW +4+yviAFZCmOVq3poUKYpojNNtIBPSGh2+POEOZu+6h1rQxQpPeiqrIteS4pMhR7s +bptUqqAbRH/Yy9pcmPOf+yDeeGAr/xaga9vvankdn60Q5D7Xk85Bhl6a3KucCwGA +h5s/ywDXZVOtjqywoB+zR5Jd2kuhjJUUdnUxTvVrw+rZXaKcwgAM1zUv6Tqkdkij +NRJFW5p17c1gg0v7KvWcCJoNcF5Mn1avnTF7OhZm5ODreM9kgpcd+8yuG3n6j/Ey +o4E6p2Tf5wTQ2t44OaU1uu8+0mjPhDxfEjGKcdThWQyrqO0hkGAfLkubLGRB4EZo +dcWK+KNxOR5HzgQGJw+rEGn/x7kcQtdDeXn3EsHeAhJscicdbJW9nCM47+PLM7Pn +B3WfTzfwrzVC/IcSM1303chIW0dfsMTCP0ubFZOqoMMflSKRPiJ3vPvJFFzmrS31 +M4EDxlS+nvAHZbzQ49QGnU/dMocDzvAH +=XSwB +-----END PGP SIGNATURE----- +EOF + getdscfiles "$DEBIAN_CONTROL" + +} + +trap cleanup sigpipe sighup exit + +# FIXME move to build dir also because we have to hardoce /tmp/ on the result below +DEBIAN_CONTROL="$(tempfile)" + +expect_output "$DEBIAN_CONTROL /tmp/libeatmydata_82.orig.tar.gz /tmp/libeatmydata_82-6.debian.tar.xz" test_getdscfilesNormal +expect_output "$DEBIAN_CONTROL /tmp/golang-xmpp-dev_0.0~git20140304.orig.tar.gz /tmp/golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz" test_getdscfilesWithoutNL + +testlib_summary diff --git a/t/test_pbuilder-checkparams b/t/test_pbuilder-checkparams new file mode 100755 index 0000000..a81ae8d --- /dev/null +++ b/t/test_pbuilder-checkparams @@ -0,0 +1,34 @@ +#!/bin/bash + +# testsuite for pbuilder-checkparams + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + PBUILDER_CHECKPARAMS="$PBUILDER_CHECKOUT/pbuilder-checkparams" +else + . "$TD/testlib.sh" + PBUILDER_CHECKPARAMS="$PBUILDER_TEST_PKGLIBDIR/pbuilder-checkparams" +fi + +# setup a fake installed environment +trap testlib_cleanup_env sigpipe sighup exit +testlib_setup_env + +test_debuildopts() { + . "$PBUILDER_CHECKPARAMS" + echo "$DEBBUILDOPTS" +} + +expect_output "" \ + test_debuildopts foo.dsc +expect_output "" \ + test_debuildopts --debbuildopts "" foo.dsc +expect_output "-v1.0 -efoo" \ + test_debuildopts --debbuildopts "-v1.0 -efoo" foo.dsc +expect_output "-v1.0 -efoo" \ + test_debuildopts --debbuildopts -v1.0 --debbuildopts -efoo foo.dsc +expect_output "-efoo" \ + test_debuildopts --debbuildopts -v1.0 --debbuildopts "" --debbuildopts -efoo foo.dsc + +testlib_summary diff --git a/t/test_pbuilder-modules b/t/test_pbuilder-modules new file mode 100755 index 0000000..9e1f6e0 --- /dev/null +++ b/t/test_pbuilder-modules @@ -0,0 +1,44 @@ +#!/bin/bash + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + . "$PBUILDER_CHECKOUT/pbuilder-modules" +else + . "$TD/testlib.sh" + . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-modules" +fi + +function test_information() { + log "I: test" + log "W: warning" + log "E: error" +} +expect_output "I: test +W: warning +E: error" test_information + +# test the non-copy case +function test_conditional_cp_a() { + ( + TEMPDIR=$(mktemp -d) + cd "${TEMPDIR}" + touch "hoge" + outdir=$(readlink -f "${TEMPDIR}/..") + conditional_cp_a "hoge" "${outdir}" echo + ) +} +expect_output "I: file hoge is already in target, not copying." \ + test_conditional_cp_a + +# test the copy case. +function test_conditional_cp_a_copy() { + ( + cd /tmp + outdir=/something-else + conditional_cp_a "hoge" "${outdir}" echo + ) +} +expect_output "-a hoge /something-else" test_conditional_cp_a_copy + +testlib_summary diff --git a/t/test_pbuilder-satisfydepends-checkparams b/t/test_pbuilder-satisfydepends-checkparams new file mode 100755 index 0000000..ccb044d --- /dev/null +++ b/t/test_pbuilder-satisfydepends-checkparams @@ -0,0 +1,51 @@ +#!/bin/bash + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + PBUILDER_SATISFYDEPENDS_CHECKPARAMS="$PBUILDER_CHECKOUT/pbuilder-satisfydepends-checkparams" +else + . "$TD/testlib.sh" + PBUILDER_SATISFYDEPENDS_CHECKPARAMS="$PBUILDER_TEST_PKGLIBDIR/pbuilder-satisfydepends-checkparams" +fi + +# testsuite to test pbuilder-satisfydepends-checkparams. + +# mock function +checkbuilddep_internal() { + : # do nothing function +} + +test_chrootexec2() { + set -- --internal-chrootexec 'chroot /tmp-hoge ' --chroot /tmp + . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" +} +expect_fail test_chrootexec2 + +test_chrootexec1() { + set -- --chroot /tmp --internal-chrootexec 'chroot /tmp-hoge ' + . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" +} +expect_success test_chrootexec1 + +test_chrootexec_echo() { + set -- --echo --chroot /tmp + . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" +} +expect_fail test_chrootexec_echo + +test_chrootexec_echo2() { + set -- --chroot /tmp --echo + . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" + echo $CHROOTEXEC +} +expect_output "echo chroot /tmp" test_chrootexec_echo2 + +test_chrootexec_expect() { + set -- --chroot /tmp --internal-chrootexec 'chroot /tmp-hoge ' + . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" + echo $CHROOTEXEC +} +expect_output "chroot /tmp-hoge" test_chrootexec_expect + +testlib_summary diff --git a/t/test_pbuilder-satisfydepends-classic b/t/test_pbuilder-satisfydepends-classic new file mode 100755 index 0000000..929699b --- /dev/null +++ b/t/test_pbuilder-satisfydepends-classic @@ -0,0 +1,116 @@ +#!/bin/bash +#for flavour in aptitude classic experimental gdebi; do +# (. ./pbuilder-satisfydepends-"$flavour") +#done + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_CHECKOUT/pbuilder-satisfydepends-classic" +else + . "$TD/testlib.sh" + PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_TEST_PKGLIBDIR/pbuilder-satisfydepends-classic" +fi + +DEBIAN_CONTROL="" + +cleanup() { + if [ -n "$DEBIAN_CONTROL" ]; then + rm -f "$DEBIAN_CONTROL" + fi + testlib_cleanup_env +} + +trap cleanup sigpipe sighup exit + +# setup a fake installed environment +testlib_setup_env + +if [ -n "$PBUILDER_CHECKOUT" ]; then + PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_CHECKOUT/pbuilder-satisfydepends-classic" +else + export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" + PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_PKGLIBDIR/pbuilder-satisfydepends-classic" +fi + +set -- --echo --control "$DEBIAN_CONTROL" +# this is just to source the functions +. "$PBUILDER_SATISFYDEPENDS_CLASSIC" >/dev/null 2>&1 || true + +DEBIAN_CONTROL="`mktemp -t`" +cat >"$DEBIAN_CONTROL" <= 5.0.0), gnome-pkg-tools, autotools-dev, cdbs, libglib2.0-dev (>= 2.12), libgtk2.0-dev (>= 2.10), libgnome2-dev (>= 2.16.0), libgnomeui-dev (>= 2.16.0), libglade2-dev, libgnomevfs2-dev (>= 2.9.2), libgconf2-dev, libxft-dev, libperl-dev, python-dev, tcl8.4-dev, libxml-parser-perl, libdbus-glib-1-dev (>= 0.60), libtool, scrollkeeper, libgnutls-dev, libnotify-dev (>= 0.3.2-0), libsexy-dev (>= 0.1.7), gnome-doc-utils, libssl-dev (>= 0.9.8b-1), liblaunchpad-integration-dev + +EOF + +test_split_deps() { + get_build_deps | split_deps +} + +expect_output "debhelper/(>=/5.0.0) +gnome-pkg-tools +autotools-dev +cdbs +libglib2.0-dev/(>=/2.12) +libgtk2.0-dev/(>=/2.10) +libgnome2-dev/(>=/2.16.0) +libgnomeui-dev/(>=/2.16.0) +libglade2-dev +libgnomevfs2-dev/(>=/2.9.2) +libgconf2-dev +libxft-dev +libperl-dev +python-dev +tcl8.4-dev +libxml-parser-perl +libdbus-glib-1-dev/(>=/0.60) +libtool +scrollkeeper +libgnutls-dev +libnotify-dev/(>=/0.3.2-0) +libsexy-dev/(>=/0.1.7) +gnome-doc-utils +libssl-dev/(>=/0.9.8b-1) +liblaunchpad-integration-dev" test_split_deps + +expect_output "foo +bar" split_alternates "foo | bar" + +expect_output "debhelper +gnome-pkg-tools +autotools-dev +cdbs +libglib2.0-dev +libgtk2.0-dev +libgnome2-dev +libgnomeui-dev +libglade2-dev +libgnomevfs2-dev +libgconf2-dev +libxft-dev +libperl-dev +python-dev +tcl8.4-dev +libxml-parser-perl +libdbus-glib-1-dev +libtool +scrollkeeper +libgnutls-dev +libnotify-dev +libsexy-dev +gnome-doc-utils +libssl-dev +liblaunchpad-integration-dev" get_pkg_name "`test_split_deps`" + +expect_output ">= 5.0.0 +>= 2.12 +>= 2.10 +>= 2.16.0 +>= 2.16.0 +>= 2.9.2 +>= 0.60 +>= 0.3.2-0 +>= 0.1.7 +>= 0.9.8b-1" get_dep_op_and_ver "`test_split_deps`" + +testlib_summary diff --git a/t/test_pbuilder-satisfydepends-funcs b/t/test_pbuilder-satisfydepends-funcs new file mode 100755 index 0000000..5aaee9b --- /dev/null +++ b/t/test_pbuilder-satisfydepends-funcs @@ -0,0 +1,202 @@ +#!/bin/bash + +# testsuite to test pbuilder-satisfydepends-funcs. + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + . "$PBUILDER_CHECKOUT/pbuilder-satisfydepends-funcs" +else + . "$TD/testlib.sh" + . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-satisfydepends-funcs" +fi + +DEBIAN_CONTROL="" + +cleanup() { + if [ -n "$DEBIAN_CONTROL" ]; then + rm -f "$DEBIAN_CONTROL" + fi +} + +test_get_build_deps() { + local BINARY_ARCH + + BINARY_ARCH="$1" + + cat <"$DEBIAN_CONTROL" +Source: amule +XXXX: +Build-Depends: + autotools-dev ( >= 1.2 ) , + debhelper , + quilt(<<12:0), +## + libwxgtk2.8-dev +Build-Depends-Indep: test [ amd64 i386 ], test1, + test2[!i386 ! amd64], test3 | + test4, test5 +Misc: test + +Build-Depends: wrong build depends, line +Description: test + other things + wow +EOF + get_build_deps +} + +test_get_build_deps_dsc() { + cat <"$DEBIAN_CONTROL" +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +Format: 1.0 +Source: hello-debhelper +Build-Depends: debhelper (>= 7) +Checksums-Sha1: + fcbf0264928900adf03a7797474375e1a6fa3836 499638 hello-debhelper_2.4.orig.tar.gz + 0ea70eb46b4c90a8dbefbe60bebe4b9f9abb2733 5308 hello-debhelper_2.4-3.diff.gz + + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iQEcBAEBCAAGBQJKml74AAoJEEHOfwufG4sysC4H/26EikyIgIqRuSXMiykc1hmd +97id9nWl+QzgCpUEg/+uDqEW+Bl6291FstGvzTFCwmB5JjH9ErH1LsyG1OLXbFUb +H89Em7qkl4o2ACTh255oM7FhVweof3UEaLCZMH+HZVVpHXNpEnhrfDvpTBbPGjUi +-----END PGP SIGNATURE----- +EOF + get_build_deps +} + +test_get_parsed_build_deps_dsc() { + local ARCH="amd64" + local BINARY_ARCH="no" + + cat > "$DEBIAN_CONTROL" << EOF +Format: 3.0 (quilt) +Source: haskell-concrete-typerep +Binary: libghc-concrete-typerep-dev, libghc-concrete-typerep-prof, libghc-concrete-typerep-doc +Architecture: any all +Version: 0.1.0.2-4 +Maintainer: Debian Haskell Group +Uploaders: Masayuki Hatta (mhatta) +Homepage: http://hackage.haskell.org/package/concrete-typerep +Standards-Version: 3.9.3 +Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-concrete-typerep +Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-concrete-typerep +Build-Depends: debhelper (>= 9), haskell-devscripts (>= 0.9), cdbs, ghc, ghc-prof, libghc-hashable-dev (<< 1.3), libghc-hashable-prof (<< 1.3) +Build-Depends-Indep: ghc-doc, libghc-hashable-doc (<< 1.3) +Package-List: + libghc-concrete-typerep-dev deb haskell extra arch=any + libghc-concrete-typerep-doc deb doc extra arch=all + libghc-concrete-typerep-prof deb haskell extra arch=any +Checksums-Sha1: + 7dc356eef28c83f606b792e3d39b68a04c1a6d98 3159 haskell-concrete-typerep_0.1.0.2.orig.tar.gz + a5b34d7dd7f1ef42b0afad86140efcd6997d09c1 2272 haskell-concrete-typerep_0.1.0.2-4.debian.tar.xz +Checksums-Sha256: + f72a41d9d8315528c7b0e13bf61e6122c7d236cb529c207cfb431cf272439e1f 3159 haskell-concrete-typerep_0.1.0.2.orig.tar.gz + 09dcedfef76799dcb3c6a9e22bc22711050cc56769614bdbf61b426579ce10e5 2272 haskell-concrete-typerep_0.1.0.2-4.debian.tar.xz +Files: + 5638a296661fb65145dfbc062cfa53db 3159 haskell-concrete-typerep_0.1.0.2.orig.tar.gz + 706754d44fac13c25e1ee8dd89180c53 2272 haskell-concrete-typerep_0.1.0.2-4.debian.tar.xz +EOF + get_build_deps | filter_arch_deps "$ARCH" | filter_restriction_deps "$DEB_BUILD_PROFILES" +} + +test_get_source_control_field_with_comments() { + cat <"$DEBIAN_CONTROL" +# This is a comment + +# So is this, but with a blank line above me +Format: 1.0 +Source: something-funny +Build-Depends: debhelper, something-else + +EOF + get_source_control_field "Source" +} + +trap cleanup sigpipe sighup exit + +# TODO move to build dir +DEBIAN_CONTROL="$(tempfile)" + +expect_output "autotools-dev (>= 1.2), debhelper, quilt (<< 12:0), libwxgtk2.8-dev, test [amd64 i386], test1, test2 [!i386 !amd64], test3 | test4, test5" \ + test_get_build_deps "no" +expect_output "autotools-dev (>= 1.2), debhelper, quilt (<< 12:0), libwxgtk2.8-dev" \ + test_get_build_deps "yes" + +expect_fail checkbuilddep_archdeps "foo [amd64]" "amd64" +expect_success checkbuilddep_archdeps "foo [i386]" "amd64" +expect_fail checkbuilddep_archdeps "foo [i386 amd64]" "amd64" +expect_success checkbuilddep_archdeps "foo [!amd64]" "amd64" +expect_success checkbuilddep_archdeps "foo [!i386 !amd64]" "amd64" + +test_filter_arch_deps() { + echo "$1" | filter_arch_deps "$2" +} + +expect_output "foo" test_filter_arch_deps "foo" "amd64" +expect_output "foo" test_filter_arch_deps "foo [amd64]" "amd64" +expect_output "bar, foo" test_filter_arch_deps "bar, foo [amd64]" "amd64" +expect_output "bar | foo" test_filter_arch_deps "bar | foo [amd64]" "amd64" +expect_output "bar" test_filter_arch_deps "bar | foo [amd64]" "i386" + +expect_fail checkbuilddep_restrictiondeps "foo " "" +expect_success checkbuilddep_restrictiondeps "foo " "stage1" +expect_fail checkbuilddep_restrictiondeps "foo " "notest" +expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" + +expect_success checkbuilddep_restrictiondeps "foo " "" +expect_fail checkbuilddep_restrictiondeps "foo " "stage1" +expect_success checkbuilddep_restrictiondeps "foo " "notest" +expect_fail checkbuilddep_restrictiondeps "foo " "stage1 notest" + +expect_fail checkbuilddep_restrictiondeps "foo " "" +expect_success checkbuilddep_restrictiondeps "foo " "stage1" +expect_success checkbuilddep_restrictiondeps "foo " "notest" +expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" + +expect_success checkbuilddep_restrictiondeps "foo " "" +expect_success checkbuilddep_restrictiondeps "foo " "stage1" +expect_success checkbuilddep_restrictiondeps "foo " "notest" +expect_fail checkbuilddep_restrictiondeps "foo " "stage1 notest" + +expect_success checkbuilddep_restrictiondeps "foo " "" +expect_success checkbuilddep_restrictiondeps "foo " "stage1" +expect_fail checkbuilddep_restrictiondeps "foo " "notest" +expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" + +expect_success checkbuilddep_restrictiondeps "foo " "" +expect_fail checkbuilddep_restrictiondeps "foo " "stage1" +expect_success checkbuilddep_restrictiondeps "foo " "notest" +expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" + +test_filter_restriction_deps() { + echo "$1" | filter_restriction_deps "$2" +} + +expect_output "foo" test_filter_restriction_deps "foo " "" +expect_output "" test_filter_restriction_deps "foo " "stage1" +expect_output "foo" test_filter_restriction_deps "foo " "stage1" +expect_output "bar, foo" test_filter_restriction_deps "bar, foo " "stage1" +expect_output "bar | foo" test_filter_restriction_deps "bar | foo " "stage1" +expect_output "bar" test_filter_restriction_deps "bar | foo " "stage1" + +test_filter_arch_restriction_deps() { + echo "$1" | filter_arch_deps "$2" | filter_restriction_deps "$3" +} + +expect_output "foo" test_filter_arch_restriction_deps "foo [amd64] " "amd64" "" +expect_output "" test_filter_arch_restriction_deps "foo [amd64] " "amd64" "" +expect_output "foo" test_filter_arch_restriction_deps "foo [amd64] " "amd64" "" +expect_output "" test_filter_arch_restriction_deps "foo [i386] " "amd64" "stage1" + +expect_output "debhelper (>= 7)" test_get_build_deps_dsc +expect_output "debhelper (>= 9), haskell-devscripts (>= 0.9), cdbs, ghc, ghc-prof, libghc-hashable-dev (<< 1.3), libghc-hashable-prof (<< 1.3), ghc-doc, libghc-hashable-doc (<< 1.3)" test_get_parsed_build_deps_dsc + +expect_output "something-funny" test_get_source_control_field_with_comments + +testlib_summary diff --git a/t/test_testlib.sh b/t/test_testlib.sh new file mode 100755 index 0000000..a37f6b1 --- /dev/null +++ b/t/test_testlib.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# testsuite for testlib + +TD="$(dirname "$0")" +if [ -n "$PBUILDER_CHECKOUT" ]; then + . "$TD/testlib.sh" + . "$PBUILDER_CHECKOUT/pbuilder-modules" +else + . "$TD/testlib.sh" + . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-modules" +fi + +test_success() { + exit 0 +} + +test_fail() { + exit 1 +} + +test_options() { + echo "$@" + exit 1 +} + +test_output() { + echo "$@" +} + +expect_success test_success +expect_fail test_fail +expect_fail test_options "hello world" +expect_output "foo bar" test_output "foo" "bar" +testlib_summary diff --git a/t/testlib.sh b/t/testlib.sh new file mode 100644 index 0000000..7d31888 --- /dev/null +++ b/t/testlib.sh @@ -0,0 +1,158 @@ +#!/bin/bash +# 2008 Junichi Uekawa + +set -e + +# library for functional unit-testing in bash. + +# WARNING: this file locates files differently from the other pbuilder +# functions: +# - if PBUILDER_CHECKOUT is set, it is assumed that testlib.sh is sourced from +# a pbuilder checkout (e.g. from the upstream Makefile or Debian build) +# - otherwise, PBUILDER_TEST_ROOT or PBUILDER_TEST_*DIR should be used to +# locate files instead of PBUILDER_ROOT and PBUILDER_*DIR since +# testlib_setup_env() overrides these vars to run the other pbuilder modules +# with a fake environment + +# if this is set, use pbuilder files from this location; otherwise, use +# installed files (from PBUILDER_TEST_ROOT, which is a copy of PBUILDER_ROOT) +PBUILDER_CHECKOUT="${PBUILDER_CHECKOUT:-}" + +if [ -z "$PBUILDER_CHECKOUT" ]; then + # these currently don't need to be exported + PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" + PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" + PBUILDER_TEST_PKGDATADIR="${PBUILDER_PKGDATADIR:-$PBUILDER_ROOT/usr/share/pbuilder}" +fi + +# set PBUILDER_TEST_VERBOSE to get the full output of tests + +TESTLIB_FAILS=0 +TESTLIB_TESTS=0 + +testlib_echo() { + case "$1" in + OK) + shift + if [ -n "$PBUILDER_TEST_VERBOSE" ]; then + echo "[OK]" "$@" >&2 + fi + ;; + FAIL) + shift + echo "[FAIL]" "$@" >&2 + TESTLIB_FAILS=$(($TESTLIB_FAILS + 1)) + ;; + esac + TESTLIB_TESTS=$(($TESTLIB_TESTS + 1)) +} + +testlib_summary() { + echo "$0: Ran $TESTLIB_TESTS tests and $(($TESTLIB_TESTS - $TESTLIB_FAILS)) succeeded, $TESTLIB_FAILS failed" + if [ $TESTLIB_FAILS != 0 ]; then + echo '=================' + echo 'Testsuite FAILED!' + echo " $0" + echo '=================' + return 1 + fi + return 0 +} + +# Create fake installed tree with basic config files. Make sure you trap test +# script exit to call testlib_cleanup_env. Optional arg is location of the +# pbuilder checkout to copy files from. +# this is where the env actually lives +testlib_env_root="" +testlib_setup_env() { + local abs_pbuilder_checkout r + + if [ -n "$testlib_env_root" ]; then + echo "testlib_setup_env called twice without testlib_cleanup_env" >&2 + testlib_cleanup_env + exit 1 + fi + + if [ -n "$PBUILDER_CHECKOUT" ]; then + abs_pbuilder_checkout="`cd $PBUILDER_CHECKOUT; pwd`" + fi + + # backup env vars + testlib_env_oldhome="$HOME" + testlib_env_oldroot="$PBUILDER_ROOT" + + testlib_env_root="`mktemp -dt`" + # brevity + r="$testlib_env_root" + + mkdir "$r"/etc + touch "$r"/etc/pbuilderrc + mkdir -p "$r"/usr/share/pbuilder + if [ -n "$PBUILDER_CHECKOUT" ]; then + cp "$PBUILDER_CHECKOUT"/pbuilderrc "$r"/usr/share/pbuilder + else + cp "$PBUILDER_TEST_PKGDATADIR"/pbuilderrc "$r"/usr/share/pbuilder + fi + mkdir -p "$r"/usr/lib + if [ -n "$PBUILDER_CHECKOUT" ]; then + ln -s "$abs_pbuilder_checkout" "$r"/usr/lib/pbuilder + else + ln -s "$PBUILDER_TEST_PKGLIBDIR" "$r"/usr/lib/pbuilder + fi + export PBUILDER_ROOT="$r" + # when running the testsuite within pbuilder, these env vars will have been + # set by regular pbuilder commands, so we need to unset them as to allow + # their default values to be recomputed relative to PBUILDER_ROOT + unset PBUILDER_PKGLIBDIR PBUILDER_PKGDATADIR PBUILDER_SYSCONFDIR + + mkdir "$r"/home + touch "$r"/home/.pbuilderrc + export HOME="$r"/home +} + +# Reverse the effect of testlib_setup_env. Setup a trap handler in your tests +# on this function if you call testlib_setup_env. +testlib_cleanup_env() { + if [ -z "$testlib_env_root" ]; then + # nothing to do + return + fi + rm -rf "$testlib_env_root" + export PBUILDER_ROOT="$testlib_env_oldroot" + export HOME="$testlib_env_oldhome" + testlib_env_root="" +} + +expect_success() { + # run the test in subshell; successful commands should not output anything + # to stderr but may send output to stdout + if (if [ -z "$PBUILDER_TEST_VERBOSE" ]; then exec >/dev/null; fi; "$@"); then + testlib_echo "OK" "$1" + else + testlib_echo "FAIL" "$1" + fi +} + +expect_fail() { + # run the test in subshell; failed commands may output anything to stdout + # and stderr + if (if [ -z "$PBUILDER_TEST_VERBOSE" ]; then exec >/dev/null 2>&1; fi; "$@"); then + testlib_echo "FAIL" "$1" + else + testlib_echo "OK" "$1" + fi +} + +expect_output() { + # run the test in subshell + local val result + val="$1" + shift + result="`"$@" 2>&1`" || true + if [ "$result" = "$val" ]; then + testlib_echo "OK" "$1" + else + testlib_echo "FAIL" "$1" "expected [$val] but got [$result]" + fi +} + diff --git a/test_pbuilder-apt-config b/test_pbuilder-apt-config deleted file mode 100755 index 9db4c4e..0000000 --- a/test_pbuilder-apt-config +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/bash - -set -e - -self="$(basename "$0")" - -# if this is set, use pbuilder files from this location; otherwise, use -# installed files (from PBUILDER_TEST_ROOT, which is a copy of PBUILDER_ROOT) -PBUILDER_CHECKOUT="${PBUILDER_CHECKOUT:-}" - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" - - PBUILDER_APT_CONFIG="$PBUILDER_CHECKOUT/pbuilder-apt-config" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" - - PBUILDER_APT_CONFIG="$PBUILDER_TEST_PKGLIBDIR/pbuilder-apt-config" -fi - -mirror_map="" - -cleanup() { - if [ -n "$mirror_map" ]; then - rm -f "$mirror_map" - fi -} - -mirror_map="$(mktemp -t "$self.XXXXXXXXXX")" -cat >"$mirror_map" < -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# On Debian systems, the full text of the GNU General Public -# License version 2 can be found in the file -# `/usr/share/common-licenses/GPL-2'. - - -# testsuite to test pbuilder-satisfydepends-funcs. - - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" - - . "$PBUILDER_CHECKOUT/pbuilder-buildpackage-funcs" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" - - . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-buildpackage-funcs" -fi - -DEBIAN_CONTROL="" - -cleanup() { - if [ -n "$DEBIAN_CONTROL" ]; then - rm -f "$DEBIAN_CONTROL" - fi -} - -test_getdscfilesNormal () { - - cat > "$DEBIAN_CONTROL" << EOF ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -Format: 3.0 (quilt) -Source: libeatmydata -Binary: eatmydata, libeatmydata1 -Architecture: any all -Version: 82-6 -Maintainer: Modestas Vainius -Uploaders: Mattia Rizzolo -Homepage: https://launchpad.net/libeatmydata -Standards-Version: 3.9.6 -Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/libeatmydata.git -Vcs-Git: git://anonscm.debian.org/collab-maint/libeatmydata.git -Build-Depends: autotools-dev, debhelper (>= 9), strace [!hurd-any !kfreebsd-any] -Package-List: - eatmydata deb utils optional arch=all - libeatmydata1 deb utils optional arch=any -Checksums-Sha1: - c8d3cd2d9a872302c8a1494813565639bd4c2aa8 407977 libeatmydata_82.orig.tar.gz - 4a76697591072662acee1e25d7f86c1f6ac503dd 43484 libeatmydata_82-6.debian.tar.xz -Checksums-Sha256: - 0b675f58069f912727cee5eb75f9ff1a6a8300fe7e3fe4fc6bdd03b7c2c15b29 407977 libeatmydata_82.orig.tar.gz - 3b5aede6617ed161211aee6f421d6af3c1ae22a4f4d11dc6545138359d7eea2c 43484 libeatmydata_82-6.debian.tar.xz -Files: - 56a4d342f209ab75a9ee360236e3e5bc 407977 libeatmydata_82.orig.tar.gz - 06c197d3d4142b546e836d72fbe4b895 43484 libeatmydata_82-6.debian.tar.xz - ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.12 (GNU/Linux) - -iD8DBQFUfLA320zMSyow1ykRAkRxAJ4zYyuUByiYq31sxbrB902PybqADwCfd/Gd -SPXUusVdt4obPwG2sauWLlc= -=e9Vj ------END PGP SIGNATURE----- -EOF - getdscfiles "$DEBIAN_CONTROL" -} - -test_getdscfilesWithoutNL () { - - cat > "$DEBIAN_CONTROL" << EOF ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA256 - -Format: 3.0 (quilt) -Source: golang-xmpp-dev -Binary: golang-xmpp-dev -Architecture: all -Version: 0.0~git20140304-1 -Maintainer: Jacob Appelbaum -Homepage: https://www.github.com/agl/xmpp -Standards-Version: 3.9.5 -Build-Depends: debhelper (>= 9) -Package-List: - golang-xmpp-dev deb devel extra -Checksums-Sha1: - 2175fd06e8fcf9787044036837f21b7e6c3d2ceb 10040 golang-xmpp-dev_0.0~git20140304.orig.tar.gz - 72b5180710909e30208627bd77dd899751475309 2208 golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz -Checksums-Sha256: - 41805d983433423eb967628c43f033a19f6c8363c3d40a5931a5eb28f4e9133c 10040 golang-xmpp-dev_0.0~git20140304.orig.tar.gz - 54f49f52c2c1399c8262afc582e1ce38ef99cd4d95cd06f9350a91960176a925 2208 golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz -Files: - a00613a2e965c11c9713268c25486a1b 10040 golang-xmpp-dev_0.0~git20140304.orig.tar.gz - e5bc6c49ca86922344531418dee9e5dd 2208 golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz ------BEGIN PGP SIGNATURE----- - -iQGVAwUBUxYUR1kMfZESRfeDAQgvCwv8CM7a+LcQQnk5Gil3jHHlr4EO6NvuDMpW -4+yviAFZCmOVq3poUKYpojNNtIBPSGh2+POEOZu+6h1rQxQpPeiqrIteS4pMhR7s -bptUqqAbRH/Yy9pcmPOf+yDeeGAr/xaga9vvankdn60Q5D7Xk85Bhl6a3KucCwGA -h5s/ywDXZVOtjqywoB+zR5Jd2kuhjJUUdnUxTvVrw+rZXaKcwgAM1zUv6Tqkdkij -NRJFW5p17c1gg0v7KvWcCJoNcF5Mn1avnTF7OhZm5ODreM9kgpcd+8yuG3n6j/Ey -o4E6p2Tf5wTQ2t44OaU1uu8+0mjPhDxfEjGKcdThWQyrqO0hkGAfLkubLGRB4EZo -dcWK+KNxOR5HzgQGJw+rEGn/x7kcQtdDeXn3EsHeAhJscicdbJW9nCM47+PLM7Pn -B3WfTzfwrzVC/IcSM1303chIW0dfsMTCP0ubFZOqoMMflSKRPiJ3vPvJFFzmrS31 -M4EDxlS+nvAHZbzQ49QGnU/dMocDzvAH -=XSwB ------END PGP SIGNATURE----- -EOF - getdscfiles "$DEBIAN_CONTROL" - -} - -trap cleanup sigpipe sighup exit - -# FIXME move to build dir also because we have to hardoce /tmp/ on the result below -DEBIAN_CONTROL="$(tempfile)" - -expect_output "$DEBIAN_CONTROL /tmp/libeatmydata_82.orig.tar.gz /tmp/libeatmydata_82-6.debian.tar.xz" test_getdscfilesNormal -expect_output "$DEBIAN_CONTROL /tmp/golang-xmpp-dev_0.0~git20140304.orig.tar.gz /tmp/golang-xmpp-dev_0.0~git20140304-1.debian.tar.xz" test_getdscfilesWithoutNL - -testlib_summary diff --git a/test_pbuilder-checkparams b/test_pbuilder-checkparams deleted file mode 100755 index cc1af9e..0000000 --- a/test_pbuilder-checkparams +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# testsuite for pbuilder-checkparams - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" -fi - -# setup a fake installed environment -trap testlib_cleanup_env sigpipe sighup exit -testlib_setup_env - -if [ -n "$PBUILDER_CHECKOUT" ]; then - PBUILDER_CHECKPARAMS="$PBUILDER_CHECKOUT/pbuilder-checkparams" -else - export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - PBUILDER_CHECKPARAMS="$PBUILDER_PKGLIBDIR/pbuilder-checkparams" -fi - -test_debuildopts() { - . "$PBUILDER_CHECKPARAMS" - echo "$DEBBUILDOPTS" -} - -expect_output "" \ - test_debuildopts foo.dsc -expect_output "" \ - test_debuildopts --debbuildopts "" foo.dsc -expect_output "-v1.0 -efoo" \ - test_debuildopts --debbuildopts "-v1.0 -efoo" foo.dsc -expect_output "-v1.0 -efoo" \ - test_debuildopts --debbuildopts -v1.0 --debbuildopts -efoo foo.dsc -expect_output "-efoo" \ - test_debuildopts --debbuildopts -v1.0 --debbuildopts "" --debbuildopts -efoo foo.dsc - -testlib_summary diff --git a/test_pbuilder-modules b/test_pbuilder-modules deleted file mode 100755 index d010c98..0000000 --- a/test_pbuilder-modules +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" - - . "$PBUILDER_CHECKOUT/pbuilder-modules" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" - - . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-modules" -fi - -function test_information() { - log "I: test" - log "W: warning" - log "E: error" -} -expect_output "I: test -W: warning -E: error" test_information - -# test the non-copy case -function test_conditional_cp_a() { - ( - TEMPDIR=$(mktemp -d) - cd "${TEMPDIR}" - touch "hoge" - outdir=$(readlink -f "${TEMPDIR}/..") - conditional_cp_a "hoge" "${outdir}" echo - ) -} -expect_output "I: file hoge is already in target, not copying." \ - test_conditional_cp_a - -# test the copy case. -function test_conditional_cp_a_copy() { - ( - cd /tmp - outdir=/something-else - conditional_cp_a "hoge" "${outdir}" echo - ) -} -expect_output "-a hoge /something-else" test_conditional_cp_a_copy - -testlib_summary diff --git a/test_pbuilder-satisfydepends-checkparams b/test_pbuilder-satisfydepends-checkparams deleted file mode 100755 index 036a048..0000000 --- a/test_pbuilder-satisfydepends-checkparams +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" - - PBUILDER_SATISFYDEPENDS_CHECKPARAMS="$PBUILDER_CHECKOUT/pbuilder-satisfydepends-checkparams" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" - - PBUILDER_SATISFYDEPENDS_CHECKPARAMS="$PBUILDER_TEST_PKGLIBDIR/pbuilder-satisfydepends-checkparams" -fi - -# testsuite to test pbuilder-satisfydepends-checkparams. - -# mock function -checkbuilddep_internal() { - : # do nothing function -} - -test_chrootexec2() { - set -- --internal-chrootexec 'chroot /tmp-hoge ' --chroot /tmp - . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" -} -expect_fail test_chrootexec2 - -test_chrootexec1() { - set -- --chroot /tmp --internal-chrootexec 'chroot /tmp-hoge ' - . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" -} -expect_success test_chrootexec1 - -test_chrootexec_echo() { - set -- --echo --chroot /tmp - . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" -} -expect_fail test_chrootexec_echo - -test_chrootexec_echo2() { - set -- --chroot /tmp --echo - . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" - echo $CHROOTEXEC -} -expect_output "echo chroot /tmp" test_chrootexec_echo2 - -test_chrootexec_expect() { - set -- --chroot /tmp --internal-chrootexec 'chroot /tmp-hoge ' - . "$PBUILDER_SATISFYDEPENDS_CHECKPARAMS" - echo $CHROOTEXEC -} -expect_output "chroot /tmp-hoge" test_chrootexec_expect - -testlib_summary diff --git a/test_pbuilder-satisfydepends-classic b/test_pbuilder-satisfydepends-classic deleted file mode 100755 index c70c778..0000000 --- a/test_pbuilder-satisfydepends-classic +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash -#for flavour in aptitude classic experimental gdebi; do -# (. ./pbuilder-satisfydepends-"$flavour") -#done - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" - - PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_CHECKOUT/pbuilder-satisfydepends-classic" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" - - PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_TEST_PKGLIBDIR/pbuilder-satisfydepends-classic" -fi - -DEBIAN_CONTROL="" - -cleanup() { - if [ -n "$DEBIAN_CONTROL" ]; then - rm -f "$DEBIAN_CONTROL" - fi - testlib_cleanup_env -} - -trap cleanup sigpipe sighup exit - -# setup a fake installed environment -testlib_setup_env - -if [ -n "$PBUILDER_CHECKOUT" ]; then - PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_CHECKOUT/pbuilder-satisfydepends-classic" -else - export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - PBUILDER_SATISFYDEPENDS_CLASSIC="$PBUILDER_PKGLIBDIR/pbuilder-satisfydepends-classic" -fi - -set -- --echo --control "$DEBIAN_CONTROL" -# this is just to source the functions -. "$PBUILDER_SATISFYDEPENDS_CLASSIC" >/dev/null 2>&1 || true - -DEBIAN_CONTROL="`mktemp -t`" -cat >"$DEBIAN_CONTROL" <= 5.0.0), gnome-pkg-tools, autotools-dev, cdbs, libglib2.0-dev (>= 2.12), libgtk2.0-dev (>= 2.10), libgnome2-dev (>= 2.16.0), libgnomeui-dev (>= 2.16.0), libglade2-dev, libgnomevfs2-dev (>= 2.9.2), libgconf2-dev, libxft-dev, libperl-dev, python-dev, tcl8.4-dev, libxml-parser-perl, libdbus-glib-1-dev (>= 0.60), libtool, scrollkeeper, libgnutls-dev, libnotify-dev (>= 0.3.2-0), libsexy-dev (>= 0.1.7), gnome-doc-utils, libssl-dev (>= 0.9.8b-1), liblaunchpad-integration-dev - -EOF - -test_split_deps() { - get_build_deps | split_deps -} - -expect_output "debhelper/(>=/5.0.0) -gnome-pkg-tools -autotools-dev -cdbs -libglib2.0-dev/(>=/2.12) -libgtk2.0-dev/(>=/2.10) -libgnome2-dev/(>=/2.16.0) -libgnomeui-dev/(>=/2.16.0) -libglade2-dev -libgnomevfs2-dev/(>=/2.9.2) -libgconf2-dev -libxft-dev -libperl-dev -python-dev -tcl8.4-dev -libxml-parser-perl -libdbus-glib-1-dev/(>=/0.60) -libtool -scrollkeeper -libgnutls-dev -libnotify-dev/(>=/0.3.2-0) -libsexy-dev/(>=/0.1.7) -gnome-doc-utils -libssl-dev/(>=/0.9.8b-1) -liblaunchpad-integration-dev" test_split_deps - -expect_output "foo -bar" split_alternates "foo | bar" - -expect_output "debhelper -gnome-pkg-tools -autotools-dev -cdbs -libglib2.0-dev -libgtk2.0-dev -libgnome2-dev -libgnomeui-dev -libglade2-dev -libgnomevfs2-dev -libgconf2-dev -libxft-dev -libperl-dev -python-dev -tcl8.4-dev -libxml-parser-perl -libdbus-glib-1-dev -libtool -scrollkeeper -libgnutls-dev -libnotify-dev -libsexy-dev -gnome-doc-utils -libssl-dev -liblaunchpad-integration-dev" get_pkg_name "`test_split_deps`" - -expect_output ">= 5.0.0 ->= 2.12 ->= 2.10 ->= 2.16.0 ->= 2.16.0 ->= 2.9.2 ->= 0.60 ->= 0.3.2-0 ->= 0.1.7 ->= 0.9.8b-1" get_dep_op_and_ver "`test_split_deps`" - -testlib_summary diff --git a/test_pbuilder-satisfydepends-funcs b/test_pbuilder-satisfydepends-funcs deleted file mode 100755 index 9cfc7f2..0000000 --- a/test_pbuilder-satisfydepends-funcs +++ /dev/null @@ -1,206 +0,0 @@ -#!/bin/bash - -# testsuite to test pbuilder-satisfydepends-funcs. - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" - - . "$PBUILDER_CHECKOUT/pbuilder-satisfydepends-funcs" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" - - . "$PBUILDER_TEST_PKGLIBDIR/pbuilder-satisfydepends-funcs" -fi - -DEBIAN_CONTROL="" - -cleanup() { - if [ -n "$DEBIAN_CONTROL" ]; then - rm -f "$DEBIAN_CONTROL" - fi -} - -test_get_build_deps() { - local BINARY_ARCH - - BINARY_ARCH="$1" - - cat <"$DEBIAN_CONTROL" -Source: amule -XXXX: -Build-Depends: - autotools-dev ( >= 1.2 ) , - debhelper , - quilt(<<12:0), -## - libwxgtk2.8-dev -Build-Depends-Indep: test [ amd64 i386 ], test1, - test2[!i386 ! amd64], test3 | - test4, test5 -Misc: test - -Build-Depends: wrong build depends, line -Description: test - other things - wow -EOF - get_build_deps -} - -test_get_build_deps_dsc() { - cat <"$DEBIAN_CONTROL" ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA256 - -Format: 1.0 -Source: hello-debhelper -Build-Depends: debhelper (>= 7) -Checksums-Sha1: - fcbf0264928900adf03a7797474375e1a6fa3836 499638 hello-debhelper_2.4.orig.tar.gz - 0ea70eb46b4c90a8dbefbe60bebe4b9f9abb2733 5308 hello-debhelper_2.4-3.diff.gz - - ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.9 (GNU/Linux) - -iQEcBAEBCAAGBQJKml74AAoJEEHOfwufG4sysC4H/26EikyIgIqRuSXMiykc1hmd -97id9nWl+QzgCpUEg/+uDqEW+Bl6291FstGvzTFCwmB5JjH9ErH1LsyG1OLXbFUb -H89Em7qkl4o2ACTh255oM7FhVweof3UEaLCZMH+HZVVpHXNpEnhrfDvpTBbPGjUi ------END PGP SIGNATURE----- -EOF - get_build_deps -} - -test_get_parsed_build_deps_dsc() { - local ARCH="amd64" - local BINARY_ARCH="no" - - cat > "$DEBIAN_CONTROL" << EOF -Format: 3.0 (quilt) -Source: haskell-concrete-typerep -Binary: libghc-concrete-typerep-dev, libghc-concrete-typerep-prof, libghc-concrete-typerep-doc -Architecture: any all -Version: 0.1.0.2-4 -Maintainer: Debian Haskell Group -Uploaders: Masayuki Hatta (mhatta) -Homepage: http://hackage.haskell.org/package/concrete-typerep -Standards-Version: 3.9.3 -Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-concrete-typerep -Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-concrete-typerep -Build-Depends: debhelper (>= 9), haskell-devscripts (>= 0.9), cdbs, ghc, ghc-prof, libghc-hashable-dev (<< 1.3), libghc-hashable-prof (<< 1.3) -Build-Depends-Indep: ghc-doc, libghc-hashable-doc (<< 1.3) -Package-List: - libghc-concrete-typerep-dev deb haskell extra arch=any - libghc-concrete-typerep-doc deb doc extra arch=all - libghc-concrete-typerep-prof deb haskell extra arch=any -Checksums-Sha1: - 7dc356eef28c83f606b792e3d39b68a04c1a6d98 3159 haskell-concrete-typerep_0.1.0.2.orig.tar.gz - a5b34d7dd7f1ef42b0afad86140efcd6997d09c1 2272 haskell-concrete-typerep_0.1.0.2-4.debian.tar.xz -Checksums-Sha256: - f72a41d9d8315528c7b0e13bf61e6122c7d236cb529c207cfb431cf272439e1f 3159 haskell-concrete-typerep_0.1.0.2.orig.tar.gz - 09dcedfef76799dcb3c6a9e22bc22711050cc56769614bdbf61b426579ce10e5 2272 haskell-concrete-typerep_0.1.0.2-4.debian.tar.xz -Files: - 5638a296661fb65145dfbc062cfa53db 3159 haskell-concrete-typerep_0.1.0.2.orig.tar.gz - 706754d44fac13c25e1ee8dd89180c53 2272 haskell-concrete-typerep_0.1.0.2-4.debian.tar.xz -EOF - get_build_deps | filter_arch_deps "$ARCH" | filter_restriction_deps "$DEB_BUILD_PROFILES" -} - -test_get_source_control_field_with_comments() { - cat <"$DEBIAN_CONTROL" -# This is a comment - -# So is this, but with a blank line above me -Format: 1.0 -Source: something-funny -Build-Depends: debhelper, something-else - -EOF - get_source_control_field "Source" -} - -trap cleanup sigpipe sighup exit - -# TODO move to build dir -DEBIAN_CONTROL="$(tempfile)" - -expect_output "autotools-dev (>= 1.2), debhelper, quilt (<< 12:0), libwxgtk2.8-dev, test [amd64 i386], test1, test2 [!i386 !amd64], test3 | test4, test5" \ - test_get_build_deps "no" -expect_output "autotools-dev (>= 1.2), debhelper, quilt (<< 12:0), libwxgtk2.8-dev" \ - test_get_build_deps "yes" - -expect_fail checkbuilddep_archdeps "foo [amd64]" "amd64" -expect_success checkbuilddep_archdeps "foo [i386]" "amd64" -expect_fail checkbuilddep_archdeps "foo [i386 amd64]" "amd64" -expect_success checkbuilddep_archdeps "foo [!amd64]" "amd64" -expect_success checkbuilddep_archdeps "foo [!i386 !amd64]" "amd64" - -test_filter_arch_deps() { - echo "$1" | filter_arch_deps "$2" -} - -expect_output "foo" test_filter_arch_deps "foo" "amd64" -expect_output "foo" test_filter_arch_deps "foo [amd64]" "amd64" -expect_output "bar, foo" test_filter_arch_deps "bar, foo [amd64]" "amd64" -expect_output "bar | foo" test_filter_arch_deps "bar | foo [amd64]" "amd64" -expect_output "bar" test_filter_arch_deps "bar | foo [amd64]" "i386" - -expect_fail checkbuilddep_restrictiondeps "foo " "" -expect_success checkbuilddep_restrictiondeps "foo " "stage1" -expect_fail checkbuilddep_restrictiondeps "foo " "notest" -expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" - -expect_success checkbuilddep_restrictiondeps "foo " "" -expect_fail checkbuilddep_restrictiondeps "foo " "stage1" -expect_success checkbuilddep_restrictiondeps "foo " "notest" -expect_fail checkbuilddep_restrictiondeps "foo " "stage1 notest" - -expect_fail checkbuilddep_restrictiondeps "foo " "" -expect_success checkbuilddep_restrictiondeps "foo " "stage1" -expect_success checkbuilddep_restrictiondeps "foo " "notest" -expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" - -expect_success checkbuilddep_restrictiondeps "foo " "" -expect_success checkbuilddep_restrictiondeps "foo " "stage1" -expect_success checkbuilddep_restrictiondeps "foo " "notest" -expect_fail checkbuilddep_restrictiondeps "foo " "stage1 notest" - -expect_success checkbuilddep_restrictiondeps "foo " "" -expect_success checkbuilddep_restrictiondeps "foo " "stage1" -expect_fail checkbuilddep_restrictiondeps "foo " "notest" -expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" - -expect_success checkbuilddep_restrictiondeps "foo " "" -expect_fail checkbuilddep_restrictiondeps "foo " "stage1" -expect_success checkbuilddep_restrictiondeps "foo " "notest" -expect_success checkbuilddep_restrictiondeps "foo " "stage1 notest" - -test_filter_restriction_deps() { - echo "$1" | filter_restriction_deps "$2" -} - -expect_output "foo" test_filter_restriction_deps "foo " "" -expect_output "" test_filter_restriction_deps "foo " "stage1" -expect_output "foo" test_filter_restriction_deps "foo " "stage1" -expect_output "bar, foo" test_filter_restriction_deps "bar, foo " "stage1" -expect_output "bar | foo" test_filter_restriction_deps "bar | foo " "stage1" -expect_output "bar" test_filter_restriction_deps "bar | foo " "stage1" - -test_filter_arch_restriction_deps() { - echo "$1" | filter_arch_deps "$2" | filter_restriction_deps "$3" -} - -expect_output "foo" test_filter_arch_restriction_deps "foo [amd64] " "amd64" "" -expect_output "" test_filter_arch_restriction_deps "foo [amd64] " "amd64" "" -expect_output "foo" test_filter_arch_restriction_deps "foo [amd64] " "amd64" "" -expect_output "" test_filter_arch_restriction_deps "foo [i386] " "amd64" "stage1" - -expect_output "debhelper (>= 7)" test_get_build_deps_dsc -expect_output "debhelper (>= 9), haskell-devscripts (>= 0.9), cdbs, ghc, ghc-prof, libghc-hashable-dev (<< 1.3), libghc-hashable-prof (<< 1.3), ghc-doc, libghc-hashable-doc (<< 1.3)" test_get_parsed_build_deps_dsc - -expect_output "something-funny" test_get_source_control_field_with_comments - -testlib_summary diff --git a/test_testlib.sh b/test_testlib.sh deleted file mode 100755 index be20c58..0000000 --- a/test_testlib.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# testsuite for testlib - -if [ -n "$PBUILDER_CHECKOUT" ]; then - . "$PBUILDER_CHECKOUT/testlib.sh" -else - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - . "$PBUILDER_TEST_PKGLIBDIR/testlib.sh" -fi - -test_success() { - exit 0 -} - -test_fail() { - exit 1 -} - -test_options() { - echo "$@" - exit 1 -} - -test_output() { - echo "$@" -} - -expect_success test_success -expect_fail test_fail -expect_fail test_options "hello world" -expect_output "foo bar" test_output "foo" "bar" -testlib_summary diff --git a/testlib.sh b/testlib.sh deleted file mode 100644 index 7d31888..0000000 --- a/testlib.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/bash -# 2008 Junichi Uekawa - -set -e - -# library for functional unit-testing in bash. - -# WARNING: this file locates files differently from the other pbuilder -# functions: -# - if PBUILDER_CHECKOUT is set, it is assumed that testlib.sh is sourced from -# a pbuilder checkout (e.g. from the upstream Makefile or Debian build) -# - otherwise, PBUILDER_TEST_ROOT or PBUILDER_TEST_*DIR should be used to -# locate files instead of PBUILDER_ROOT and PBUILDER_*DIR since -# testlib_setup_env() overrides these vars to run the other pbuilder modules -# with a fake environment - -# if this is set, use pbuilder files from this location; otherwise, use -# installed files (from PBUILDER_TEST_ROOT, which is a copy of PBUILDER_ROOT) -PBUILDER_CHECKOUT="${PBUILDER_CHECKOUT:-}" - -if [ -z "$PBUILDER_CHECKOUT" ]; then - # these currently don't need to be exported - PBUILDER_TEST_ROOT="${PBUILDER_ROOT:-}" - PBUILDER_TEST_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}" - PBUILDER_TEST_PKGDATADIR="${PBUILDER_PKGDATADIR:-$PBUILDER_ROOT/usr/share/pbuilder}" -fi - -# set PBUILDER_TEST_VERBOSE to get the full output of tests - -TESTLIB_FAILS=0 -TESTLIB_TESTS=0 - -testlib_echo() { - case "$1" in - OK) - shift - if [ -n "$PBUILDER_TEST_VERBOSE" ]; then - echo "[OK]" "$@" >&2 - fi - ;; - FAIL) - shift - echo "[FAIL]" "$@" >&2 - TESTLIB_FAILS=$(($TESTLIB_FAILS + 1)) - ;; - esac - TESTLIB_TESTS=$(($TESTLIB_TESTS + 1)) -} - -testlib_summary() { - echo "$0: Ran $TESTLIB_TESTS tests and $(($TESTLIB_TESTS - $TESTLIB_FAILS)) succeeded, $TESTLIB_FAILS failed" - if [ $TESTLIB_FAILS != 0 ]; then - echo '=================' - echo 'Testsuite FAILED!' - echo " $0" - echo '=================' - return 1 - fi - return 0 -} - -# Create fake installed tree with basic config files. Make sure you trap test -# script exit to call testlib_cleanup_env. Optional arg is location of the -# pbuilder checkout to copy files from. -# this is where the env actually lives -testlib_env_root="" -testlib_setup_env() { - local abs_pbuilder_checkout r - - if [ -n "$testlib_env_root" ]; then - echo "testlib_setup_env called twice without testlib_cleanup_env" >&2 - testlib_cleanup_env - exit 1 - fi - - if [ -n "$PBUILDER_CHECKOUT" ]; then - abs_pbuilder_checkout="`cd $PBUILDER_CHECKOUT; pwd`" - fi - - # backup env vars - testlib_env_oldhome="$HOME" - testlib_env_oldroot="$PBUILDER_ROOT" - - testlib_env_root="`mktemp -dt`" - # brevity - r="$testlib_env_root" - - mkdir "$r"/etc - touch "$r"/etc/pbuilderrc - mkdir -p "$r"/usr/share/pbuilder - if [ -n "$PBUILDER_CHECKOUT" ]; then - cp "$PBUILDER_CHECKOUT"/pbuilderrc "$r"/usr/share/pbuilder - else - cp "$PBUILDER_TEST_PKGDATADIR"/pbuilderrc "$r"/usr/share/pbuilder - fi - mkdir -p "$r"/usr/lib - if [ -n "$PBUILDER_CHECKOUT" ]; then - ln -s "$abs_pbuilder_checkout" "$r"/usr/lib/pbuilder - else - ln -s "$PBUILDER_TEST_PKGLIBDIR" "$r"/usr/lib/pbuilder - fi - export PBUILDER_ROOT="$r" - # when running the testsuite within pbuilder, these env vars will have been - # set by regular pbuilder commands, so we need to unset them as to allow - # their default values to be recomputed relative to PBUILDER_ROOT - unset PBUILDER_PKGLIBDIR PBUILDER_PKGDATADIR PBUILDER_SYSCONFDIR - - mkdir "$r"/home - touch "$r"/home/.pbuilderrc - export HOME="$r"/home -} - -# Reverse the effect of testlib_setup_env. Setup a trap handler in your tests -# on this function if you call testlib_setup_env. -testlib_cleanup_env() { - if [ -z "$testlib_env_root" ]; then - # nothing to do - return - fi - rm -rf "$testlib_env_root" - export PBUILDER_ROOT="$testlib_env_oldroot" - export HOME="$testlib_env_oldhome" - testlib_env_root="" -} - -expect_success() { - # run the test in subshell; successful commands should not output anything - # to stderr but may send output to stdout - if (if [ -z "$PBUILDER_TEST_VERBOSE" ]; then exec >/dev/null; fi; "$@"); then - testlib_echo "OK" "$1" - else - testlib_echo "FAIL" "$1" - fi -} - -expect_fail() { - # run the test in subshell; failed commands may output anything to stdout - # and stderr - if (if [ -z "$PBUILDER_TEST_VERBOSE" ]; then exec >/dev/null 2>&1; fi; "$@"); then - testlib_echo "FAIL" "$1" - else - testlib_echo "OK" "$1" - fi -} - -expect_output() { - # run the test in subshell - local val result - val="$1" - shift - result="`"$@" 2>&1`" || true - if [ "$result" = "$val" ]; then - testlib_echo "OK" "$1" - else - testlib_echo "FAIL" "$1" "expected [$val] but got [$result]" - fi -} - -- cgit v1.2.3