소스 검색

Properly report C++ build time.

Josh Haberman 9 년 전
부모
커밋
2bda98f79c
3개의 변경된 파일15개의 추가작업 그리고 8개의 파일을 삭제
  1. 7 5
      tools/jenkins/build_and_run_docker.sh
  2. 2 2
      tools/jenkins/make_test_output.py
  3. 6 1
      tools/run_tests/jenkins.sh

+ 7 - 5
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 \
   "$@" \

+ 2 - 2
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()

+ 6 - 1
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.