-
Notifications
You must be signed in to change notification settings - Fork 58
/
test
executable file
·62 lines (49 loc) · 1.49 KB
/
test
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
#!/bin/bash
black () { color_text 30; }
blue () { color_text 34; }
green () { color_text 32; }
cyan () { color_text 36; }
red () { color_text 31; }
purple () { color_text 35; }
brown () { color_text 33; }
light_gray () { color_text 37; }
color_text () {
while read data; do echo -e "\033[$1m$data"; done
echo -e -n "\033[0m" # clear the color
}
# install ts command (used later in this script)
apt-get install -qq -y moreutils
DIR=`dirname $0`
# Make the repo root, wherever it got mounted in, the current directory.
# Helps tests that read/write test fixture files to find them.
cd "${DIR}" || exit 1
if [ $# -eq 0 ]; then
PACKAGES=$(./test-list.sh)
else
PACKAGES=$@
fi
for PACKAGE in $PACKAGES; do
PACKAGE_DIR=$DIR/packages/$PACKAGE
if [ -f $PACKAGE_DIR/install ]; then
echo " ***** PACKAGE $PACKAGE" | purple
echo " ***** INSTALLING..." | purple
bash $PACKAGE_DIR/install | ts
echo " ***** TESTING..." | purple
if [ -f $PACKAGE_DIR/test.R ]; then
R --verbose -f $PACKAGE_DIR/test.R
else
R -e "install.packages('$PACKAGE', repos='http://cran.rstudio.com/'); library('$PACKAGE')"
fi
return_code=$?
if [[ $return_code != 0 ]] ; then
echo "$PACKAGE... FAILED" | red
exit $return_code
else
echo "$PACKAGE... SUCCESS" | green
fi
else
echo "Unable to find '$PACKAGE' in $DIR/packages, exiting..." | red
exit 1
fi
done
exit 0