aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-09 15:02:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-09 15:02:09 +0100
commita88cb1b54f6ec99886e9a6a4e54124150f7bfff6 (patch)
treedf9fff74468fd4ee15a05060af3a4107e29cc708
parentc20631bd67eaf070b8a37d298c627824df33eaff (diff)
downloadrspamd-a88cb1b54f6ec99886e9a6a4e54124150f7bfff6.tar.gz
rspamd-a88cb1b54f6ec99886e9a6a4e54124150f7bfff6.zip
Fix issues in the tests.
-rw-r--r--test/functional/cases/encrypted_gtube.sh2
-rw-r--r--test/functional/cases/learn_bad.sh4
-rw-r--r--test/functional/cases/learn_simple.sh8
-rw-r--r--test/functional/cases/learn_siphash.sh8
-rw-r--r--test/functional/cases/learn_xxhash.sh8
-rw-r--r--test/functional/cases/relearn-sqlite.sh16
-rw-r--r--test/functional/cases/relearn.sh16
-rw-r--r--test/functional/cases/spamc_gtube.sh2
-rw-r--r--test/functional/cases/symbol_depends.sh6
-rw-r--r--test/functional/functions.sh13
10 files changed, 41 insertions, 42 deletions
diff --git a/test/functional/cases/encrypted_gtube.sh b/test/functional/cases/encrypted_gtube.sh
index 9b5ff27e6..016a1f6ec 100644
--- a/test/functional/cases/encrypted_gtube.sh
+++ b/test/functional/cases/encrypted_gtube.sh
@@ -6,4 +6,4 @@ export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
run_rspamd
run_rspamc symbols --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
"$TEST_DIRNAME/messages/gtube.eml"
-check_output "$output" 'Action: reject' \ No newline at end of file
+check_output 'Action: reject' \ No newline at end of file
diff --git a/test/functional/cases/learn_bad.sh b/test/functional/cases/learn_bad.sh
index 199e77b7f..5c5410c91 100644
--- a/test/functional/cases/learn_bad.sh
+++ b/test/functional/cases/learn_bad.sh
@@ -8,5 +8,5 @@ export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
run_rspamd
run_rspamc learn_spam \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'cannot open backend' \ No newline at end of file
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'cannot open backend' \ No newline at end of file
diff --git a/test/functional/cases/learn_simple.sh b/test/functional/cases/learn_simple.sh
index 59a0bac5b..d44056918 100644
--- a/test/functional/cases/learn_simple.sh
+++ b/test/functional/cases/learn_simple.sh
@@ -8,10 +8,10 @@ export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
run_rspamd
run_rspamc learn_spam \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'success.*true'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'success.*true'
run_rspamc symbols \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'BAYES_SPAM' \ No newline at end of file
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'BAYES_SPAM' \ No newline at end of file
diff --git a/test/functional/cases/learn_siphash.sh b/test/functional/cases/learn_siphash.sh
index a91fe9ae9..dcab7410a 100644
--- a/test/functional/cases/learn_siphash.sh
+++ b/test/functional/cases/learn_siphash.sh
@@ -9,10 +9,10 @@ export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
run_rspamd
run_rspamc learn_spam \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'success.*true'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'success.*true'
run_rspamc symbols \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'BAYES_SPAM' \ No newline at end of file
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'BAYES_SPAM' \ No newline at end of file
diff --git a/test/functional/cases/learn_xxhash.sh b/test/functional/cases/learn_xxhash.sh
index 896874b13..2b75b9aa5 100644
--- a/test/functional/cases/learn_xxhash.sh
+++ b/test/functional/cases/learn_xxhash.sh
@@ -9,10 +9,10 @@ export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
run_rspamd
run_rspamc learn_spam \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'success.*true'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'success.*true'
run_rspamc symbols \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'BAYES_SPAM' \ No newline at end of file
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'BAYES_SPAM' \ No newline at end of file
diff --git a/test/functional/cases/relearn-sqlite.sh b/test/functional/cases/relearn-sqlite.sh
index 1b2ac4a8c..f678b319c 100644
--- a/test/functional/cases/relearn-sqlite.sh
+++ b/test/functional/cases/relearn-sqlite.sh
@@ -9,20 +9,20 @@ export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
run_rspamd
run_rspamc learn_spam \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'success.*true'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'success.*true'
run_rspamc symbols \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'BAYES_SPAM'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'BAYES_SPAM'
run_rspamc learn_ham \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'success.*true'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'success.*true'
run_rspamc symbols \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'BAYES_HAM' \ No newline at end of file
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'BAYES_HAM' \ No newline at end of file
diff --git a/test/functional/cases/relearn.sh b/test/functional/cases/relearn.sh
index d1f861922..9d52e4310 100644
--- a/test/functional/cases/relearn.sh
+++ b/test/functional/cases/relearn.sh
@@ -8,20 +8,20 @@ export RSPAMD_CONFIG="$TEST_DIRNAME/configs/stats.conf" \
run_rspamd
run_rspamc learn_spam \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'success.*true'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'success.*true'
run_rspamc symbols \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'BAYES_SPAM'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'BAYES_SPAM'
run_rspamc learn_ham \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'success.*true'
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'success.*true'
run_rspamc symbols \
--key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'BAYES_HAM' \ No newline at end of file
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'BAYES_HAM' \ No newline at end of file
diff --git a/test/functional/cases/spamc_gtube.sh b/test/functional/cases/spamc_gtube.sh
index 8b63eb5fd..ffad990eb 100644
--- a/test/functional/cases/spamc_gtube.sh
+++ b/test/functional/cases/spamc_gtube.sh
@@ -5,4 +5,4 @@
export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
run_rspamd
run perl "$TEST_DIRNAME/cases/spamc.pl" "$TEST_DIRNAME/messages/gtube.eml"
-check_output $output 'GTUBE' \ No newline at end of file
+check_output 'GTUBE' \ No newline at end of file
diff --git a/test/functional/cases/symbol_depends.sh b/test/functional/cases/symbol_depends.sh
index 5bc6941c3..bcf718f7f 100644
--- a/test/functional/cases/symbol_depends.sh
+++ b/test/functional/cases/symbol_depends.sh
@@ -2,7 +2,7 @@
. ${TEST_DIRNAME}/functions.sh
-sed -e 's|@@LUA_SCRIPT@@|${CURDIR}/functional/cases/deps.lua|' < \
+sed -e 's|@@LUA_SCRIPT@@|${TESTDIR}/cases/deps.lua|' < \
"$TEST_DIRNAME/configs/lua_test.conf" > \
"$TMPDIR/rspamd.conf"
export RSPAMD_CONFIG="$TMPDIR/rspamd.conf" \
@@ -10,5 +10,5 @@ export RSPAMD_CONFIG="$TMPDIR/rspamd.conf" \
run_rspamd
run_rspamc symbols \
- "$BATS_TEST_DIRNAME/messages/spam_message.eml"
-check_output $output 'DEP10' \ No newline at end of file
+ "$TEST_DIRNAME/messages/spam_message.eml"
+check_output 'DEP10' \ No newline at end of file
diff --git a/test/functional/functions.sh b/test/functional/functions.sh
index b96931a74..7301669a2 100644
--- a/test/functional/functions.sh
+++ b/test/functional/functions.sh
@@ -60,14 +60,13 @@ function teardown()
function check_output()
{
- _output="$1"
- _pattern="$2"
+ _pattern="$1"
- echo "$_output" | egrep "$_pattern" > /dev/null 2>&1
+ echo "$output" | egrep "$_pattern" > /dev/null 2>&1
_saved_exit=$?
if [ $_saved_exit -ne 0 ] ; then
- echo "$_output" > ${TMPDIR}/rspamc.output
+ echo "$output" > ${TMPDIR}/rspamc.err
save_error 'rspamc' "Expected pattern $_pattern is not found"
return $_saved_exit
fi
@@ -86,13 +85,13 @@ function run_rspamc()
*) _host="localhost:56789" ;;
esac
- output=`$_rspamc -h $_host $@ 2>&1`
+ output=`$_rspamc -h $_host $_command $@ 2>&1`
+ echo "$output" > ${TMPDIR}/rspamc.output
if [ $? -eq 0 ] ; then
export output
return 0
else
- echo $output > ${TMPDIR}/rspamc.output
save_error 'rspamc' "Wrong exit code"
fi
@@ -105,12 +104,12 @@ function run()
shift
output=`$_command $@ 2>&1`
+ echo "$output" > "${TMPDIR}/${_command}.output"
if [ $? -eq 0 ] ; then
export output
return 0
else
- echo $output > ${TMPDIR}/${_command}.output
save_error "${_command}" "Wrong exit code"
fi