view scripts/test.sh @ 1455:70f5188b4848 draft

Add cp -F to force delete of existing destination files, and make install command use that. -F is equivalent to the gnu/dammit flag --we-think-long-options-without-short-options-are-a-good-idea
author Rob Landley <rob@landley.net>
date Mon, 01 Sep 2014 12:47:32 -0500
parents 7dd487ddd7dc
children 8700cbe1cb29
line wrap: on
line source

#!/bin/bash

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

rm -rf testdir
mkdir -p testdir/testdir

if [ -z "$TEST_HOST" ]
then
  if [ $# -ne 0 ]
  then
    PREFIX=testdir/ scripts/single.sh "$@" || exit 1
  else
    make install_flat PREFIX=testdir || exit 1
  fi
fi

cd testdir
PATH="$PWD:$PATH"
cd testdir

. "$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
    . "$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
      cd .. && rm -rf testdir && mkdir testdir && cd testdir || exit 1
      . $i
    else
      echo "$CMDNAME disabled"
    fi
  done
fi