• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2
3# Exit on any error.
4set -e
5
6test_version() {
7  version=$1
8
9  # TODO(teboring): timestamp parsing is incorrect only on mac due to mktime.
10  if [[ $(uname -s) == Linux ]]
11  then
12    RUBY_CONFORMANCE=test_ruby
13  elif [[ $(uname -s) == Darwin ]]
14  then
15    # TODO(teboring): timestamp parsing is incorrect only on mac due to mktime.
16    RUBY_CONFORMANCE=test_ruby_mac
17  fi
18
19  if [ "$version" == "jruby-1.7" ] ; then
20    # No conformance tests yet -- JRuby is too broken to run them.
21    bash --login -c \
22      "rvm install $version && rvm use $version && rvm get head && \
23       which ruby && \
24       git clean -f && \
25       gem install bundler && bundle && \
26       rake test"
27  elif [ "$version" == "ruby-2.6.0" ] ; then
28    bash --login -c \
29      "rvm install $version && rvm use $version && \
30       which ruby && \
31       git clean -f && \
32       gem install bundler -v 1.17.3 && bundle && \
33       rake test &&
34       rake gc_test &&
35       cd ../conformance && make ${RUBY_CONFORMANCE} &&
36       cd ../ruby/compatibility_tests/v3.0.0 &&
37       cp -R ../../lib lib && ./test.sh"
38  else
39    # Recent versions of OSX have deprecated OpenSSL, so we have to explicitly
40    # provide a path to the OpenSSL directory installed via Homebrew.
41    bash --login -c \
42      "rvm install $version --with-openssl-dir=`brew --prefix openssl` && \
43       rvm use $version && \
44       which ruby && \
45       git clean -f && \
46       gem install bundler -v 1.17.3 && bundle && \
47       rake test &&
48       rake gc_test &&
49       cd ../conformance && make ${RUBY_CONFORMANCE} &&
50       cd ../ruby/compatibility_tests/v3.0.0 && ./test.sh"
51  fi
52}
53
54test_version $1
55