commit f14c360974567479f2ed0d23aac00bfded48c895 parent 3a22417a258d9817a8cb370c9f7d478f6b27e586 Author: Antoine Amarilli <a3nm@a3nm.net> Date: Sun, 3 Aug 2014 17:10:39 +0200 +deploy-sieve Diffstat:
deploy-sieve | | | 32 | ++++++++++++++++++++++++++++++++ |
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/deploy-sieve b/deploy-sieve @@ -0,0 +1,32 @@ +#!/bin/bash + +# Deploy sieve script $1 to location $2 but checking it passes tests $3 +# tests are lines with space-separated mail file and target folder + +SCRIPT="$1" +LOCATION="$2" +TESTS="$3" + +while read test +do + FILE=$(echo "$test" | cut -d' ' -f1) + FOLDER=$(echo "$test" | cut -d' ' -f2) + EXPECTED="store message in folder: $FOLDER" + if sieve-test -x "+editheader" "$SCRIPT" "$FILE" 2>&1 | + grep "final result: success" > /dev/null + then + if sieve-test -x "+editheader" "$SCRIPT" "$FILE" 2>/dev/null | + grep "$EXPECTED" > /dev/null + then + continue + fi + fi + echo "TEST FAILED for $FILE" + sieve-test -x "+editheader" "$SCRIPT" "$FILE" + echo "expected: $EXPECTED" + exit 1 +done < "$TESTS" + +echo "Passed all tests: `wc -l $TESTS`" +scp "$SCRIPT" "$LOCATION" +