Skip to content

Commit

Permalink
mail-client/neomutt: Add unit tests
Browse files Browse the repository at this point in the history
This change addds unit tests to neomutt. Those tests come in a separate
package as upstream maintains them in a separate repository.

Closes: https://bugs.gentoo.org/734122
Closes: https://bugs.gentoo.org/728886
Signed-off-by: Nicolas Bock <nicolasbock@gentoo.org>
  • Loading branch information
nicolasbock committed Aug 22, 2020
1 parent ffd4594 commit 5026956
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
1 change: 1 addition & 0 deletions mail-client/neomutt-test-files/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST neomutt-test-files-20200626.tar.gz 3673 BLAKE2B 50354f19aedc5fc07d59ecb5b38fa65de16119bc0929f47014bd35dab4d3a4e5953c8b35670f3440003cf0cbccc2d0d2b3a869dc929cdc3cd60b02790270fb54 SHA512 3d4962210bc558234d818801dcaa7851a0aef011c96d91c054af535186ffda42059fc61fb148c48e1b076999fe3159b31589a69a29ed1897f8928f52fcc157d3
7 changes: 7 additions & 0 deletions mail-client/neomutt-test-files/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nicolasbock@gentoo.org</email>
</maintainer>
</pkgmetadata>
37 changes: 37 additions & 0 deletions mail-client/neomutt-test-files/neomutt-test-files-20200626.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

UPSTREAM_COMMIT="8629adab700a75c54e8e28bf05ad092503a98f75"
SRC_URI="https://github.com/neomutt/${PN}/archive/${UPSTREAM_COMMIT}.tar.gz -> ${P}.tar.gz"

DESCRIPTION="Test files for the main NeoMutt source"
HOMEPAGE="https://neomutt.org/"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

S="${WORKDIR}/${PN}-${UPSTREAM_COMMIT}"

src_unpack() {
if [[ -n ${A} ]]; then
mkdir --verbose -p "${S}" || die "Could not create ${S}"
fi
}

src_prepare() {
if [[ -n ${A} ]]; then
cd "${DISTDIR}" || die "Could not cd into DISTDIR"
cp --verbose ${A[@]} "${S}" || die "Could not copy package"
fi
eapply_user
}

src_install() {
dodir /usr/share/${P}
insinto /usr/share/${P}
doins "${S}/${P}.tar.gz"
}
24 changes: 18 additions & 6 deletions mail-client/neomutt/neomutt-20200626-r1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ LICENSE="GPL-2"
SLOT="0"
IUSE="berkdb doc gdbm gnutls gpgme idn kerberos kyotocabinet libressl
lmdb nls notmuch pgp-classic qdbm sasl selinux slang smime-classic
ssl tokyocabinet"

# Disable tests until neomutt-test-files are avablae
# (https://bugs.gentoo.org/734122)
RESTRICT=test
ssl tokyocabinet test"

CDEPEND="
app-misc/mime-types
Expand Down Expand Up @@ -64,11 +60,15 @@ DEPEND="${CDEPEND}
dev-libs/libxslt
app-text/docbook-xsl-stylesheets
|| ( www-client/lynx www-client/w3m www-client/elinks )
)"
)
test? ( ~mail-client/neomutt-test-files-${PV} )
"
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-mutt )
"

RESTRICT="!test? ( test )"

src_configure() {
local myconf=(
"$(usex doc --full-doc --disable-doc)"
Expand All @@ -94,11 +94,23 @@ src_configure() {
"--sysconfdir=${EPREFIX}/etc/${PN}"
"$(use_enable ssl)"
"$(use_enable gnutls)"

"$(usex test --testing)"
)

econf CCACHE=none "${myconf[@]}"
}

src_test() {
local test_dir=$(mktemp --directory)
tar -C ${test_dir} --strip-components 1 -xvf /usr/share/neomutt-test-files-${PV}/neomutt-test-files-${PV}.tar.gz
pushd ${test_dir} || die "Cannot cd into testdir"
NEOMUTT_TEST_DIR="${test_dir}" ./setup.sh || die "Failed to run the setup.sh script"
popd
NEOMUTT_TEST_DIR="${test_dir}" emake test
rm -rf ${test_dir}
}

src_install() {
emake DESTDIR="${D}" install

Expand Down

0 comments on commit 5026956

Please sign in to comment.