Browse files

remove bash requirement for test script

This gets a bit convoluted because PIPESTATUS is bash specific
but then bash fails on the POSIX version with a bad fd error.
So in case sh actually links to bash, both types are included.

fixes: #72
  • Loading branch information...
1 parent 27d88ce commit dc490331aa1a9557f6cf9d0a0442460fb519637a @nyov nyov committed Mar 10, 2013
Showing with 17 additions and 10 deletions.
  1. +17 −10 run-tests.sh
View
27 run-tests.sh
@@ -1,12 +1,14 @@
-#!/bin/bash
+#!/bin/sh
-OUTPUT_PATH=$(pwd)/tests_output
+OUTPUT_PATH=`pwd`/tests_output
-function log() {
+log()
+{
echo "$@" | tee -a $OUTPUT_PATH/test.log
}
-function nosetest_yanc_plugin() {
+nosetest_yanc_plugin()
+{
nosetests --plugins | grep yanc >/dev/null
}
@@ -36,14 +38,19 @@ fi
nosetest_yanc_plugin || [ -n "$NOCOLOR" ] || log "No yanc plugin for nosetests found. Color output unavailable."
log "Running tests..."
-nosetests $NOSETEST_OPTIONS 2>&1 | tee -a $OUTPUT_PATH/test.log
-ret=${PIPESTATUS[0]}
+
+if [ $BASH ]; then
+ nosetests $NOSETEST_OPTIONS 2>&1 | tee -a $OUTPUT_PATH/test.log
+ R=${PIPESTATUS[0]}
+else
+ 4>&1 R=$({ { nosetests $NOSETEST_OPTIONS 2>&1; echo $? >&3 ; } | { tee -a $OUTPUT_PATH/test.log >&4; } } 3>&1)
+fi
echo
-case "$ret" in
- 0) log -e "SUCCESS" ;;
- *) log -e "FAILURE" ;;
+case "$R" in
+ 0) log "SUCCESS" ;;
+ *) log "FAILURE" ;;
esac
-exit $ret
+exit $R

0 comments on commit dc49033

Please sign in to comment.