#!/bin/sh

# Automate compile and execution of devchk test suite
#
# Copyright 2001 The Free Standards Group Inc.
# Chris Yeoh <cyeoh@samba.org> 
#

Fail()
{
   echo $@
   echo Aborting.
   exit 1
}

if [ "$USER" != "vsx0" ]; then
  Fail "Please run as vsx0..."
fi

cd /usr/lib/lsb-testsuites

if [ ! -f test_sets/License.devchk ]; then
  Fail "No License.devchk found..."
fi

export TET_ROOT=`pwd`
export PATH=$TET_ROOT/bin:$TET_ROOT/test_sets/BIN:$PATH

# Configure and install tet
sh configure -t lite
if [ $? -ne 0 ]; then
  Fail "Failed to configure TET"
fi

cd src
make install
if [ $? -ne 0 ]; then
  Fail "Failed to compile TET"
fi

cd $TET_ROOT/test_sets

# Build test suites
tcc -b -s lsbdev_scen -g lsbdev_build.cfg

# Run test suites
tcc -e -s lsbdev_scen -x lsbdev_exec.cfg

# Display the test results
echo
echo
echo Test Results Summary
echo ====================
echo

cd results;
vres `ls -d 0* | tail -1`/journal

echo
echo Finished.
echo
echo Feedback about devcheck or test results can be sent to lsb-test@linuxbase.org
echo
echo "IMPORTANT NOTE: These test suites are a work in progress,"
echo "no claims of LSB compliance or passing these test suites should be"
echo "made. These are unapproved test suites and issues remain both with"
echo "the test suites and the specifications under test. "
echo
