-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.sh
executable file
·49 lines (44 loc) · 900 Bytes
/
dev.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
#!/bin/bash
test_module() {
if [ $# -eq "0" ]; then
echo "module name must be exist.";
exit
fi
test_name='test_'$1'.cpp'
path=`find . -name $test_name`
if [ -z $path ]; then
echo 'test_'$1'.cpp is not found.'
exit
fi
echo 'found test_'$1'.cpp at '$path
if [ ! -d 'bin' ]; then
mkdir bin
fi
# echo "Compiling..."
set -x
rm 'bin/test_'$1'.out'
make
if [ ! $? -eq 0 ]; then
exit
fi
g++ $path obj/*.o -I. -Iinclude -DDEBUG -g -o 'bin/test_'$1'.out'
set +x
echo -e "Run test case.\n=======\n"
'bin/test_'$1'.out'
}
help() {
echo "Useage: dev.sh <subcommand>"
echo ""
echo "Available subcommands:"
echo " test <module name>"
}
if [ $# -eq "0" ]; then
help
exit
fi
if [ $1 = "test" ]; then
test_module $2
fi
if [ $1 = "make" ]; then
make_make
fi