summaryrefslogtreecommitdiff
path: root/tests/api-ocaml
blob: b458604111f8fbf1992ee9230cf7e28dad2c42e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

set -e

indir=${PWD}/debian/tests
outdir=${ADT_ARTIFACTS-/tmp/morsmall-package-test}/ocaml-api
mkdir -p ${outdir}
cd ${outdir}
cp ${indir}/parse_and_print.ml ${indir}/_tags ${indir}/helloworld.sh .

echo "* Compile to bytecode."
ocamlbuild -use-ocamlfind parse_and_print.byte
echo "* Run the bytecode."
./parse_and_print.byte helloworld.sh > helloworld.byte.out
diff helloworld.sh helloworld.byte.out

if [ -x /usr/bin/ocamlopt ]; then
    echo "* Compile to native code."
    ocamlbuild -use-ocamlfind parse_and_print.native
    echo "* Run the native code."
    ./parse_and_print.native helloworld.sh > helloworld.native.out
    diff helloworld.sh helloworld.native.out
fi