diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2001-09-25 21:32:52 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2001-09-25 21:32:52 +0000 |
commit | b319e6a1e86a54c23b4848c5be7c0670f349a63f (patch) | |
tree | 649f8e1bb57b363610583d39cfb0eee63d5171bb | |
parent | 9f677cdbf4dee43b7fde43e2c673073e623451d9 (diff) | |
download | luasocket-b319e6a1e86a54c23b4848c5be7c0670f349a63f.tar.gz luasocket-b319e6a1e86a54c23b4848c5be7c0670f349a63f.tar.bz2 luasocket-b319e6a1e86a54c23b4848c5be7c0670f349a63f.zip |
updated due to test location changes
-rw-r--r-- | test/tftptest.lua | 21 |
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 |
2 | assert(dofile("../examples/tftpclnt.lua")) | 2 | assert(dofile("../examples/tftpclnt.lua")) |
3 | assert(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 | ||
8 | host = host or "localhost" | 7 | function 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 | ||
15 | end | ||
16 | |||
17 | host = host or "goya" | ||
9 | print("downloading") | 18 | print("downloading") |
10 | err = tftp_get(host, 69, "test/index.html") | 19 | err = tftp_get(host, 69, "index.html", "index.got") |
11 | assert(not err, err) | 20 | assert(not err, err) |
12 | original = readfile("/home/i/diego/public/html/luasocket/test/index.html") | 21 | original = readfile("index.index") |
13 | retrieved = readfile("index.html") | 22 | retrieved = readfile("index.got") |
14 | remove("index.html") | 23 | remove("index.got") |
15 | assert(original == retrieved, "files differ!") | 24 | assert(original == retrieved, "files differ!") |
16 | print("passed") | 25 | print("passed") |