view scripts/test.sh @ 674:7e846e281e38

New build infrastructure to generate FLAG_ macros and TT alias, #define FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
author Rob Landley <rob@landley.net>
date Mon, 08 Oct 2012 00:02:30 -0500
parents b9ea00fffee5
children 4948a942de49
line wrap: on
line source

#!/bin/bash

[ -z "$TOPDIR" ] && TOPDIR="$(pwd)"

rm -rf testdir
mkdir -p testdir

if [ -z "$TEST_HOST" ]
then
  make install_flat PREFIX=testdir || exit 1
fi

cd testdir
PATH="$(pwd):$PATH"

. "$TOPDIR"/scripts/test/testing.sh
[ -f "$TOPDIR/generated/config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/generated/config.h") | sed 's/ /:/g')

if [ $# -ne 0 ]
then
  for i in "$@"
  do
    ln -sf toybox $i
    . "$TOPDIR"/scripts/test/$i.test
  done
else
  for i in "$TOPDIR"/scripts/test/*.test
  do
    CMDNAME="$(echo "$i" | sed 's@.*/\(.*\)\.test@\1@')"
    if [ -h $CMDNAME ] || [ ! -z "$TEST_HOST" ]
    then
      . $i
    else
      echo "$CMDNAME disabled"
    fi
  done
fi