Adjustments for CRAN upload
[valse.git] / test / run.sh
CommitLineData
d7e82077
BA
1#!/bin/sh
2set -e
3
4#Testing procedure for EMGLLF (inside this folder):
5
6algo=$1 #EMGLLF or EMGrank,
7 #second arg indicate if rebuild or rebuild+clean requested
8
9if [ "$2" == 'c' ]; then
10 #0.1) Clean package + C testing code
11 find ../pkg/man/ -type f ! -name 'valse-package.Rd' -delete
d7e82077
BA
12 # Erase object and library files
13 rm -f ../pkg/src/*.so
14 rm -f ../pkg/src/adapters/*.o
15 make cclean
16fi
17
18if [ "$2" == 'r' ] || [ "$2" == 'c' ]; then
19 #0.2) Install current version of the package (WARNING: roxygen 2 v5.0.1)
20 # --> devtools::install_github('klutometis/roxygen@v5.0.1')
21 echo "setwd('../pkg');library(roxygen2);roxygenize('.')" | R --slave
22 R CMD INSTALL ../pkg
23fi
24
25#1) Generate data using R versions of EMGLLF/EMGrank (slow, but trusted)
d7e82077
BA
26echo -e "source('generateRunSaveTest_$algo.R');\n \
27 # I'm happy with default values - feel free to give args\n \
28 generateRunSaveTest_$algo() " \
29 | R --slave
d7e82077
BA
30
31#2) Compile test C code into an executable named "test.$algo"
32make test.$algo
33
34#3) Run it with valgrind!
bb64f5cb 35#valgrind
d7e82077 36./test.$algo