forked from wader/php-tftpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_clients.sh
More file actions
33 lines (26 loc) · 1.23 KB
/
test_clients.sh
File metadata and controls
33 lines (26 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# $1 = testserver hostname
# $2 = testserver port
echo "Generating random files"
dd bs=1000000 count=1 if=/dev/urandom of=/tmp/phptftpserver_random1
dd bs=1000000 count=40 if=/dev/urandom of=/tmp/phptftpserver_random40
echo "Put and get random file using tftp"
echo "connect $1 $2\nmode binary\nput /tmp/phptftpserver_random1 tftp\nget tftp /tmp/phptftpserver_tftp\nquit\n" | tftp
echo
echo "Put and get random file using atftp"
atftp -p -l /tmp/phptftpserver_random1 -r atftp $1 $2
atftp -g -l /tmp/phptftpserver_atftp -r atftp $1 $2
echo "Put and get random file using atftp and block size 65464"
atftp -p -l /tmp/phptftpserver_random40 -r atftp65464 --option "blksize 65464" $1 $2
atftp -g -l /tmp/phptftpserver_atftp65464 -r atftp65464 --option "blksize 65464" $1 $2
echo "Comparing to original file"
cmp /tmp/phptftpserver_random1 /tmp/phptftpserver_tftp || echo "!! tftp not same"
cmp /tmp/phptftpserver_random1 /tmp/phptftpserver_atftp || echo "!! atftp not same"
cmp /tmp/phptftpserver_random40 /tmp/phptftpserver_atftp65464 || echo "!! atftp65464 not same"
echo "Cleaning up"
rm \
/tmp/phptftpserver_random1 \
/tmp/phptftpserver_random40 \
/tmp/phptftpserver_tftp \
/tmp/phptftpserver_atftp \
/tmp/phptftpserver_atftp65464