-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathruntest
executable file
·66 lines (54 loc) · 1.47 KB
/
runtest
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
#!/usr/bin/env bash
## Check CRAN compatibilty with devtools::check()
checkdir=`mktemp -d`
cat <<EOF | R --no-save
library(devtools)
library(romero.gateway)
devtools::check(check_dir = '$checkdir')
EOF
if grep -q 'ERROR\|WARNING' $checkdir/romero.gateway.Rcheck/00check.log; then
echo "Error/Warnings found with devtools::check()"
exit 1
fi
## Run integration tests when test server is ready
OMERO_SERVER_HOST=${OMERO_SERVER_HOST:-omero}
OMERO_SERVER_PORT=${OMERO_SERVER_PORT:-4064}
OMERO_SERVER_USER=${OMERO_SERVER_USER:-root}
OMERO_SERVER_PASS=${OMERO_SERVER_PASS:-omero}
cat <<EOF | R --no-save
library(devtools)
library(romero.gateway)
server <- OMEROServer(host='$OMERO_SERVER_HOST',port=as.integer($OMERO_SERVER_PORT),username='$OMERO_SERVER_USER',password='$OMERO_SERVER_PASS')
# Retry connecting until server is up and running
ready <- FALSE
for (i in 1:30) {
server <- tryCatch(
{
connect(server)
},
error=function(err) {
message(paste("ERROR: ", err))
return(NULL)
},
warning=function(warn) {
message(paste("WARN: ", warn))
},
finally={
}
)
if (!is.null(server)) {
ready <- TRUE
disconnect(server)
break
}
else {
Sys.sleep(10)
}
}
if (ready) {
devtools::test()
} else {
message("Could not get connection to server")
quit(save = "no", status = 1, runLast = FALSE)
}
EOF