[Pkg-ocaml-maint-commits] [extlib] 07/08: Add autopkgtest support.

Andy Li andyli-guest at moszumanska.debian.org
Tue Nov 28 07:24:54 UTC 2017


This is an automated email from the git hooks/post-receive script.

andyli-guest pushed a commit to branch master
in repository extlib.

commit b912c8f219ad4b873b11aa8b1c2e7f676da3a272
Author: Andy Li <andy at onthewings.net>
Date:   Tue Nov 28 15:20:06 2017 +0800

    Add autopkgtest support.
---
 debian/tests/byte-code   | 22 ++++++++++++++++++++++
 debian/tests/control     |  2 ++
 debian/tests/native-code | 27 +++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)

diff --git a/debian/tests/byte-code b/debian/tests/byte-code
new file mode 100755
index 0000000..fcce5ca
--- /dev/null
+++ b/debian/tests/byte-code
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+testdir=$(mktemp -d)
+trap "rm -rf ${testdir}" 0 INT QUIT ABRT PIPE TERM
+cd ${testdir}
+
+cat <<EOF > test.ml
+open Base64
+let r = Base64.str_decode (Base64.str_encode "Hello world!")
+let _ = Printf.printf "%s" r
+EOF
+
+ocamlfind ocamlc -o byte-code-test -I `ocamlfind query extlib` extLib.cma test.ml
+
+echo "build: OK"
+
+[ -x byte-code-test ]
+./byte-code-test 2> /dev/null | grep -q "Hello world!"
+
+echo "run: OK"
\ No newline at end of file
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..525baed
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: byte-code, native-code
+Depends: ocaml-nox, ocaml-findlib, @
diff --git a/debian/tests/native-code b/debian/tests/native-code
new file mode 100755
index 0000000..0d01967
--- /dev/null
+++ b/debian/tests/native-code
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+testdir=$(mktemp -d)
+trap "rm -rf ${testdir}" 0 INT QUIT ABRT PIPE TERM
+cd ${testdir}
+
+cat <<EOF > test.ml
+open Base64
+let r = Base64.str_decode (Base64.str_encode "Hello world!")
+let _ = Printf.printf "%s" r
+EOF
+
+if [ -x '/usr/bin/ocamlopt' ]
+then
+    ocamlfind ocamlopt -o native-code-test -I `ocamlfind query extlib` extLib.cmxa test.ml
+
+    echo "build: OK"
+
+    [ -x native-code-test ]
+    ./native-code-test 2> /dev/null | grep -q "Hello world!"
+
+    echo "run: OK"
+else
+    echo "skip native-code test since ocamlopt is not available"
+fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/extlib.git



More information about the Pkg-ocaml-maint-commits mailing list