summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLloyd Hilaiel <lloyd@hilaiel.com>2010-08-10 12:58:14 -0600
committerLloyd Hilaiel <lloyd@hilaiel.com>2010-08-10 12:58:14 -0600
commit3e1e05601258a518af169be7705e2ff06d1d603e (patch)
treef5abbbdb897b60d3bd8e8a772d62983f0b2c4b5c /test
parent0915ba9cb5b469e3d186227ebbecdae6c259d0c2 (diff)
downloadyajl-3e1e05601258a518af169be7705e2ff06d1d603e.tar.gz
remove bash dependency in run_tests.sh, contributed by http://github.com/bapt
Diffstat (limited to 'test')
-rwxr-xr-xtest/run_tests.sh37
1 files changed, 20 insertions, 17 deletions
diff --git a/test/run_tests.sh b/test/run_tests.sh
index f5063ed..dcb9ef4 100755
--- a/test/run_tests.sh
+++ b/test/run_tests.sh
@@ -1,7 +1,7 @@
-#!/usr/bin/env bash
+#!/bin/sh
DIFF_FLAGS="-u"
-if [[ `uname` == *W32* ]] ; then
+if [ `uname` = "*W32*" ] ; then
DIFF_FLAGS="-wu"
fi
@@ -13,9 +13,9 @@ fi
# particular test binary (useful for non-cmake build systems).
if [ -z "$testBin" ]; then
testBin="../build/test/Debug/yajl_test.exe"
- if [[ ! -x $testBin ]] ; then
+ if [ ! -x $testBin ] ; then
testBin="../build/test/yajl_test"
- if [[ ! -x $testBin ]] ; then
+ if [ ! -x $testBin ] ; then
echo "cannot execute test binary: '$testBin'"
exit 1;
fi
@@ -24,41 +24,44 @@ fi
echo "using test binary: $testBin"
-let testsSucceeded=0
-let testsTotal=0
+testsSucceeded=0
+testsTotal=0
for file in cases/*.json ; do
allowComments="-c"
# if the filename starts with dc_, we disallow comments for this test
- if [[ $(basename $file) == dc_* ]] ; then
- allowComments=""
- fi
+ case $(basename $file) in
+ dc_*)
+ allowComments=""
+ ;;
+ esac
echo -n " test case: '$file': "
- let iter=1
+ iter=1
success="success"
+ echo "$testBin $allowComments -b $iter < $file > ${file}.test "
# parse with a read buffer size ranging from 1-31 to stress stream parsing
- while (( $iter < 32 )) && [ $success == "success" ] ; do
+ while [ $iter -lt 32 ] && [ $success = "success" ] ; do
$testBin $allowComments -b $iter < $file > ${file}.test 2>&1
diff ${DIFF_FLAGS} ${file}.gold ${file}.test
- if [[ $? == 0 ]] ; then
- if (( $iter == 31 )) ; then let testsSucceeded+=1 ; fi
+ if [ $? -eq 0 ] ; then
+ if [ $iter -eq 31 ] ; then : $(( testsSucceeded += 1)) ; fi
else
success="FAILURE"
- let iter=32
+ iter=32
fi
- let iter+=1
+ : $(( iter += 1 ))
rm ${file}.test
done
echo $success
- let testsTotal+=1
+ : $(( testsTotal += 1 ))
done
echo $testsSucceeded/$testsTotal tests successful
-if [[ $testsSucceeded != $testsTotal ]] ; then
+if [ $testsSucceeded != $testsTotal ] ; then
exit 1
fi