summaryrefslogtreecommitdiffstats
path: root/apts
diff options
context:
space:
mode:
Diffstat (limited to 'apts')
-rwxr-xr-xapts30
1 files changed, 25 insertions, 5 deletions
diff --git a/apts b/apts
index 95eb662..eb8128d 100755
--- a/apts
+++ b/apts
@@ -39,22 +39,38 @@ shift
# Get directory with test files
. /etc/apts/apts.conf
+# Check that TESTSDIR exists before proceeding
+test -e $TESTSDIR
+if [ $? -gt 0 ]; then
+ echo "Test file directory $TESTSDIR doesn't exit" && exit 1;
+fi
+
# CD to test file dir
cd $TESTSDIR
# if there aren't any args besides outfile test all packages
if [ $# -eq 0 ]; then
- i=1
+
+ # Initialize counter
+ i=1
+
+ # Get total number of packages for status counters
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})"
+
+ # Increment counter for tested packages
i=$((i + 1))
/bin/sh -e ./tests/$package $package >> "$OUTFILE" 2>&1
+
+ # If exit code is non-zero, exit apts
if [ $? -gt 0 ]; then
echo "$package failed tests" && exit 1;
fi
+
+ # Log to both outfile and stdout
echo "$package passed tests" >> "$OUTFILE"
echo "$package passed tests"
passedtests=$((passedtests + 1))
@@ -65,8 +81,10 @@ fi
# If script still running, there's args, so test all specified packages
i=1
+
+# Loop through all packages specified
while [ $# -gt 0 ]; do
- echo "file number $i: $1"
+ echo "Package $i: $1"
PACKAGE=$1
# does testing file exist
@@ -76,7 +94,8 @@ while [ $# -gt 0 ]; do
if [ "$?" == "1" ]; then
echo "Testing file for $PACKAGE does not exist"
/bin/sh -e ./tests/generic-apk $PACKAGE >> "$OUTFILE" 2>&1
-
+
+ # If exit code is non-zero, exit apts
if [ $? -gt 0 ]; then
echo "$PACKAGE failed tests" && exit 1;
fi
@@ -88,14 +107,15 @@ while [ $# -gt 0 ]; do
echo "Testing $PACKAGE apk"
/bin/sh -e ./tests/$PACKAGE $PACKAGE >> "$OUTFILE" 2>&1
+ # If exit code is non-zero, exit apts
if [ $? -gt 0 ]; then
echo "$PACKAGE failed tests" && exit 1;
fi
echo "$PACKAGE passed tests"
fi
-
+
+ # Increment counter and shift to next arg
i=$((i + 1))
shift
done
-