From c43af9e8e3d8d8fff027317cbc9acef8a80be0de Mon Sep 17 00:00:00 2001 From: Alex Kotliarskyi Date: Sat, 18 Apr 2015 20:09:03 -0700 Subject: [PATCH] Print server logs from e2e tests --- packager/packager.sh | 6 ++++++ scripts/e2e-test.sh | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/packager/packager.sh b/packager/packager.sh index 93a017c35..f763b9bae 100755 --- a/packager/packager.sh +++ b/packager/packager.sh @@ -7,6 +7,12 @@ # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. +if [ $REACT_PACKAGER_LOG ]; +then + echo "Logs will be redirected to $REACT_PACKAGER_LOG" + exec &> $REACT_PACKAGER_LOG +fi + ulimit -n 4096 THIS_DIR=$(dirname "$0") diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index edb154ec3..cbac436f1 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -7,12 +7,19 @@ SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ROOT=$(dirname $SCRIPTS) TEMP=$(mktemp -d /tmp/react-native-XXXXXXXX) +# When tests run on CI server, we won't be able to see logs +# from packager because it runs in a separate window. This is +# a simple workaround, see packager/packager.sh +export REACT_PACKAGER_LOG="$TEMP/server.log" + # To make sure we actually installed the local version # of react-native, we will create a temp file inside SampleApp # and check that it exists after `react-native init` MARKER=$(mktemp $ROOT/Examples/SampleApp/XXXXXXXX) function cleanup { + set +e + [ -f $REACT_PACKAGER_LOG ] && cat $REACT_PACKAGER_LOG rm $MARKER [ $SINOPIA_PID ] && kill -9 $SINOPIA_PID [ -f ~/.npmrc.bak ] && mv ~/.npmrc.bak ~/.npmrc