-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·83 lines (71 loc) · 1.46 KB
/
build.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
#!/bin/bash
#Parámetros:
#-t Compila tests
#-r Incluye rocksdb
#-c Evalúa coverage (implica -t)
#-x Ejecuta el servidor (implica -r)
export INCLUDE=include
export LIB=/usr/lib
ARGS=$(getopt -o hrtcx -l "help,rocksdb,test,coverage,execute" -- "$@")
eval set -- "$ARGS"
rocksdb=OFF
test=OFF
coverage=OFF
execute=OFF
while true; do
case "$1" in
-h|--help)
echo "
-h, --help Muestra esta ayuda y finaliza
-r, --rocksdb Compila udrive con RocksDB
-t, --test Compila y ejecuta tests unitarios (de C++)
-x, --execute Compila y ejecuta udrive [implica --rocksdb]
-c, --coverage Compila tests y udrive sin RocksDB y ejecuta tests
(C++ y Python), generando reporte de coverage
[anula --rocksdb e implica --test]
";
exit 0;
;;
-r|--rocksdb)
rocksdb=ON;
;;
-t|--test)
test=ON;
;;
-c|--coverage)
coverage=ON;
test=ON;
;;
-x|--execute)
rocksdb=ON
execute=ON;
;;
--)
break;
;;
esac
shift # avanza en la lista de parametros
done
if [[ -d build ]]; then
rm -r build
fi
mkdir build
cp "default.jpg" "build"
cp "server.conf" "build"
cd build
mkdir files
cmake -Dtest=$test -Drocksdb=$rocksdb -Dcoverage=$coverage ../
if [[ $coverage == 'ON' ]]; then
make coverage
else if [[ $test == 'ON' ]]; then # coverage de por si incluye y corre test
make unitTest
./unitTest
fi
fi
if [[ $rocksdb == 'ON' ]]; then
make udrive
if [[ $execute == 'ON' ]]; then
./udrive server.conf
fi
fi
cd .. # sale de /build