summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Bilyk <jbilyk@gmail.com>2010-12-22 20:38:31 +0000
committerJeff Bilyk <jbilyk@gmail.com>2010-12-22 20:38:31 +0000
commit7aeda4688f829f44e4f1a1e7aa84c48512231761 (patch)
tree3b821eceae1a401de35c9383116a0d6f832ef69c
parentdc621d4a6f62906ee42343b2e95992221f07a458 (diff)
downloadapts-7aeda4688f829f44e4f1a1e7aa84c48512231761.tar.bz2
apts-7aeda4688f829f44e4f1a1e7aa84c48512231761.tar.xz
apts: reformat script so that it's easier to read and fix failed package handling
reformat script so it's easier to read and fix failed package handling
-rwxr-xr-xapts50
1 files changed, 42 insertions, 8 deletions
diff --git a/apts b/apts
index 92b7b6c..95eb662 100755
--- a/apts
+++ b/apts
@@ -40,13 +40,27 @@ shift
. /etc/apts/apts.conf
# CD to test file dir
-echo $TESTSDIR
+cd $TESTSDIR
# if there aren't any args besides outfile test all packages
-if [ $# -eq 0 ];
- then i=1 && totaltests=`ls ./tests/ | wc -w` && echo "All (${totaltests}) packages to be tested" && passedtests="0" && for package in `ls ./tests/`;
- do echo "Testing $package apk (${i}/${totaltests})" && i=$((i + 1))&& /bin/sh -e ./tests/$package $package >> "$OUTFILE" 2>&1 && echo "$package passed tests" >> "$OUTFILE" && echo "$package passed tests" && passedtests=$((passedtests + 1));
- done && echo "$passedtests of $totaltests passed" && exit 0;
+if [ $# -eq 0 ]; then
+ i=1
+ totaltests=`ls ./tests/ | wc -w`
+ echo "All (${totaltests}) packages to be tested"
+ passedtests="0"
+ for package in `ls ./tests/`; do
+ echo "Testing $package apk (${i}/${totaltests})"
+ i=$((i + 1))
+ /bin/sh -e ./tests/$package $package >> "$OUTFILE" 2>&1
+ if [ $? -gt 0 ]; then
+ echo "$package failed tests" && exit 1;
+ fi
+ echo "$package passed tests" >> "$OUTFILE"
+ echo "$package passed tests"
+ passedtests=$((passedtests + 1))
+ done
+ echo "$passedtests of $totaltests passed"
+ exit 0;
fi
# If script still running, there's args, so test all specified packages
@@ -54,14 +68,34 @@ i=1
while [ $# -gt 0 ]; do
echo "file number $i: $1"
PACKAGE=$1
+
# does testing file exist
test -e ./tests/$PACKAGE
+
# If no testing file exists then run generic-apk
- if [ "$?" == "1" ];
- then echo "Testing file for $PACKAGE does not exist" && /bin/sh -e ./tests/generic-apk $PACKAGE >> "$OUTFILE" 2>&1 && echo "$PACKAGE passed tests";
+ if [ "$?" == "1" ]; then
+ echo "Testing file for $PACKAGE does not exist"
+ /bin/sh -e ./tests/generic-apk $PACKAGE >> "$OUTFILE" 2>&1
+
+ if [ $? -gt 0 ]; then
+ echo "$PACKAGE failed tests" && exit 1;
+ fi
+ # if script is running, package passed tests
+ echo "$PACKAGE passed tests"
+
# if testing file exists, then keep running
- else echo "Testing $PACKAGE apk" && /bin/sh -e ./tests/$PACKAGE $PACKAGE >> "$OUTFILE" 2>&1 && echo "$PACKAGE passed tests";
+ else
+ echo "Testing $PACKAGE apk"
+ /bin/sh -e ./tests/$PACKAGE $PACKAGE >> "$OUTFILE" 2>&1
+
+ if [ $? -gt 0 ]; then
+ echo "$PACKAGE failed tests" && exit 1;
+ fi
+
+ echo "$PACKAGE passed tests"
fi
+
i=$((i + 1))
shift
done
+