diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
commit | 758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch) | |
tree | 6d6b34f8c678862fe9b56c945a7b63f68502c245 /doc/codelab/wiki/test.sh | |
parent | 3e45412327a2654a77944249962b3652e6142299 (diff) | |
download | golang-upstream/2011-02-01.1.tar.gz |
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'doc/codelab/wiki/test.sh')
-rwxr-xr-x | doc/codelab/wiki/test.sh | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/doc/codelab/wiki/test.sh b/doc/codelab/wiki/test.sh index 5b752fe3c..95ff145b9 100755 --- a/doc/codelab/wiki/test.sh +++ b/doc/codelab/wiki/test.sh @@ -1,24 +1,27 @@ -#1/bin/bash - -./final.bin & -wiki_pid=$! +#!/usr/bin/env bash +set -e +wiki_pid= cleanup() { kill $wiki_pid - rm -f test_*.out Test.txt - exit ${1:-1} + rm -f test_*.out Test.txt final-test.bin final-test.go } -trap cleanup INT +trap cleanup 0 INT -sleep 1 +gomake get.bin +addr=$(./get.bin -addr) +sed s/:8080/$addr/ < final.go > final-test.go +gomake final-test.bin +./final-test.bin & +wiki_pid=$! -curl -s -o test_edit.out http://localhost:8080/edit/Test -cmp test_edit.out test_edit.good || cleanup 1 -curl -s -o /dev/null -d body=some%20content http://localhost:8080/save/Test -cmp Test.txt test_Test.txt.good || cleanup 1 -curl -s -o test_view.out http://localhost:8080/view/Test -cmp test_view.out test_view.good || cleanup 1 +sleep 1 -echo "Passed" -cleanup 0 +./get.bin http://$addr/edit/Test > test_edit.out +diff -u test_edit.out test_edit.good +./get.bin -post=body=some%20content http://$addr/save/Test +diff -u Test.txt test_Test.txt.good +./get.bin http://$addr/view/Test > test_view.out +diff -u test_view.out test_view.good +echo PASS |