diff options
author | Henrik Riomar <henrik.riomar@gmail.com> | 2017-03-15 06:47:22 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-03-17 21:51:19 +0100 |
commit | 92c0c4a812c166ab2ef0dc4704b3464ea4560064 (patch) | |
tree | 75f0fba68cd05ae340e5843b4aa4f23012836dee /testing | |
parent | ec37205a090590146c529842d6af94221f292e61 (diff) | |
download | aports-92c0c4a812c166ab2ef0dc4704b3464ea4560064.tar.bz2 aports-92c0c4a812c166ab2ef0dc4704b3464ea4560064.tar.xz |
testing/apt-dater-host: add check
Diffstat (limited to 'testing')
-rw-r--r-- | testing/apt-dater-host/0001-apk-add-some-unit-tests-called-via-make-check.patch | 95 | ||||
-rw-r--r-- | testing/apt-dater-host/APKBUILD | 14 |
2 files changed, 107 insertions, 2 deletions
diff --git a/testing/apt-dater-host/0001-apk-add-some-unit-tests-called-via-make-check.patch b/testing/apt-dater-host/0001-apk-add-some-unit-tests-called-via-make-check.patch new file mode 100644 index 0000000000..6d4eec2db2 --- /dev/null +++ b/testing/apt-dater-host/0001-apk-add-some-unit-tests-called-via-make-check.patch @@ -0,0 +1,95 @@ +From a52c54d9b918f7683315e5206fd5e8d62f36b589 Mon Sep 17 00:00:00 2001 +From: Henrik Riomar <henrik.riomar@gmail.com> +Date: Wed, 15 Mar 2017 06:38:05 +0100 +Subject: [PATCH] apk: add some unit tests, called via "make check" + +Upstream-Issue: https://github.com/DE-IBH/apt-dater-host/pull/19 +--- + apk/Makefile | 3 +++ + apk/apt-dater-host | 6 +++++- + apk/test-apt-dater-host | 36 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 44 insertions(+), 1 deletion(-) + create mode 100755 apk/test-apt-dater-host + +diff --git a/apk/Makefile b/apk/Makefile +index 227f366..dfe7d9e 100644 +--- a/apk/Makefile ++++ b/apk/Makefile +@@ -1,5 +1,8 @@ + clean: + ++check: ++ ./test-apt-dater-host ++ + install: + install -D -m0755 apt-dater-host \ + $(DESTDIR)/usr/bin/apt-dater-host +diff --git a/apk/apt-dater-host b/apk/apt-dater-host +index 2164dea..e0c9b65 100755 +--- a/apk/apt-dater-host ++++ b/apk/apt-dater-host +@@ -10,7 +10,7 @@ + # Henrik Riomar <henrik.riomar@gmail.com> + # + # Copyright Holder: +-# 2016 (C) Henrik Riomar ++# 2016,2017 (C) Henrik Riomar + # + # License: + # This program is free software; you can redistribute it and/or modify +@@ -212,6 +212,10 @@ case "$1" in + get_kern + ;; + ++ source-only) ++ # do nothing (used for unit testing) ++ ;; ++ + *) + echo Invalid command \'$1\'\! + exit $err +diff --git a/apk/test-apt-dater-host b/apk/test-apt-dater-host +new file mode 100755 +index 0000000..eef6d2b +--- /dev/null ++++ b/apk/test-apt-dater-host +@@ -0,0 +1,36 @@ ++#!/usr/bin/env bats ++ ++source ./apt-dater-host source-only ++ ++check_tag() ++{ ++ TAG=$1 ++ STR=$2 ++ [ $(echo $STR | grep -E -v -c "^$TAG:") -eq 0 ] ++} ++ ++@test "say_hi()" { ++ result="$(say_hi)" ++ check_tag ADPROTO $result ++ [ "$result" = "ADPROTO: 0.6" ] ++} ++ ++@test "get_lsbrel()" { ++ result="$(get_lsbrel)" ++ check_tag LSBREL $result ++} ++ ++@test "get_pkg_stat()" { ++ result="$(get_pkg_stat)" ++ check_tag STATUS $result ++} ++ ++@test "get_virt()" { ++ result="$(get_virt)" ++ check_tag VIRT $result ++} ++ ++@test "get_kern()" { ++ result="$(get_kern)" ++ check_tag KERNELINFO $result ++} +-- +2.11.1 + diff --git a/testing/apt-dater-host/APKBUILD b/testing/apt-dater-host/APKBUILD index ef0e319a2a..d19683ae9d 100644 --- a/testing/apt-dater-host/APKBUILD +++ b/testing/apt-dater-host/APKBUILD @@ -3,23 +3,32 @@ pkgname=apt-dater-host pkgver=1.0.0 _pkgver=c3d10e0 -pkgrel=1 +pkgrel=2 pkgdesc="host helper application for apt-dater" url="https://github.com/DE-IBH/apt-dater-host" arch="noarch" license="GPL2+" +checkdepends="bats" depends="" makedepends="" install="" subpackages="$pkgname-doc" source="apt-dater-host-$pkgver-g$_pkgver.tar.gz::https://github.com/DE-IBH/apt-dater-host/archive/$_pkgver.tar.gz 0001-apk-try-to-use-virt-what.patch + 0001-apk-add-some-unit-tests-called-via-make-check.patch " builddir="$srcdir/" prepare() { cd "$builddir"/"$pkgname"-"$_pkgver"*/ || return 1 patch -p1 -i "$srcdir"/0001-apk-try-to-use-virt-what.patch + patch -p1 -i "$srcdir"/0001-apk-add-some-unit-tests-called-via-make-check.patch + chmod a+x apk/test-apt-dater-host || return 1 +} + +check() { + cd "$builddir"/"$pkgname"-"$_pkgver"*/apk || return 1 + make check || return 1 } package() { @@ -31,4 +40,5 @@ package() { } sha512sums="5398d94209ed0ef8faaf9086240e35d28047c81ac001dc9b55165c4d7505ca7a33eb68101c1357f40c6ef74d5c224bb8d75cf9f9d06676794e828b1f49b01c04 apt-dater-host-1.0.0-gc3d10e0.tar.gz -d93a7dc7e1e119bc948a4eb401a46d8ef28243b78d848194d1c86949da9f02ac01e556ff1c77fa0cf3b219403b5d55b48286cc8729d3e7cc1355b80f33fbabd9 0001-apk-try-to-use-virt-what.patch" +d93a7dc7e1e119bc948a4eb401a46d8ef28243b78d848194d1c86949da9f02ac01e556ff1c77fa0cf3b219403b5d55b48286cc8729d3e7cc1355b80f33fbabd9 0001-apk-try-to-use-virt-what.patch +12392a9bd36c3445c47382bb33be2f17609d5badfed51b8b25caa5262c8260f0048da6a3990f695caa0d70b8e908a1452caef9e15eb6211f2c696c974218ed0d 0001-apk-add-some-unit-tests-called-via-make-check.patch" |