-
Notifications
You must be signed in to change notification settings - Fork 0
/
autotest.sh
executable file
·89 lines (69 loc) · 1.89 KB
/
autotest.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
rootdir=$(readlink -f $(dirname $0))
source "$rootdir/scripts/autotest_common.sh"
set -xe
if [ $EUID -ne 0 ]; then
echo "$0 must be run as root"
exit 1
fi
trap "process_core; $rootdir/scripts/setup.sh reset; exit 1" SIGINT SIGTERM EXIT
timing_enter autotest
src=$(readlink -f $(dirname $0))
out=$PWD
cd $src
if hash lcov; then
export LCOV_OPTS="
--rc lcov_branch_coverage=1
--rc lcov_function_coverage=1
--rc genhtml_branch_coverage=1
--rc genhtml_function_coverage=1
--rc genhtml_legend=1
--rc geninfo_all_blocks=1
"
export LCOV="lcov $LCOV_OPTS"
export GENHTML="genhtml $LCOV_OPTS"
# zero out coverage data
$LCOV -q -c -i -t "Baseline" -d $src -o cov_base.info
fi
# set up huge pages
timing_enter afterboot
./scripts/setup.sh
timing_exit afterboot
#####################
# Unit Tests
#####################
timing_enter lib
time test/lib/event/event.sh
time test/lib/nvme/nvme.sh
time test/lib/nvmf/nvmf.sh
time test/lib/memory/memory.sh
time test/lib/ioat/ioat.sh
time test/lib/json/json.sh
time test/lib/jsonrpc/jsonrpc.sh
time test/lib/log/log.sh
timing_exit lib
timing_enter nvmf
time test/nvmf/fio/fio.sh
time test/nvmf/filesystem/filesystem.sh
timing_exit nvmf
timing_enter cleanup
./scripts/setup.sh reset
./scripts/build_kmod.sh clean
timing_exit cleanup
timing_exit autotest
chmod a+r $output_dir/timing.txt
trap - SIGINT SIGTERM EXIT
# catch any stray core files
process_core
if hash lcov; then
# generate coverage data and combine with baseline
$LCOV -q -c -d $src -t "$(hostname)" -o cov_test.info
$LCOV -q -a cov_base.info -a cov_test.info -o cov_total.info
$LCOV -q -r cov_total.info '/usr/*' -o cov_total.info
$LCOV -q -r cov_total.info 'test/*' -o cov_total.info
$GENHTML cov_total.info -t "$(hostname)" -o $out/coverage
chmod -R a+rX $out/coverage
rm cov_base.info cov_test.info
mv cov_total.info $out/cov_total.info
find . -name "*.gcda" -delete
fi