aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/tftptest.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/tftptest.lua b/test/tftptest.lua
index 7fb8253..1e9e1d5 100644
--- a/test/tftptest.lua
+++ b/test/tftptest.lua
@@ -1,16 +1,25 @@
1-- load tftpclng.lua 1-- load tftpclng.lua
2assert(dofile("../examples/tftpclnt.lua")) 2assert(dofile("../examples/tftpclnt.lua"))
3assert(dofile("auxiliar.lua"))
4 3
5-- needs tftp server running on localhost, with root pointing to 4-- needs tftp server running on localhost, with root pointing to
6-- /home/i/diego/public/html/luasocket/test 5-- /home/i/diego/public/html/luasocket/test
7 6
8host = host or "localhost" 7function readfile(file)
8 local f = openfile("file", "rb")
9 local a
10 if f then
11 a = read(f, "*a")
12 closefile(f)
13 end
14 return a
15end
16
17host = host or "goya"
9print("downloading") 18print("downloading")
10err = tftp_get(host, 69, "test/index.html") 19err = tftp_get(host, 69, "index.html", "index.got")
11assert(not err, err) 20assert(not err, err)
12original = readfile("/home/i/diego/public/html/luasocket/test/index.html") 21original = readfile("index.index")
13retrieved = readfile("index.html") 22retrieved = readfile("index.got")
14remove("index.html") 23remove("index.got")
15assert(original == retrieved, "files differ!") 24assert(original == retrieved, "files differ!")
16print("passed") 25print("passed")