Fix crunch script to set trash_intermediate and intermediate_output_ttl refs #11100
[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 pip install cwltest
65
66 mkdir -p /tmp/cwltest
67 cd /tmp/cwltest
68 if ! test -d common-workflow-language ; then
69   git clone https://github.com/common-workflow-language/common-workflow-language.git
70 fi
71 cd common-workflow-language
72 git pull
73 export ARVADOS_API_HOST=localhost:8000
74 export ARVADOS_API_HOST_INSECURE=1
75 export ARVADOS_API_TOKEN=\$(cat /var/lib/arvados/superuser_token)
76
77 arv-keepdocker --pull arvados/jobs latest
78
79 cat >/tmp/cwltest/arv-cwl-jobs <<EOF2
80 #!/bin/sh
81 exec arvados-cwl-runner --api=jobs --compute-checksum \\\$@
82 EOF2
83 chmod +x /tmp/cwltest/arv-cwl-jobs
84
85 cat >/tmp/cwltest/arv-cwl-containers <<EOF2
86 #!/bin/sh
87 exec arvados-cwl-runner --api=containers --compute-checksum \\\$@
88 EOF2
89 chmod +x /tmp/cwltest/arv-cwl-containers
90
91 env
92 exec ./run_test.sh $@
93 EOF
94
95 CODE=$?
96
97 if test $leave_running = 0 ; then
98     arvbox stop
99 fi
100
101 exit $CODE