forked from DougPuchalski/lunkwill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lw
executable file
·112 lines (91 loc) · 5.17 KB
/
lw
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
set -e
SOURCE_DIR="$(dirname $(realpath $0))"
TARGET_DIR="${SOURCE_DIR}/.build"
RM=false
if [[ $1 == "new" ]]
then
RM=true
shift
fi
if ${RM}
then
rm -rf ${TARGET_DIR}
fi
mkdir -p ${TARGET_DIR}
cd ${TARGET_DIR}
${SOURCE_DIR}/configure
case $1 in
"dbg")
shift
make -j9;
bash -c "gdb ./lunkwill -ex 'set follow-fork-mode child' $@"
;;
"mem")
shift
make -j9;
bash -c "valgrind --num-callers=50 --leak-resolution=high --leak-check=full --track-origins=yes --show-reachable=yes --show-possibly-lost=yes --trace-children=yes --time-stamp=yes ./lunkwill $@"
;;
"run")
shift
make -j9;
clear;
bash -c "./lunkwill $@"
;;
"doc")
cd ${SOURCE_DIR}
mkdir -p docs
(cat scripts/doxyfile; \
echo "EXCLUDE = 04-plugins" )| doxygen -
for i in $(ls ./04-plugins/);
do
cat scripts/doxyfile | sed -e \
"s#OUTPUT_DIRECTORY = docs/lunkwill#OUTPUT_DIRECTORY = docs/$i#" \
| sed -e \
"s#INPUT = .#INPUT = ./04-plugins/$i#" \
| doxygen -
done
rm -f ./docs/index.html
for i in $(ls ./docs/);
do
echo "<a href='./$i/html/index.html'>$i</a><br>">>./docs/index.html
done
;;
"check")
make clean
CC=clang scan-build -enable-checker alpha.core.BoolAssignment -enable-checker alpha.core.CastSize -enable-checker alpha.core.CastToStruct -enable-checker alpha.core.FixedAddr -enable-checker alpha.core.PointerArithm -enable-checker alpha.core.PointerSub -enable-checker alpha.core.SizeofPtr -enable-checker alpha.cplusplus.NewDeleteLeaks -enable-checker alpha.cplusplus.VirtualCall -enable-checker alpha.osx.cocoa.Dealloc -enable-checker alpha.osx.cocoa.DirectIvarAssignment -enable-checker alpha.osx.cocoa.DirectIvarAssignmentForAnnotatedFunctions -enable-checker alpha.osx.cocoa.InstanceVariableInvalidation -enable-checker alpha.osx.cocoa.MissingInvalidationMethod -enable-checker alpha.osx.cocoa.MissingSuperCall -enable-checker alpha.security.ArrayBound -enable-checker alpha.security.ArrayBoundV2 -enable-checker alpha.security.MallocOverflow -enable-checker alpha.security.ReturnPtrRange -enable-checker alpha.security.taint.TaintPropagation -enable-checker alpha.unix.Chroot -enable-checker alpha.unix.MallocWithAnnotations -enable-checker alpha.unix.PthreadLock -enable-checker alpha.unix.SimpleStream -enable-checker alpha.unix.Stream -enable-checker alpha.unix.cstring.BufferOverlap -enable-checker alpha.unix.cstring.NotNullTerminated -enable-checker alpha.unix.cstring.OutOfBounds -enable-checker core.CallAndMessage -enable-checker core.DivideZero -enable-checker core.DynamicTypePropagation -enable-checker core.NonNullParamChecker -enable-checker core.NullDereference -enable-checker core.StackAddressEscape -enable-checker core.UndefinedBinaryOperatorResult -enable-checker core.VLASize -enable-checker core.builtin.BuiltinFunctions -enable-checker core.builtin.NoReturnFunctions -enable-checker core.uninitialized.ArraySubscript -enable-checker core.uninitialized.Assign -enable-checker core.uninitialized.Branch -enable-checker core.uninitialized.CapturedBlockVariable -enable-checker core.uninitialized.UndefReturn -enable-checker cplusplus.NewDelete -enable-checker deadcode.DeadStores -enable-checker llvm.Conventions -enable-checker osx.API -enable-checker osx.SecKeychainAPI -enable-checker osx.cocoa.AtSync -enable-checker osx.cocoa.ClassRelease -enable-checker osx.cocoa.IncompatibleMethodTypes -enable-checker osx.cocoa.Loops -enable-checker osx.cocoa.NSAutoreleasePool -enable-checker osx.cocoa.NSError -enable-checker osx.cocoa.NilArg -enable-checker osx.cocoa.NonNilReturnValue -enable-checker osx.cocoa.RetainCount -enable-checker osx.cocoa.SelfInit -enable-checker osx.cocoa.UnusedIvars -enable-checker osx.cocoa.VariadicMethodTypes -enable-checker osx.coreFoundation.CFError -enable-checker osx.coreFoundation.CFNumber -enable-checker osx.coreFoundation.CFRetainRelease -enable-checker osx.coreFoundation.containers.OutOfBounds -enable-checker osx.coreFoundation.containers.PointerSizedValues -enable-checker security.FloatLoopCounter -enable-checker security.insecureAPI.UncheckedReturn -enable-checker security.insecureAPI.getpw -enable-checker security.insecureAPI.gets -enable-checker security.insecureAPI.mkstemp -enable-checker security.insecureAPI.mktemp -enable-checker security.insecureAPI.rand -enable-checker security.insecureAPI.strcpy -enable-checker security.insecureAPI.vfork -enable-checker unix.API -enable-checker unix.Malloc -enable-checker unix.MallocSizeof -enable-checker unix.MismatchedDeallocator -enable-checker unix.cstring.BadSizeArg -enable-checker unix.cstring.NullArg make -j9
bash
;;
"clang")
CC=clang scan-build make -j9
;;
"gcc")
YUI="~/.bin/yui.jar" make -j9;
bash
;;
"travis")
make -j99
./lunkwill -f
sleep 2
../scripts/lunkwill_tests.sh travis
;;
"astyle")
cd ${SOURCE_DIR}
astyle -nUt --style=ansi --recursive *.c *.h
;;
"test")
shift
make -j9;
clear;
bash -c "./lunkwill -f $@"
../scripts/lunkwill_tests.sh
killall -s9 lunkwill
;;
*)
echo $@
bash
esac
if ${RM}
then
rm -rf ${TARGET_DIR}
fi