X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/79df4374ee643ae843e93abc14b80145c9154730..f7878b7f8780cb2e17078486b2239661be6aeedc:/jenkins/run-tests.sh diff --git a/jenkins/run-tests.sh b/jenkins/run-tests.sh index 4c5f070c39..4724cfa8c9 100755 --- a/jenkins/run-tests.sh +++ b/jenkins/run-tests.sh @@ -5,21 +5,62 @@ # Exit non-zero if any tests fail. # # Arguments: -# --skip FOO Do not test the FOO component. -# --only FOO Do not test anything except the FOO component. +# --skip FOO Do not test the FOO component. +# --only FOO Do not test anything except the FOO component. +# envvar=value Set $envvar to value # # Regardless of which components are tested, install all components in # the usual sequence. (Many test suites depend on other components # being installed.) +# +# To run a specific Ruby test, set $workbench_test, $apiserver_test or +# $cli_test on the command line: +# +# $ run-tests.sh --only workbench workbench_test=TEST=test/integration/pipeline_instances_test.rb +# +# +# To run a specific Python test set $python_sdk_test or $fuse_test. +# +# $ run-tests.sh --only python_sdk python_sdk_test="--test-suite tests.test_keep_locator" +# +# +# You can also pass "export ARVADOS_DEBUG=1" to enable additional debugging output: +# +# $ run-tests.sh "export ARVADOS_DEBUG=1" +# +# +# Finally, you can skip the installation steps on subsequent runs this way: +# +## First run +# $ run-tests.sh --leave-temp +# +## Subsequent runs: record the values of VENVDIR and GOPATH from the first run, and +# provide them on the command line in subsequent runs: +# +# $ run-tests.sh --skip-install VENVDIR="/tmp/tmp.y3tsTmigio" GOPATH="/tmp/tmp.3r4sSA9F3l" -COLUMNS=80 -ARVADOS_API_HOST=qr1hi.arvadosapi.com +# First make sure to remove any ARVADOS_ variables from the calling environment +# that could interfer with the tests. +unset $(env | cut -d= -f1 | grep \^ARVADOS_) + +COLUMNS=80 export GOPATH=$(mktemp -d) VENVDIR=$(mktemp -d) - -source /etc/profile.d/rvm.sh +cli_test= +workbench_test= +apiserver_test= +python_sdk_test= +ruby_sdk_test= +fuse_test= +leave_temp= +skip_install= + +if [[ -f /etc/profile.d/rvm.sh ]] +then + source /etc/profile.d/rvm.sh +fi fatal() { clear_temp @@ -56,6 +97,15 @@ do --only) only="$1"; shift ;; + --skip-install) + skip_install=1 + ;; + --leave-temp) + leave_temp=1 + ;; + *=*) + eval $(echo $arg | cut -d= -f1)=\"$(echo $arg | cut -d= -f2-)\" + ;; *) echo >&2 "$0: Unrecognized option: '$arg'" exit 1 @@ -99,16 +149,21 @@ do_test() { } do_install() { - title "Running $1 install" - timer_reset - if [[ "$2" == "go" ]] + if [[ -z "$skip_install" ]] then - go get -t "git.curoverse.com/arvados.git/$1" + title "Running $1 install" + timer_reset + if [[ "$2" == "go" ]] + then + go get -t "git.curoverse.com/arvados.git/$1" + else + "install_$1" + fi + checkexit "$1 install" + title "End of $1 install (`timer`)" else - "install_$1" + title "Skipping $1 install" fi - checkexit "$1 install" - title "End of $1 install (`timer`)" } title () { @@ -117,21 +172,29 @@ title () { } clear_temp() { - for t in "$VENVDIR" "$GOPATH" - do - if [[ -n "$t" ]] - then - rm -rf "$t" - fi - done + if [[ -z "$leave_temp" ]] + then + for t in "$VENVDIR" "$GOPATH" + do + if [[ -n "$t" ]] + then + rm -rf "$t" + fi + done + else + echo "Leaving VENVDIR=\"$VENVDIR\"" + echo "Leaving GOPATH=\"$GOPATH\"" + fi } test_docs() { cd "$WORKSPACE/doc" - bundle install --deployment + bundle install --no-deployment rm -rf .site # Make sure python-epydoc is installed or the next line won't do much good! + ARVADOS_API_HOST=qr1hi.arvadosapi.com PYTHONPATH=$WORKSPACE/sdk/python/ bundle exec rake generate baseurl=file://$WORKSPACE/doc/.site/ arvados_workbench_host=workbench.$ARVADOS_API_HOST arvados_api_host=$ARVADOS_API_HOST + unset ARVADOS_API_HOST } do_test docs @@ -141,9 +204,39 @@ test_doclinkchecker() { } do_test doclinkchecker +test_ruby_sdk() { + cd "$WORKSPACE/sdk/ruby" \ + && bundle install --no-deployment \ + && bundle exec rake test +} +do_test ruby_sdk + +install_ruby_sdk() { + cd "$WORKSPACE/sdk/ruby" \ + && gem build arvados.gemspec \ + && gem install --no-ri --no-rdoc arvados-*.gem +} +do_install ruby_sdk + +install_cli() { + cd "$WORKSPACE/sdk/cli" \ + && gem build arvados-cli.gemspec \ + && gem install --no-ri --no-rdoc arvados-cli-*.gem +} +do_install cli + +test_cli() { + title "Starting SDK CLI tests" + cd "$WORKSPACE/sdk/cli" \ + && bundle install --no-deployment \ + && mkdir -p /tmp/keep \ + && KEEP_LOCAL_STORE=/tmp/keep bundle exec rake test $cli_test +} +do_test cli + install_apiserver() { cd "$WORKSPACE/services/api" - bundle install --deployment + bundle install --no-deployment rm -f config/environments/test.rb cp config/environments/test.rb.example config/environments/test.rb @@ -183,16 +276,10 @@ do_install apiserver test_apiserver() { cd "$WORKSPACE/services/api" - bundle exec rake test + bundle exec rake test $apiserver_test } do_test apiserver -install_cli() { - cd "$WORKSPACE/sdk/cli" - bundle install --deployment -} -do_install cli - declare -a gostuff gostuff=( services/keepstore @@ -234,16 +321,20 @@ test_python_sdk() { # the .egg files that setup.py downloads. cd "$WORKSPACE/sdk/python" \ - && python setup.py test + && python setup.py test $python_sdk_test + r=$? easy_install *.egg + return $r } do_test python_sdk test_fuse() { # Install test dependencies here too, in case run_test_server needs them. cd "$WORKSPACE/services/fuse" \ - && python setup.py test + && python setup.py test $fuse_test + r=$? easy_install *.egg + return $r } do_test fuse @@ -254,20 +345,11 @@ done test_workbench() { cd "$WORKSPACE/apps/workbench" \ - && bundle install --deployment \ - && bundle exec rake test + && bundle install --no-deployment \ + && bundle exec rake test $workbench_test } do_test workbench -test_cli() { - title "Starting SDK CLI tests" - cd "$WORKSPACE/sdk/cli" \ - && bundle install --deployment \ - && mkdir -p /tmp/keep \ - && KEEP_LOCAL_STORE=/tmp/keep bundle exec rake test -} -do_test cli - clear_temp for x in "${successes[@]}"