forked from bennbollay/tmstat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-core.sh
executable file
·47 lines (41 loc) · 906 Bytes
/
test-core.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
#
# Unit test scripts for tmstat_eval functionality.
#
# $Id$
#
name=$0
obj_dir=$1
tmctl="$obj_dir/tmctl --base=$obj_dir/core_data -d private"
tmstat_test="$obj_dir/tmstat_test --base=$obj_dir/core_data -d private"
# Exit upon any failure
set -e
# Setup directory structure
rm -f core.*
rm -fr $obj_dir/core_data
mkdir -p $obj_dir/core_data
# Generate a sample core file
ulimit -c unlimited
echo 0x0f > /proc/self/coredump_filter
set +e
$obj_dir/tmstat_test --base=$obj_dir/core_data --test=core
set -e
# Verify that
for f in core.*
do
$obj_dir/tmctl -f $f 2>&1
$obj_dir/tmctl -f $f -x $obj_dir/core_data 2>&1
done
SEGMENTS=$obj_dir/core_data/segment*
if ["$SEGMENTS" -eq "$obj_dir/core_data/segment*"]
then
echo "No segments written"
exit 1
else
for f in $SEGMENTS
do
$obj_dir/tmctl -f $f 2>&1
done
fi
# Cleanup test files
rm -f core.*
rm -fr $obj_dir/core_data