-
Notifications
You must be signed in to change notification settings - Fork 9
/
run-container.sh
executable file
·65 lines (58 loc) · 1.77 KB
/
run-container.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
#!/bin/bash
TARGET=debug
BUILDDIR=cmake-build-${TARGET}
if [[ -z $1 ]]; then
echo "Usage: $0 configure|build|lint|format|test|coverage|sanitize|debug|git-update|shell"
echo "Otherwise refer to the Makefile"
else
if [[ "$1" == "configure" ]]; then
if [ -d ${BUILDDIR} ]; then
rm -rf ${BUILDDIR}
fi
mkdir ${BUILDDIR}
cd ${BUILDDIR}
if echo ${TARGET} | grep -i "release" >/dev/null; then
CMAKEARGS="${CMAKEARGS} -DCMAKE_BUILD_TYPE=Release"
fi
cmake ${CMAKEARGS} ..
echo "configured cmake for '${TARGET}'"
elif [[ "$1" == "build" ]]; then
if [[ -z ${THREADCOUNT} ]]; then
THREADCOUNT=8
fi
cd ${BUILDDIR}
make -j${THREADCOUNT}
elif [[ "$1" == "lint" ]]; then
./scripts/lint.sh
elif [[ "$1" == "format" ]]; then
./scripts/format.sh
elif [[ "$1" == "test" ]]; then
cd ${BUILDDIR}
make hyriseTest
cd ..
./${BUILDDIR}/hyriseTest
elif [[ "$1" == "coverage" ]]; then
./scripts/coverage.sh ${BUILDDIR}
elif [[ "$1" == "sanitize" ]]; then
cd ${BUILDDIR}
make hyriseAsan
elif [[ "$1" == "debug" ]]; then
if [[ -z $2 ]]; then
echo tell me the filename inside ${BUILDDIR}/
else
echo "firing up gdbserver"
GDBPORT=7777
gdbserver 127.0.0.1:${GDBPORT} ${BUILDDIR}/$2 &
echo "started gdbserver, listening on ${GDBPORT}"
wait $!
echo "gdbserver terminated"
fi
elif [[ "$1" == "git-update" ]]; then
git submodule update --jobs 5 --init --recursive
elif [[ "$1" == "shell" ]]; then
/bin/bash
else
echo "unknown command"
fi
fi
exit 0