#!/bin/sh
# autopkgtest check: Python module successfully imported and executed
set -e

# Presence of $ADTTMP implies that someone will handle cleanup for us
if [ -z "$ADTTMP" ]
then
	echo "Required envvar \"$ADTTMP\"is not set" >&2
	exit 1
fi

# Copy the simple example and the training data to $ADTTMP, and execute it
cp python/examples/simple_train.py "$ADTTMP"
cp examples/xor.data "$ADTTMP"
cd "$ADTTMP"

# Fix input (training data) and output paths in the example
sed -i -r -e 's|\.\./\.\./examples/||' simple_train.py
sed -i -r -e 's|nets/||' simple_train.py

python simple_train.py
echo "run: OK"
