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

this=weight
indir=debian/tests
outdir=${ADT_ARTIFACTS:-/tmp}/${this}
mkdir -p ${outdir}

ppx='visitors.ppx,visitors.runtime'
cp ${indir}/${this}.ml ${outdir}
cd ${outdir}
echo "* Compile to bytecode."
ocamlbuild -use-ocamlfind -pkgs ${ppx} weight.byte
echo "* Run bytecode"
[ $(./weight.byte) -eq '16' ]

if [ -x /usr/bin/ocamlopt ]
then
    echo "* Compile to native code"
    ocamlbuild -use-ocamlfind -pkgs ${ppx} weight.native;
    echo "* Run native code"
    [ $(./weight.native) -eq '16' ]
fi