forked from nickjer/singularity-r
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.sh
executable file
·114 lines (88 loc) · 1.79 KB
/
run_tests.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env bash
set -ue
echo "Currently not functional, need to fix the tests first" >&2
exit 1
export IMG="r-py.sif"
echo "Using Singularity image: ${IMG}"
#
################# Verify R version (label)
#
version () {
singularity inspect "${IMG}" | \
grep "R_Version" | \
awk '{print $2}'
}
# singularity exec "$IMG" R -q -e "stopifnot(getRversion() == '$(version)')"
WD="$PWD"
set -x
#
################ Test container setup
#
cd "$WD"
mkdir test
mkdir test/container-r
cd test/container-r
cp -L ../../r-py.sif .
cp ../../scripts/outside/*
#
################ Test project creation
#
cd ..
mkdir project-r
cd project-r
../container-r/createproject --yes
#
################ Test cexec working dir
#
wd="$(./cexec pwd)"
test "$wd" = "/proj"
mkdir subdir
cd subdir
wd="$(../cexec pwd)"
test "$wd" = "/proj/subdir"
#
################ RStudio: setup
#
cd "$WD"
mkdir test/container-rstudio
cd test/container-rstudio
cp -L ../../rstudio.sif .
singularity run rstudio.sif setup
#
################ RStudio: project creation
#
cd ..
mkdir project-rstudio
cd project-rstudio
../container-rstudio/createproject --yes
#
################ RStudio: cexec working dir
#
wd="$(./rstudio exec pwd)"
test "$wd" = "/proj"
mkdir subdir
cd subdir
wd="$(../rstudio exec pwd)"
test "$wd" = "/proj/subdir"
cd ..
#
################ RStudio: start, list, stop, restart
#
# Set RStudio passwort "test"
cat >.rstudio-passwd <<'EOF'
$6$LqGleFffXVZs1uew$SQRgaAXw18WLbfKagMGGkbz5ZZ/zEsIDWDT4Q4L5P5x9ZcfYpAH18eZUppOvOY.AGfP5B0Sn20pPoFbBPKBv71
EOF
./rstudio start test
# wait until RStudio ist started
sleep 5s
mkdir listtest
cd listtest
n="$(../rstudio list | wc -l)"
test "$n" = 2 # header and 1 running instance
cd ..
./rstudio stop test
sleep 5s
./rstudio start test
sleep 5s
./rstudio stop test
echo "All tests passed!"