Commit 7f1d8df3 by Mislav Marohnić

Read Java version number even if it's not on the 1st line

Handles output like:

    Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
    java version "1.8.0_31"

Fixes #710
parent f674efd6
...@@ -687,7 +687,7 @@ fix_rbx_irb() { ...@@ -687,7 +687,7 @@ fix_rbx_irb() {
} }
require_java7() { require_java7() {
local version="$(java -version 2>&1 | head -1)" local version="$(java -version 2>&1 | grep 'java version' | head -1)"
if [[ $version != *1.[789]* ]]; then if [[ $version != *1.[789]* ]]; then
colorize 1 "ERROR" >&3 colorize 1 "ERROR" >&3
echo ": Java 7 required. Please install a 1.7-compatible JRE." >&3 echo ": Java 7 required. Please install a 1.7-compatible JRE." >&3
......
...@@ -589,6 +589,18 @@ DEF ...@@ -589,6 +589,18 @@ DEF
assert_success assert_success
} }
@test "Java version string not on first line" {
cached_tarball "jruby-9000.dev" bin/jruby
stub java "-version : echo 'Picked up JAVA_TOOL_OPTIONS' >&2; echo 'java version \"1.8.0_31\"' >&2"
run_inline_definition <<DEF
require_java7
install_package "jruby-9000.dev" "http://ci.jruby.org/jruby-dist-9000.dev-bin.tar.gz" jruby
DEF
assert_success
}
@test "non-writable TMPDIR aborts build" { @test "non-writable TMPDIR aborts build" {
export TMPDIR="${TMP}/build" export TMPDIR="${TMP}/build"
mkdir -p "$TMPDIR" mkdir -p "$TMPDIR"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment