2011-01-26 10:54:07 -07:00
|
|
|
#!/bin/bash
|
2010-04-27 20:36:39 -06:00
|
|
|
|
2011-01-27 06:19:37 -07:00
|
|
|
wiki_pid=
|
2010-04-27 20:36:39 -06:00
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
kill $wiki_pid
|
2011-01-27 06:19:37 -07:00
|
|
|
rm -f test_*.out Test.txt final-test.bin final-test.go
|
2010-04-27 20:36:39 -06:00
|
|
|
exit ${1:-1}
|
|
|
|
}
|
|
|
|
trap cleanup INT
|
|
|
|
|
2011-01-27 06:19:37 -07:00
|
|
|
port=$(./get.bin -port)
|
|
|
|
sed s/8080/$port/ < final.go > final-test.go
|
|
|
|
gomake final-test.bin || cleanup 1
|
|
|
|
./final-test.bin &
|
|
|
|
wiki_pid=$!
|
|
|
|
|
2010-04-27 20:36:39 -06:00
|
|
|
sleep 1
|
|
|
|
|
2011-01-27 06:19:37 -07:00
|
|
|
./get.bin http://127.0.0.1:$port/edit/Test > test_edit.out
|
2011-01-26 10:54:07 -07:00
|
|
|
diff -u test_edit.out test_edit.good || cleanup 1
|
2011-01-27 06:19:37 -07:00
|
|
|
./get.bin -post=body=some%20content http://127.0.0.1:$port/save/Test
|
2011-01-26 10:54:07 -07:00
|
|
|
diff -u Test.txt test_Test.txt.good || cleanup 1
|
2011-01-27 06:19:37 -07:00
|
|
|
./get.bin http://127.0.0.1:$port/view/Test > test_view.out
|
2011-01-26 10:54:07 -07:00
|
|
|
diff -u test_view.out test_view.good || cleanup 1
|
2010-04-27 20:36:39 -06:00
|
|
|
|
|
|
|
echo "Passed"
|
|
|
|
cleanup 0
|
|
|
|
|