-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcoverage.sh
executable file
·65 lines (55 loc) · 1.7 KB
/
coverage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# This script builds the coverage report but has options to use the
# published test harness docker image or a local image, and the option to use
# the default tests included in the published image or local tests.
#
# The script creates directories in current working directory for:
# - config
# - reports
display_usage() {
cat << EOF
Usage: ./coverage.sh [-d testdir] [-l] [-h]
-d <testdir> Use local development version of tests in specified location
-l Use local docker image of test harness (called testharness)
-h Display usage
EOF
}
setup_config() {
mkdir -p config
cp ./application.yaml ./config/application.yaml
}
dockerimage='solidproject/conformance-test-harness'
dockerargs=('-i' '--rm')
cwd=$(pwd)
# parse options
while getopts ":lhd:" arg; do
case $arg in
d)
testDir="$(cd "${OPTARG}" && pwd)"
setup_config
outdir='local'
dockerargs+=('-v' "$testDir/:/data" '-v' "$cwd/config:/app/config")
;;
l)
outdir='local'
dockerimage='testharness'
;;
h)
display_usage
exit 0
esac
done
shift $((OPTIND-1))
dockerargs+=('-v' "$cwd/reports:/reports")
dockerargs+=('--env' 'USERS_ALICE_WEBID=x' '--env' 'USERS_BOB_WEBID=x')
dockerargs+=('--env' 'SOLID_IDENTITY_PROVIDER=x' '--env' 'TEST_CONTAINER=x' '--env' 'RESOURCE_SERVER_ROOT=x')
harnessargs=('--output=/reports' "--coverage")
# ensure report directory exists
mkdir -p reports
# optionally pull published CTH image
if [[ ! $dockerimage == 'testharness' ]]
then
docker pull solidproject/conformance-test-harness
fi
echo "RUNNING: docker run ${dockerargs[@]} $dockerimage ${harnessargs[@]} $@"
docker run ${dockerargs[@]} $dockerimage ${harnessargs[@]} $@