Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/roundup: new aport

From: Christian Kampka <christian_at_kampka.net>
Date: Sun, 25 Oct 2015 16:16:43 +0100

---
 testing/roundup/APKBUILD                           | 47 ++++++++++++++++++++++
 .../roundup-avoid-bash-syntax-in-tests.patch       | 17 ++++++++
 .../roundup/roundup-fix-busybox-shell-opts.patch   | 19 +++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 testing/roundup/APKBUILD
 create mode 100644 testing/roundup/roundup-avoid-bash-syntax-in-tests.patch
 create mode 100644 testing/roundup/roundup-fix-busybox-shell-opts.patch
diff --git a/testing/roundup/APKBUILD b/testing/roundup/APKBUILD
new file mode 100644
index 0000000..81ebce2
--- /dev/null
+++ b/testing/roundup/APKBUILD
_at_@ -0,0 +1,47 @@
+# Maintainer: Christian Kampka <christian_at_kampka.net>
+pkgname=roundup
+pkgver=0.0.6
+pkgrel=1
+pkgdesc="A a unit testing tool for running roundup(5) test plans which are
+written in any POSIX shell."
+url=https://github.com/bmizerany/roundup/
+arch="all"
+license="MIT"
+depends=
+makedeps="ncurses"
+source="$pkgname-$pkgver.tar.gz::https://github.com/bmizerany/$pkgname/archive/v$pkgver.tar.gz
+  $pkgname-fix-busybox-shell-opts.patch
+  $pkgname-avoid-bash-syntax-in-tests.patch
+  "
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+  #patches
+  cd "$_builddir"
+  for i in $source; do
+    local p=${i##*/}
+    case $i in
+      *.patch) msg $p; patch -p1 -i "$srcdir"/$p || return 1;;
+    esac
+  done
+}
+
+build() {
+  cd $_builddir
+  /bin/sh roundup.sh roundup-1-test.sh
+}
+
+package() {
+  install -Dm755 $_builddir/roundup.sh $pkgdir/usr/bin/$pkgname
+}
+
+md5sums="607023b4fe4e42fdc2f0cb14b4138b2e  roundup-0.0.6.tar.gz
+a7d12efbf88919a1e2fc9b7ed143fd9c  roundup-fix-busybox-shell-opts.patch
+dddd5610d03f2c1237c295c564c291c4  roundup-avoid-bash-syntax-in-tests.patch"
+sha256sums="20741043ed5be7cbc54b1e9a7c7de122a0dacced77052e90e4ff08e41736f01c  roundup-0.0.6.tar.gz
+31e00fc54fa806aaa1a3199dd13b596b36e8f57685c7524db125bf87a949845b  roundup-fix-busybox-shell-opts.patch
+e8829b4459a5e3d65949e564cf69e307e7b6fe11758d9becc9426a164bb4a812  roundup-avoid-bash-syntax-in-tests.patch"
+sha512sums="a7a249d16467bd3835d555288ec6c3d84a36f2f7f2ae5da90e7624bc76a7741788499fd635d3001c086923914870392c23d765ca07ab7c97e58b9deec9989827  roundup-0.0.6.tar.gz
+13cf848227958e83fabf6cde96e1ac347199ad107d6a5daa07e23a976cc8613a0368447295afb310a817c8d6aeb52b96d12d58984a929114decc2c16098ddd7c  roundup-fix-busybox-shell-opts.patch
+526cca7805fb55de24df79482e3daa2253fc26db2db662229894b8ad56e79a8a45ad716e0c0241765455bda0a4c45344a9ea7c001860d3f8ca41f0c00e3954f9  roundup-avoid-bash-syntax-in-tests.patch"
diff --git a/testing/roundup/roundup-avoid-bash-syntax-in-tests.patch b/testing/roundup/roundup-avoid-bash-syntax-in-tests.patch
new file mode 100644
index 0000000..ecd2f07
--- /dev/null
+++ b/testing/roundup/roundup-avoid-bash-syntax-in-tests.patch
_at_@ -0,0 +1,17 @@
+diff --git a/roundup-5-test.sh b/roundup-5-test.sh
+index 250a586..8e8739a 100644
+--- a/roundup-5-test.sh
++++ b/roundup-5-test.sh
+_at_@ -87,10 +87,10 @@ it_runs_after_if_a_test_fails_part_2() {
+ 
+ # Output the correct return code of a failing command of a testcase.
+ it_outputs_the_return_code_7() {
+-    function f() { return 42; }
++    f() { return 42; }
+     x=$(echo asdf)
+ 
+-    function g() { return 7; }
++    g() { return 7; }
+     g
+ }
+ 
diff --git a/testing/roundup/roundup-fix-busybox-shell-opts.patch b/testing/roundup/roundup-fix-busybox-shell-opts.patch
new file mode 100644
index 0000000..b6185e9
--- /dev/null
+++ b/testing/roundup/roundup-fix-busybox-shell-opts.patch
_at_@ -0,0 +1,19 @@
+diff --git a/roundup.sh b/roundup.sh
+index d7465dc..38d7efe 100755
+--- a/roundup.sh
++++ b/roundup.sh
+_at_@ -258,9 +258,11 @@ do
+ 
+                 # exit subshell with return code of last failing command. This
+                 # is needed to see the return code 253 on failed assumptions.
+-                # But, only do this if the error handling is activated.
+-                set -E
+-                trap 'rc=$?; set +x; set -o | grep "errexit.*on" >/dev/null && exit $rc' ERR
++                # But, only do this if the error handling is activated and only if the shell supports it
++                if set -o | grep "^errtrace" >/dev/null; then
++                  set -o errtrace
++                  trap 'rc=$?; set +x; set -o | grep "errexit.*on" >/dev/null && exit $rc' ERR
++                fi
+ 
+                 # If `before` wasn't redefined, then this is `:`.
+                 before
-- 
2.6.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Sun Oct 25 2015 - 16:16:43 GMT