#!/bin/sh

set -e

this=krakatoa+alt-ergo
indir=${PWD}/debian/tests/java
outdir=${ADT_ARTIFACTS-/tmp}/${this}
mkdir -p ${outdir}

why3 config --detect-provers > /dev/null 2>&1

cd ${outdir}

for infile in ${indir}/Minimum.java
do
    base=$(basename $infile)
    # we copy the input file into the outdir since jessie insists on
    # creating "project" files in the directory of the input file :-(
    cp ${infile} .
    krakatoa -why3 "prove -P alt-ergo" ${base} 2>&1 | grep -q "Valid"
done
