Merge branch 'master' into 9187-crunchv2-dispatching
[arvados.git] / sdk / cwl / test_with_arvbox.sh
1 #!/bin/sh
2
3 if ! which arvbox >/dev/null ; then
4     export PATH=$PATH:$(readlink -f $(dirname $0)/../../tools/arvbox/bin)
5 fi
6
7 reset_container=1
8 leave_running=0
9 config=dev
10
11 while test -n "$1" ; do
12     arg="$1"
13     case "$arg" in
14         --no-reset-container)
15             reset_container=0
16             shift
17             ;;
18         --leave-running)
19             leave_running=1
20             shift
21             ;;
22         --config)
23             config=$2
24             shift ; shift
25             ;;
26         -h|--help)
27             echo "$0 [--no-reset-container] [--leave-running] [--config dev|localdemo]"
28             exit
29             ;;
30         -*)
31             break
32             ;;
33     esac
34 done
35
36 if test -z "$ARVBOX_CONTAINER" ; then
37    export ARVBOX_CONTAINER=cwltest
38 fi
39
40 if test $reset_container = 1 ; then
41     arvbox reset -f
42 fi
43
44 arvbox start $config
45
46 arvbox pipe <<EOF
47 set -eu -o pipefail
48
49 . /usr/local/lib/arvbox/common.sh
50
51 cd /usr/src/arvados/sdk/cwl
52 python setup.py sdist
53 pip_install \$(ls dist/arvados-cwl-runner-*.tar.gz | tail -n1)
54
55 mkdir -p /tmp/cwltest
56 cd /tmp/cwltest
57 if ! test -d common-workflow-language ; then
58   git clone https://github.com/common-workflow-language/common-workflow-language.git
59 fi
60 cd common-workflow-language
61 git pull
62 export ARVADOS_API_HOST=localhost:8000
63 export ARVADOS_API_HOST_INSECURE=1
64 export ARVADOS_API_TOKEN=\$(cat /var/lib/arvados/superuser_token)
65
66 arv-keepdocker --pull arvados/jobs
67
68 env
69 exec ./run_test.sh "$@"
70 EOF
71
72 CODE=$?
73
74 if test $leave_running = 0 ; then
75     arvbox stop
76 fi
77
78 exit $CODE