#!/bin/bash

PL=pl
tests="$*"
failed=

for test in $tests; do
    echo -n "Running $test ..."
    if $PL -q -s $test.pl -g 'make_client,halt' -t 'halt(1)' && \
       $PL -q -s $test.pl -g 'start_server,shell("'./$test'"),halt' -t 'halt(1)'; then
       echo "ok"
    else
       echo "FAILED"
       failed="$failed $test"
    fi
done    

if [ -z "$failed" ]; then
   echo "All tests passed"
else
   echo "WARNING: The following tests failed: $failed"
fi
