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