aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-10 17:40:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-10 17:40:58 +0100
commitc24c45386f95fe1f8fd0f68c1734d292c63b9969 (patch)
tree2b979f31ceb6c18645f4e0d322500bf6b78a7a27 /test
parentf7346f669cc18a7837f223c4e9c69576cd94aa12 (diff)
downloadrspamd-c24c45386f95fe1f8fd0f68c1734d292c63b9969.tar.gz
rspamd-c24c45386f95fe1f8fd0f68c1734d292c63b9969.zip
Add a simple functional test for scanning a file.
Diffstat (limited to 'test')
-rw-r--r--test/functional/cases/scan_file.pl28
-rw-r--r--test/functional/cases/scan_file.sh8
2 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/cases/scan_file.pl b/test/functional/cases/scan_file.pl
new file mode 100644
index 000000000..674d4aee6
--- /dev/null
+++ b/test/functional/cases/scan_file.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use Socket;
+
+my $host = "127.0.0.1";
+my $port = 56789;
+my $input_file = shift;
+
+socket(SOCKET,PF_INET,SOCK_STREAM,(getprotobyname('tcp'))[2])
+ or die "Can't create a socket $!\n";
+connect(SOCKET, pack_sockaddr_in($port, inet_aton($host)))
+ or die "Can't connect to port $port! \n";
+
+print SOCKET "GET /symbols?${input_file} HTTP/1.0\r\n\r\n";
+
+SOCKET->autoflush(1);
+
+shutdown(SOCKET, 1);
+
+while (my $line = <SOCKET>) {
+ print $line;
+}
+
+close(SOCKET);
+
diff --git a/test/functional/cases/scan_file.sh b/test/functional/cases/scan_file.sh
new file mode 100644
index 000000000..b4ec293b4
--- /dev/null
+++ b/test/functional/cases/scan_file.sh
@@ -0,0 +1,8 @@
+# Test rspamd gtube using scan file feature
+
+. ${TEST_DIRNAME}/functions.sh
+
+export RSPAMD_CONFIG="$TEST_DIRNAME/configs/trivial.conf"
+run_rspamd
+run perl "$TEST_DIRNAME/cases/scan_file.pl" "$TEST_DIRNAME/messages/gtube.eml"
+check_output 'GTUBE' \ No newline at end of file