move bench.sh to the template instead
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/bd6ae7cb Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/bd6ae7cb Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/bd6ae7cb Branch: refs/heads/master Commit: bd6ae7cbb371666a1f68115056f7b30d13765782 Parents: 5ab8949 Author: Bob Ippolito <b...@redivi.com> Authored: Tue Sep 8 21:24:59 2015 -0700 Committer: Bob Ippolito <b...@redivi.com> Committed: Tue Sep 8 21:24:59 2015 -0700 ---------------------------------------------------------------------- Makefile | 5 +---- support/bench.sh | 21 --------------------- support/templates/mochiwebapp.template | 2 ++ support/templates/mochiwebapp_skel/bench.sh | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/bd6ae7cb/Makefile ---------------------------------------------------------------------- diff --git a/Makefile b/Makefile index 7205dcf..983c304 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,5 @@ clean: @$(REBAR) clean app: + @[ -z "$(PROJECT)" ] && echo "ERROR: required variable PROJECT missing" 1>&2 && exit 1 || true @$(REBAR) -r create template=mochiwebapp dest=$(DEST) appid=$(PROJECT) - -bench: app - @echo "Writing $(DEST)/$(PROJECT).sh" - @cp support/bench.sh $(DEST)/bench.sh http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/bd6ae7cb/support/bench.sh ---------------------------------------------------------------------- diff --git a/support/bench.sh b/support/bench.sh deleted file mode 100755 index 7af4c69..0000000 --- a/support/bench.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -SERVER_IP="" - -if test ! -n "$SERVER_IP"; then - echo "error: please set SERVER_IP" - exit 1 -fi - -BENCH_RUN="siege -q -c400 -r100 -b http://$SERVER_IP:8080/hello_world" - -sleep 120 - -echo "" -echo "" -for i in `seq 1 10`; -do - echo "Running test #$i:" - $BENCH_RUN - sleep 90 -done http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/bd6ae7cb/support/templates/mochiwebapp.template ---------------------------------------------------------------------- diff --git a/support/templates/mochiwebapp.template b/support/templates/mochiwebapp.template index 4942609..c56314c 100644 --- a/support/templates/mochiwebapp.template +++ b/support/templates/mochiwebapp.template @@ -13,6 +13,7 @@ {template, "mochiwebapp_skel/src/mochiapp_sup.erl", "{{dest}}/src/{{appid}}_sup.erl"}. {template, "mochiwebapp_skel/src/mochiapp_web.erl", "{{dest}}/src/{{appid}}_web.erl"}. {template, "mochiwebapp_skel/start-dev.sh", "{{dest}}/start-dev.sh"}. +{template, "mochiwebapp_skel/bench.sh", "{{dest}}/bench.sh"}. {template, "mochiwebapp_skel/priv/www/index.html", "{{dest}}/priv/www/index.html"}. {file, "../../.gitignore", "{{dest}}/.gitignore"}. {file, "../../Makefile", "{{dest}}/Makefile"}. @@ -20,3 +21,4 @@ {file, "../../rebar", "{{dest}}/rebar"}. {chmod, 8#755, "{{dest}}/rebar"}. {chmod, 8#755, "{{dest}}/start-dev.sh"}. +{chmod, 8#755, "{{dest}}/bench.sh"}. http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/bd6ae7cb/support/templates/mochiwebapp_skel/bench.sh ---------------------------------------------------------------------- diff --git a/support/templates/mochiwebapp_skel/bench.sh b/support/templates/mochiwebapp_skel/bench.sh new file mode 100755 index 0000000..eb6e9c9 --- /dev/null +++ b/support/templates/mochiwebapp_skel/bench.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# workaround for rebar mustache template bug +DEFAULT_PORT={{port}} +HOST=${HOST:-127.0.0.1} +PORT=${PORT:-${DEFAULT_PORT}} + +BENCH_RUN="siege -q -c400 -r100 -b http://$HOST:$PORT/hello_world" + +sleep 120 + +echo "" +echo "" +for i in `seq 1 10`; +do + echo "Running test #$i:" + $BENCH_RUN + sleep 90 +done