diff options
author | 2015-06-23 17:15:12 +0000 | |
---|---|---|
committer | 2015-06-24 12:08:13 +0000 | |
commit | 338dc56eae94efcaaf67850dcf9424314ea5b72e (patch) | |
tree | ac67f547946518562a4e867c2a90d899ffc7be77 | |
parent | 9290ac6c8dac3a36a73278cb3d179704f7663782 (diff) |
Disable tests that requires JDK 8 when using compile.sh
Also fix the OS X travis build file.
--
MOS_MIGRATED_REVID=96683399
-rwxr-xr-x | .travis/build.sh | 12 | ||||
-rwxr-xr-x | compile.sh | 13 | ||||
-rwxr-xr-x | scripts/bootstrap/buildenv.sh | 18 | ||||
-rwxr-xr-x | scripts/bootstrap/compile.sh | 18 |
4 files changed, 38 insertions, 23 deletions
diff --git a/.travis/build.sh b/.travis/build.sh index 0a160ee5d4..03c419f15c 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -23,21 +23,17 @@ fi if [[ $TRAVIS_OS_NAME = 'osx' ]]; then export JAVA_VERSION=1.7 - sed -i.bak 's/_version = "8",/_version = "7",/' tools/jdk/BUILD - cat .travis/jdk7.WORKSPACE >WORKSPACE - # Ignore zip tests as they requires to much space and jdk8 stuff - cat <<'EOF' >.bazelrc -build --test_tag_filters -zip,-jdk8,-skyframe -EOF - export BAZELRC=$PWD/.bazelrc + # Ignore zip tests as they requires to much space. + export BAZEL_TEST_FILTERS="-zip,-skyframe" ./compile.sh all else sudo apt-get update -qq sudo apt-get install -y netcat-traditional sudo update-alternatives --set nc /bin/nc.traditional export JAVA_HOME=/usr/lib/jvm/java-8-oracle - export JAVA_OPTS="-Xmx3000m" cat > .bazelrc <<EOF +startup --host_jvm_args=-Xmx2500m +startup --host_jvm_args=-Xms2500m" test --ram_utilization_factor=10 EOF export BAZELRC="$(pwd)/.bazelrc" diff --git a/compile.sh b/compile.sh index cf123779be..bb93313949 100755 --- a/compile.sh +++ b/compile.sh @@ -157,7 +157,20 @@ fi if [ $DO_TESTS ]; then new_step "Running tests" display "." + [ -n "$JAVAC_VERSION" ] || get_java_version + if [[ ! "${BAZEL_TEST_FILTERS-}" =~ "-jdk8" ]] \ + && [ "8" -gt ${JAVAC_VERSION#*.} ]; then + display "$WARNING Your version of Java is lower than 1.8!" + display "$WARNING Deactivating Java 8 tests, please use a JDK 8 to fully" + display "$WARNING test Bazel." + if [ -n "${BAZEL_TEST_FILTERS-}" ]; then + BAZEL_TEST_FILTERS="${BAZEL_TEST_FILTERS},-jdk8" + else + BAZEL_TEST_FILTERS="-jdk8" + fi + fi $BAZEL --blazerc=${BAZELRC} --nomaster_blazerc test \ + --test_tag_filters="${BAZEL_TEST_FILTERS-}" \ --build_tests_only \ --javacopt="-source ${JAVA_VERSION} -target ${JAVA_VERSION}" \ -k --test_output=errors //src/... //third_party/ijar/... //scripts/... \ diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh index 3be93df1c3..812e31909d 100755 --- a/scripts/bootstrap/buildenv.sh +++ b/scripts/bootstrap/buildenv.sh @@ -81,6 +81,7 @@ function clear_log() { LEAVES="\xF0\x9F\x8D\x83" INFO="\033[32mINFO\033[0m:" +WARNING="\033[31mWARN\033[0m:" first_step=1 function new_step() { @@ -109,3 +110,20 @@ else md5sum $1 } fi + +# Gets the java version from JAVA_HOME +# Sets JAVAC and JAVAC_VERSION with respectively the path to javac and +# the version of javac. +function get_java_version() { + test -z "$JAVA_HOME" && fail "JDK not found, please set \$JAVA_HOME." + JAVAC="${JAVA_HOME}/bin/javac" + [[ -x "${JAVAC}" ]] \ + || fail "JAVA_HOME ($JAVA_HOME) is not a path to a working JDK." + + JAVAC_VERSION=$("${JAVAC}" -version 2>&1) + if [[ "$JAVAC_VERSION" =~ ^"javac "(1\.([789]|[1-9][0-9])).*$ ]]; then + JAVAC_VERSION=${BASH_REMATCH[1]} + else + fail "Cannot determine JDK version, please set \$JAVA_HOME." + fi +} diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh index 5ac4efe208..9161905001 100755 --- a/scripts/bootstrap/compile.sh +++ b/scripts/bootstrap/compile.sh @@ -134,22 +134,10 @@ esac [[ -x "${PROTOC-}" ]] \ || fail "Protobuf compiler not found in ${PROTOC-}" -test -z "$JAVA_HOME" && fail "JDK not found, please set \$JAVA_HOME." - -JAVAC="${JAVA_HOME}/bin/javac" - -[[ -x "${JAVAC}" ]] \ - || fail "JAVA_HOME ($JAVA_HOME) is not a path to a working JDK." - # Check that javac -version returns a upper version than $JAVA_VERSION. -JAVAC_VERSION=$("${JAVAC}" -version 2>&1) -if [[ "$JAVAC_VERSION" =~ ^"javac "(1\.([789]|[1-9][0-9])).*$ ]]; then - JAVAC_VERSION=${BASH_REMATCH[1]} - [ ${JAVA_VERSION#*.} -le ${JAVAC_VERSION#*.} ] || \ - fail "JDK version (${JAVAC_VERSION}) is lower than ${JAVA_VERSION}, please set \$JAVA_HOME." -else - fail "Cannot determine JDK version, please set \$JAVA_HOME." -fi +get_java_version +[ ${JAVA_VERSION#*.} -le ${JAVAC_VERSION#*.} ] || \ + fail "JDK version (${JAVAC_VERSION}) is lower than ${JAVA_VERSION}, please set \$JAVA_HOME." JAR="${JAVA_HOME}/bin/jar" |