From 2bda98f79ca9f43091d2033cf02c9732a0515a7a Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 3 Mar 2016 17:04:36 -0800 Subject: Properly report C++ build time. --- tools/jenkins/build_and_run_docker.sh | 12 +++++++----- tools/jenkins/make_test_output.py | 4 ++-- tools/run_tests/jenkins.sh | 7 ++++++- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'tools') diff --git a/tools/jenkins/build_and_run_docker.sh b/tools/jenkins/build_and_run_docker.sh index 448b00c0..18b910a7 100755 --- a/tools/jenkins/build_and_run_docker.sh +++ b/tools/jenkins/build_and_run_docker.sh @@ -46,16 +46,18 @@ cd - # Use image name based on Dockerfile location checksum DOCKER_IMAGE_NAME=$(basename $DOCKERFILE_DIR)_$(sha1sum $DOCKERFILE_DIR/Dockerfile | cut -f1 -d\ ) +# Ensure existence of ccache directory +CCACHE_DIR=/tmp/protobuf-ccache +mkdir -p $CCACHE_DIR + # Make sure docker image has been built. Should be instantaneous if so. -docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_DIR +docker build \ + -v $CCACHE_DIR:$CCACHE_DIR \ + -t $DOCKER_IMAGE_NAME $DOCKERFILE_DIR # Choose random name for docker container CONTAINER_NAME="build_and_run_docker_$(uuidgen)" -# Ensure existence of ccache directory -CCACHE_DIR=/tmp/protobuf-ccache -mkdir -p $CCACHE_DIR - # Run command inside docker docker run \ "$@" \ diff --git a/tools/jenkins/make_test_output.py b/tools/jenkins/make_test_output.py index 0ba5db3b..986d1979 100644 --- a/tools/jenkins/make_test_output.py +++ b/tools/jenkins/make_test_output.py @@ -58,8 +58,8 @@ def readtests(basedir): # up in the job log. tests["cpp"]["name"] = "cpp" - # TODO - tests["cpp"]["time"] = "0" + with open(basedir + '/logs/1/cpp/build_time', 'r') as f: + tests["cpp"]["time"] = f.read().strip() tests["cpp"]["failure"] = False ret = tests.values() diff --git a/tools/run_tests/jenkins.sh b/tools/run_tests/jenkins.sh index 32050d25..0bd9ffe5 100755 --- a/tools/run_tests/jenkins.sh +++ b/tools/run_tests/jenkins.sh @@ -34,7 +34,12 @@ mkdir -p $LOG_OUTPUT_DIR/1/cpp # $DIR/logs/1/java_jdk7/stderr CPP_STDOUT=$LOG_OUTPUT_DIR/1/cpp/stdout CPP_STDERR=$LOG_OUTPUT_DIR/1/cpp/stderr -$TEST_SCRIPT cpp > >(tee $CPP_STDOUT) 2> >(tee $CPP_STDERR >&2) + +# It's important that we get /usr/bin/time (which supports -f and -o) and not +# the bash builtin "time" which doesn't. +TIME_CMD="/usr/bin/time -f %e -o $LOG_OUTPUT_DIR/1/cpp/build_time" + +$TIME_CMD $TEST_SCRIPT cpp > >(tee $CPP_STDOUT) 2> >(tee $CPP_STDERR >&2) # Other tests are run in parallel. The overall run fails if any one of them # fails. -- cgit v1.2.3