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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
From 74d806c91ff7894d5c1cd8d736b87e02047c6799 Mon Sep 17 00:00:00 2001
From: Anders Roxell <anders.roxell@linaro.org>
Date: Tue, 8 Oct 2013 16:02:56 +0200
Subject: [PATCH 1/3] scripts: TRINITY_PATH defaults to "."
TRINITY_PATH may be changed in the enviroment
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
scripts/analyse-dumps.sh | 4 +++-
scripts/clean-cores.sh | 4 +++-
scripts/find.sh | 8 +++++---
scripts/test-all-syscalls-parallel.sh | 6 ++++--
scripts/test-all-syscalls-sequentially.sh | 8 +++++---
scripts/test-multi.sh | 6 ++++--
scripts/test-vm.sh | 4 +++-
7 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/scripts/analyse-dumps.sh b/scripts/analyse-dumps.sh
index d55393c..bd45ea5 100755
--- a/scripts/analyse-dumps.sh
+++ b/scripts/analyse-dumps.sh
@@ -1,8 +1,10 @@
#!/bin/sh
+TRINITY_PATH=${TRINITY_PATH:-.}
+
for core in $(find . -name "core.*")
do
- gdb -batch -n -ex 'bt' ./trinity $core > core.txt
+ gdb -batch -n -ex 'bt' $TRINITY_PATH/trinity $core > core.txt
SHA=$(cat core.txt| grep -v New\ LWP | sha1sum)
cat core.txt > core-$SHA.txt
rm -f core.txt
diff --git a/scripts/clean-cores.sh b/scripts/clean-cores.sh
index 821e06a..0b90be6 100755
--- a/scripts/clean-cores.sh
+++ b/scripts/clean-cores.sh
@@ -1,8 +1,10 @@
#!/bin/sh
+TRINITY_PATH=${TRINITY_PATH:-.}
+
# remove old cores
for i in `find . -name "core.*" -exec ls -l {} \; | grep -v "$(date +%b\ %e)" | awk '{ print $9 }'`; do rm -f $i; done
# Remove corrupted cores
find . -empty -name "core.*" -exec rm -f {} \;
-for i in $(file core.* | grep -v trinity | awk '{ print $1 }' | sed 's/://'); do rm -f $i; done
+for i in $(file core.* | grep -v $TRINITY_PATH/trinity | awk '{ print $1 }' | sed 's/://'); do rm -f $i; done
diff --git a/scripts/find.sh b/scripts/find.sh
index 537160f..5528210 100755
--- a/scripts/find.sh
+++ b/scripts/find.sh
@@ -5,6 +5,8 @@
# sendmsg that only occurred after connect was called.
#
+TRINITY_PATH=${TRINITY_PATH:-.}
+
check_tainted()
{
if [ "$(cat /proc/sys/kernel/tainted)" != $TAINT ]; then
@@ -27,18 +29,18 @@ while [ 1 ];
do
-for sc in $(../trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
+for sc in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
do
mkdir -p tmp.$i
pushd tmp.$i
- if [ ! -f ../../trinity ]; then
+ if [ ! -f $TRINITY_PATH/trinity ]; then
echo lost!
pwd
exit
fi
- ../../trinity -q -l off -n -c sendmsg -c $sc -C32 -N 999999
+ $TRINITY_PATH/trinity -q -l off -n -c sendmsg -c $sc -C32 -N 999999
popd
diff --git a/scripts/test-all-syscalls-parallel.sh b/scripts/test-all-syscalls-parallel.sh
index 861c156..c713cce 100755
--- a/scripts/test-all-syscalls-parallel.sh
+++ b/scripts/test-all-syscalls-parallel.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+TRINITY_PATH=${TRINITY_PATH:-.}
+
if [ ! -d tmp ]; then
mkdir tmp
fi
@@ -8,9 +10,9 @@ cd tmp
while [ 1 ];
do
- for syscall in $(../trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
+ for syscall in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
do
- MALLOC_CHECK_=2 ../trinity -q -c $syscall -D &
+ MALLOC_CHECK_=2 $TRINITY_PATH/trinity -q -c $syscall -D &
done
wait
done
diff --git a/scripts/test-all-syscalls-sequentially.sh b/scripts/test-all-syscalls-sequentially.sh
index 85bcf71..6d79db4 100755
--- a/scripts/test-all-syscalls-sequentially.sh
+++ b/scripts/test-all-syscalls-sequentially.sh
@@ -3,6 +3,8 @@
# This is a useful test to run occasionally, to see which syscalls are
# causing trinity to segfault.
+TRINITY_PATH=${TRINITY_PATH:-.}
+
check_tainted()
{
if [ "$(cat /proc/sys/kernel/tainted)" != $TAINT ]; then
@@ -19,18 +21,18 @@ TAINT=$(cat /proc/sys/kernel/tainted)
while [ 1 ]
do
-for syscall in $(./trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
+for syscall in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
do
chmod 755 tmp
pushd tmp
- if [ ! -f ../trinity ]; then
+ if [ ! -f $TRINITY_PATH/trinity ]; then
echo lost!
pwd
exit
fi
- MALLOC_CHECK_=2 ../trinity -q -c $syscall -N 99999 -l off -C 64
+ MALLOC_CHECK_=2 $TRINITY_PATH/trinity -q -c $syscall -N 99999 -l off -C 64
popd
check_tainted
diff --git a/scripts/test-multi.sh b/scripts/test-multi.sh
index cad297c..33db834 100755
--- a/scripts/test-multi.sh
+++ b/scripts/test-multi.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+TRINITY_PATH=${TRINITY_PATH:-.}
+
check_tainted()
{
if [ "$(cat /proc/sys/kernel/tainted)" != $TAINT ]; then
@@ -21,7 +23,7 @@ NR_PROCESSES=$(($NR_CPUS * 2))
while [ 1 ];
do
- cp ../trinity .
+ cp $TRINITY_PATH/trinity .
for i in `seq 1 $NR_PROCESSES`
do
@@ -33,7 +35,7 @@ do
mkdir -p tmp.$i
pushd tmp.$i
- if [ ! -f ../../trinity ]; then
+ if [ ! -f $TRINITY_PATH/trinity ]; then
echo lost!
pwd
exit
diff --git a/scripts/test-vm.sh b/scripts/test-vm.sh
index 4c472ca..6b75e8d 100755
--- a/scripts/test-vm.sh
+++ b/scripts/test-vm.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+TRINITY_PATH=${TRINITY_PATH:-.}
+
if [ ! -d tmp ]; then
mkdir tmp
fi
@@ -16,7 +18,7 @@ do
cd tmp.$RND
for i in `seq 1 $NR_PROCESSES`
do
- ../../trinity -q -g vm &
+ $TRINITY_PATH/trinity -q -g vm &
done
wait
cd ..
--
1.8.1.2
|