Skip to content

Commit

Permalink
Merge pull request #85 from jsarenik/jasan/tests
Browse files Browse the repository at this point in the history
Make test scripts executable
  • Loading branch information
Ján Sáreník committed Apr 14, 2016
2 parents ac9a67f + 362efbc commit 8515d3d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
13 changes: 9 additions & 4 deletions misc/ci-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ dlit() {
}
}

dlit dig "http://dl.bintray.com/jsarenik/spf-tools-bin/dig.bz2"
dlit mksh "http://dl.bintray.com/jsarenik/spf-tools-bin/mksh.bz2"
dlit ksh "http://dl.bintray.com/jsarenik/spf-tools-bin/ksh.bz2"
dlit dash "http://dl.bintray.com/jsarenik/spf-tools-bin/dash.bz2"
KERNELARCH=$(uname -sm)
if
test "$KERNELARCH" = "Linux x86_64"
then
dlit dig "http://dl.bintray.com/jsarenik/spf-tools-bin/dig.bz2"
dlit mksh "http://dl.bintray.com/jsarenik/spf-tools-bin/mksh.bz2"
dlit ksh "http://dl.bintray.com/jsarenik/spf-tools-bin/ksh.bz2"
dlit dash "http://dl.bintray.com/jsarenik/spf-tools-bin/dash.bz2"
fi
7 changes: 3 additions & 4 deletions tests/test-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@
##############################################################################

a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BINDIR=$(cd $a; pwd)
PATH=$BINDIR/..:$BINDIR/../include:$PATH
cd $BINDIR

test -n "$DEBUG" && export DEBUG=1 ADD="-x"
export ADD="-e"
test -n "$DEBUG" && export DEBUG=1 ADD="${ADD}x"

for MYSH in sh ash pdksh ksh dash mksh bash
do
MYSH=$(which $MYSH 2>/dev/null) || continue

echo =================================
echo Using $MYSH
$MYSH -se $ADD < test-real.sh
$BINDIR/test-subdirs.sh $MYSH

echo Testing despf functions...
$MYSH $ADD $BINDIR/test-unit.sh
Expand Down
10 changes: 8 additions & 2 deletions tests/test-real.sh → tests/test-subdirs.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
##############################################################################
#
# Copyright 2015 spf-tools team (see AUTHORS)
Expand All @@ -16,12 +17,17 @@
#
##############################################################################

a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BINDIR=$(cd $a; pwd)
export PATH=$BINDIR/..:$PATH
cd $BINDIR

RUNSHELL=${1:-"/bin/sh"}
out=$(mktemp)
set | grep 'SH_VERSION=' >&2 || true
for test in $(find . -type d -mindepth 1 -maxdepth 1)
for test in $(find . -mindepth 1 -maxdepth 1 -type d)
do
echo Testing $test
$0 $ADD $test/cmd <$test/in >$out
$RUNSHELL $ADD $test/cmd <$test/in >$out
grep -v '^+' $out | diff -u $test/out -
echo .. $test OK
rm $out
Expand Down
2 changes: 2 additions & 0 deletions tests/test-unit.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
##############################################################################
#
# Copyright 2015 spf-tools team (see AUTHORS)
Expand All @@ -17,6 +18,7 @@
##############################################################################

a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BINDIR=$(cd $a; pwd)
export PATH=$BINDIR/../include:$PATH
tmp=$(mktemp /tmp/spf-test-unit-XXXXXXXXX)
trap "rm $tmp*" EXIT
. $BINDIR/../include/despf.inc.sh
Expand Down

0 comments on commit 8515d3d

Please sign in to comment.