-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathtestspict.sh
executable file
·77 lines (53 loc) · 1.86 KB
/
testspict.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
#!/bin/bash
SECONDS=0
tmpdir=$(mktemp -d)
RED='\033[31m'
ref="master"
vignfn="spict/vignettes/spict_handbook.Rmd"
while getopts ":r:v:" opt; do
case $opt in
r)
ref=$OPTARG
;;
v)
vignfn=$OPTARG
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
echo "Working on temporary directory: " $tmpdir
printmsg () {
CYAN='\033[96m'
NC='\033[0m' # No Color
printf "${CYAN}*************************************************\n"
printf "$1\n"
printf "*************************************************${NC}\n"
}
printmsg "Installing spict from github, reference: $ref"
echo "withr::with_libpaths(new = '$tmpdir', {remotes::install_cran('ellipse', quiet = FALSE, repo = 'http://cran.rstudio.com')}, action=\"prefix\")" | R --slave
echo "withr::with_libpaths(new = '$tmpdir', {remotes::install_github('DTUAqua/spict/spict', ref = '$ref', quiet = FALSE)}, action=\"prefix\")" | R --slave
printmsg "Run vignette examples"
./runexamples.R -r $vignfn -o $tmpdir -l $tmpdir -f old.md
printmsg "Install local spict version"
echo "withr::with_libpaths(new = '$tmpdir', {remotes::install_local('spict', quiet = TRUE)}, action=\"prefix\")" | R --slave
printmsg "Run vignette examples"
./runexamples.R -r $vignfn -o $tmpdir -l $tmpdir -f new.md
printmsg "All examples are done using the two verions of R\nTime ellapsed" $SECONDS "seconds"
printmsg "Compare examples"
if [ ! -e $tmpdir/new.md ] || [ ! -e $tmpdir/old.md ]; then
printf "${RED}The example files are not found\n"
exit 124
fi
newhash=$(md5sum $tmpdir/new.md | cut -d " " -f1)
oldhash=$(md5sum $tmpdir/old.md | cut -d " " -f1)
if [ $newhash == $oldhash ] ; then
echo "The two versions of spict are producing the same results."
else
printf "${RED}There are differences in the two versions of spict."
diff $tmpdir/old.md $tmpdir/new.md
exit 1
fi
exit