2009-01-30 23:20:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-08-05 13:31:19 -03:00
|
|
|
# look for twisted trial command
|
|
|
|
if type trial >/dev/null 2>&1; then
|
|
|
|
trial="trial"
|
2009-05-16 20:11:23 -03:00
|
|
|
elif [ -x /usr/lib/twisted/bin/trial ]; then
|
|
|
|
trial="/usr/lib/twisted/bin/trial"
|
2009-01-30 23:20:49 +00:00
|
|
|
elif [ -x /usr/lib64/twisted/bin/trial ]; then
|
|
|
|
trial="/usr/lib64/twisted/bin/trial"
|
2009-05-16 20:11:23 -03:00
|
|
|
else
|
|
|
|
echo "Unable to run tests: trial command (included with Twisted) not found"
|
|
|
|
exit 1
|
2009-01-30 23:20:49 +00:00
|
|
|
fi
|
|
|
|
|
2010-08-17 14:27:48 -03:00
|
|
|
# use vsftpd (if available) for testing ftp feed storage
|
|
|
|
if type vsftpd >/dev/null 2>&1; then
|
|
|
|
vsftpd_conf=$(mktemp /tmp/vsftpd-XXXX)
|
|
|
|
cat >$vsftpd_conf <<!
|
|
|
|
listen=YES
|
|
|
|
listen_port=2121
|
|
|
|
run_as_launching_user=YES
|
|
|
|
anonymous_enable=YES
|
|
|
|
write_enable=YES
|
|
|
|
anon_upload_enable=YES
|
|
|
|
anon_mkdir_write_enable=YES
|
|
|
|
anon_other_write_enable=YES
|
|
|
|
anon_umask=000
|
|
|
|
vsftpd_log_file=/dev/null
|
|
|
|
!
|
|
|
|
ftproot=$(mktemp -d /tmp/feedtest-XXXX)
|
|
|
|
chmod 755 $ftproot
|
|
|
|
export FEEDTEST_FTP_URI="ftp://anonymous:test@localhost:2121$ftproot/path/to/file.txt"
|
|
|
|
export FEEDTEST_FTP_PATH="$ftproot/path/to/file.txt"
|
|
|
|
vsftpd $vsftpd_conf &
|
|
|
|
vsftpd_pid=$!
|
|
|
|
fi
|
|
|
|
|
2012-12-01 16:39:58 +01:00
|
|
|
find . -name '*.py[co]' -delete
|
2009-01-30 23:20:49 +00:00
|
|
|
if [ $# -eq 0 ]; then
|
2010-10-30 16:03:00 -02:00
|
|
|
$trial --reporter=text scrapy scrapyd
|
2009-01-30 23:20:49 +00:00
|
|
|
else
|
|
|
|
$trial "$@"
|
|
|
|
fi
|
2012-04-20 16:40:55 -03:00
|
|
|
exit_status=$?
|
2009-01-30 23:20:49 +00:00
|
|
|
|
2010-08-17 14:27:48 -03:00
|
|
|
# cleanup vsftpd stuff
|
|
|
|
[ -n "$vsftpd_pid" ] && kill $vsftpd_pid
|
|
|
|
[ -n "$ftproot" ] && rm -rf $ftproot $vsftpd_conf
|
|
|
|
|
2012-04-20 16:40:55 -03:00
|
|
|
exit $exit_status
|