Mercurial > hg > thermostat-ng > agent
changeset 1740:a1c7370468fd
Add more debugging to maven archetype verifiers.
Reviewed-by: omajid
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2015-May/013834.html
author | Severin Gehwolf <sgehwolf@redhat.com> |
---|---|
date | Wed, 27 May 2015 18:29:13 +0200 |
parents | 4eaf55dd4a40 |
children | 91c0f17d7366 |
files | distribution/scripts/thermostat-devsetup distribution/tools/verify-archetype-functions.sh distribution/tools/verify-archetype-multimodule.sh |
diffstat | 3 files changed, 36 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/distribution/scripts/thermostat-devsetup Wed May 27 12:17:35 2015 +0200 +++ b/distribution/scripts/thermostat-devsetup Wed May 27 18:29:13 2015 +0200 @@ -54,10 +54,11 @@ # Call the setup script $THERMOSTAT_SETUP < $DEV_INPUT +retval=$? -if [ $? -ne 0 ]; then +if [ $retval -ne 0 ]; then echo "Development setup failed." 1>&2 - exit $? + exit $retval fi # Copy the agent.auth file into USER_THERMOSTAT_HOME
--- a/distribution/tools/verify-archetype-functions.sh Wed May 27 12:17:35 2015 +0200 +++ b/distribution/tools/verify-archetype-functions.sh Wed May 27 18:29:13 2015 +0200 @@ -77,7 +77,7 @@ if [ "x$KEEPTEMP" != "x--keepTemp" ]; then cleanup_tempdirs $TMP_DIR \ $PLUGIN_INSTALL_LOCATION \ - $THERMOSTAT_HOME/webapp/WEB-INF/lib/"$ARTIFACT_ID"-storage-common-0.0.1-SNAPSHOT.jar + $THERMOSTAT_HOME/webapp/WEB-INF/lib/"$ARTIFACT_ID"-storage-common*.jar fi } @@ -96,13 +96,32 @@ } function exit_if_bad_return_value() { - RVAL=$1 - if [ $RVAL -ne 0 ]; then + local rval="" + local debugFile="" + local errorMsg="" + + # Check if we got passed a third argument which is a file with + # details about the failure that happened. + if [ $# -eq 3 ]; then + rval=$1 + debugFile=$2 + errorMsg=$3 + else + rval=$1 + debugFile="" + errorMsg=$2 + fi + + if [ $rval -ne 0 ]; then + # Only print debug info if we actually have one + if [ "_$debugFile" != "_" ]; then + echo "------------------- Debug info start ---------------------" + cat "$debugFile" + echo "------------------- Debug info end ---------------------" + fi cleanup - shift - echo $@ + echo "$errorMsg" output_fail_information - exit $RVAL + exit $rval fi } -
--- a/distribution/tools/verify-archetype-multimodule.sh Wed May 27 12:17:35 2015 +0200 +++ b/distribution/tools/verify-archetype-multimodule.sh Wed May 27 18:29:13 2015 +0200 @@ -53,6 +53,8 @@ WSS_PID="$TMP_DIR/web-storage-service.pid" WSS_OUTPUT="$TMP_DIR/wss_output.txt" +EXAMPLE_CMD_OUTPUT="$TMP_DIR/example_cmd_output.txt" + function launch_and_wait_for_web_storage() { $THERMOSTAT_EXE -Tbg $WSS_PID web-storage-service > $WSS_OUTPUT 2>&1 @@ -124,7 +126,7 @@ exit_if_bad_return_value $? "Error configuring Thermostat (devsetup)" launch_and_wait_for_web_storage -exit_if_bad_return_value $? "Web Storage Service not coming up" +exit_if_bad_return_value $? "$WSS_OUTPUT" "Web Storage Service not coming up" # Why head -n4? Output looks like the following: # @@ -142,8 +144,10 @@ exit_if_bad_return_value $? "Plugin command not appearing in Thermostat help" # verify "example-command" works as expected -echo -e "client-tester\ntester" | $THERMOSTAT_EXE example-command -a $AGENT_ID | grep 'Message: Hello World!' -exit_if_bad_return_value $? "Plugin command not working" +example_cmd="echo -e \"client-tester\ntester\" | $THERMOSTAT_EXE example-command -a $AGENT_ID | grep 'Message: Hello World!'" +echo $example_cmd >> $EXAMPLE_CMD_OUTPUT 2>&1 +$example_cmd >> $EXAMPLE_CMD_OUTPUT 2>&1 +exit_if_bad_return_value $? "$EXAMPLE_CMD_OUTPUT" "Plugin command not working" kill_and_wait_for_webstorage