Revision 8fae0052c8e0888953da159045909ea2c1336b3d authored by Semen Zhydenko on 11 February 2018, 02:58:13 UTC, committed by jekyllbot on 11 February 2018, 02:58:13 UTC
Merge pull request 6764
1 parent 33017b7
Raw File
test
#!/usr/bin/env bash
set -e

# Usage:
#   script/test <test_file>
#   script/test [ruby|jruby]
#   script/test

if [ -d test/dest ]
  then rm -r test/dest
fi

# -----------------------------------------------------------------------------
# If you send us a ruby then we use that, if you do not then we test with
# whatever we can detect, this way you can run both suites when you test out
# your source, we expect full coverage now, not just MRI.
# -----------------------------------------------------------------------------

if [[ "$1" == "ci" ]]
then
  rubies=(
    ruby
  )

  shift
elif [[ "$1" == "ruby" ]] || [[ "$1" == "jruby" ]]
then
  rubies=(
    $1
  )

  shift
else
  rubies=($(script/rubies))
fi


for ruby in $rubies; do
  if [[ "$ruby" == "jruby" ]]
  then
    testopts=""
  else
    testopts="--profile"
  fi

  if [[ $# -lt 1 ]]
  then
    set -x
    time $ruby -S bundle exec \
      rake TESTOPTS=$testopts test
   else
    set -x
    time $ruby -S bundle exec ruby -I test \
      "$@" $testops
  fi
done
back to top