PageRenderTime 28ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/tests/proxy-url.sh

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
Shell | 67 lines | 37 code | 13 blank | 17 comment | 3 complexity | b56580a94cb6b5534d81dcd20ac4a8ee MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. #!/bin/sh
  2. # proxy-url.sh - test jscoverage-server --proxy with different URLs
  3. # Copyright (C) 2008 siliconforks.com
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along
  16. # with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. set -e
  19. shutdown() {
  20. wget -q -O- --post-data= "http://127.0.0.1:${proxy_server_port}/jscoverage-shutdown" > /dev/null
  21. wait $proxy_server_pid
  22. if [ "$origin_server_pid" != "" ]
  23. then
  24. kill -9 $origin_server_pid
  25. fi
  26. }
  27. cleanup() {
  28. shutdown
  29. }
  30. trap 'cleanup' 0 1 2 3 15
  31. export PATH=.:..:$PATH
  32. if [ -z "$VALGRIND" ]
  33. then
  34. delay=0.2
  35. else
  36. delay=2
  37. fi
  38. $VALGRIND jscoverage-server --proxy > OUT 2> ERR &
  39. proxy_server_pid=$!
  40. proxy_server_port=8080
  41. sleep $delay
  42. echo 504 > EXPECTED
  43. ! curl -f -w '%{http_code}\n' -x 127.0.0.1:8080 http://127.0.0.1:/index.html 2> /dev/null > ACTUAL
  44. diff EXPECTED ACTUAL
  45. ./http-client-bad-url 8080 http://127.0.0.1:123456/index.html
  46. ./http-client-bad-url 8080 http://127.0.0.1:xyz/index.html
  47. cd recursive
  48. perl ../server.pl > /dev/null 2> /dev/null &
  49. origin_server_pid=$!
  50. cd ..
  51. sleep $delay
  52. ./http-client-bad-url 8080 http://127.0.0.1:8000
  53. ./http-client-bad-url 8080 'http://127.0.0.1:8000?foo'
  54. ./http-client-bad-url 8080 'foo'