#!/bin/sh
#
# see: The MySQL Test Framework :: 7 Creating and Executing Unit Tests
#   (MySQL Cluster Documentation)/mysqltest/en/unit-test.html
# see: Test Anything Protocol (TAP)
#   http://testanything.org/wiki/index.php/Main_Page
#   http://en.wikipedia.org/wiki/Test_Anything_Protocol

# not sure which protocol version we're using
#echo "TAP version 13"

# test range
echo "1..1"

# this script gets invoked from $(top_srcdir)/unittest
cd ../storage/ndb/src/ndbjtie/mysql/test

# log file for output from this script
log="`pwd`/mysql_utils_unit_tests-t.log"
rm -f "$log"
touch "$log"

# run test
echo "running test from directory:" >> "$log" 2>&1
echo "  `pwd`" >> "$log" 2>&1

test_name="test_mysql_utils"
script_name="./$test_mysql_utils.sh"

if [ ! -x "$script_name" ];
then
  status="ok 1 # skip $test_name test file missing"
else
  s=""
  ./test_mysql_utils.sh >> "$log" 2>&1
  if [ "$?" -ne "0" ]; then
    s="not "
  fi
  status="${s}ok 1 - $test_name"
fi;

echo "$status" >> "$log" 2>&1
echo "" >> "$log" 2>&1
echo "$status"

echo "done." >> "$log" 2>&1
