2015-02-12 04:17:20 +01:00
|
|
|
#!/bin/bash
|
2015-02-10 07:02:51 +01:00
|
|
|
|
2015-05-17 23:00:47 +02:00
|
|
|
OBJECT_PATH=bin/gcc-4.8/debug/asserts-off/boost-source/deprecated-functions-off/export-extra-on/invariant-checks-off/link-static/test-coverage-on/threading-multi/src
|
2015-02-12 04:17:20 +01:00
|
|
|
|
2015-05-17 23:00:47 +02:00
|
|
|
# $1 = test_name
|
|
|
|
# $2 = filename pattern for tested source files
|
|
|
|
# $3 = optional bjam arguments
|
2015-02-12 04:17:20 +01:00
|
|
|
function run_test {
|
2015-03-12 06:20:12 +01:00
|
|
|
set +e
|
2015-02-12 04:17:20 +01:00
|
|
|
rm $OBJECT_PATH/*.gcda
|
2015-03-12 06:20:12 +01:00
|
|
|
set -e
|
2015-02-12 04:17:20 +01:00
|
|
|
|
|
|
|
cd test
|
2015-03-12 06:20:12 +01:00
|
|
|
|
2015-04-11 18:56:17 +02:00
|
|
|
set +e
|
2015-08-09 01:18:05 +02:00
|
|
|
bjam asserts=off invariant-checks=off link=static deprecated-functions=off debug-iterators=off test-coverage=on picker-debugging=off -j4 $1
|
2015-03-21 01:50:28 +01:00
|
|
|
set -e
|
2015-04-11 18:56:17 +02:00
|
|
|
cd ..
|
2015-02-12 04:17:20 +01:00
|
|
|
|
|
|
|
lcov -d $OBJECT_PATH/ -c -o coverage_$1_full
|
2015-04-11 18:56:17 +02:00
|
|
|
lcov --extract coverage_$1_full "$2" -o test-coverage/coverage_$1
|
|
|
|
if [ ! -f test-coverage/coverage_all ]; then
|
|
|
|
cp test-coverage/coverage_$1 test-coverage/coverage_all
|
|
|
|
else
|
|
|
|
lcov --add-tracefile test-coverage/coverage_$1 --add-tracefile test-coverage/coverage_all -o test-coverage/coverage_all
|
|
|
|
fi
|
|
|
|
rm coverage_$1_full
|
2015-02-12 04:17:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# force rebuilding and rerunning the unit tests
|
2015-02-10 07:02:51 +01:00
|
|
|
cd test
|
2015-03-12 06:20:12 +01:00
|
|
|
set +e
|
2015-02-12 04:17:20 +01:00
|
|
|
rm -rf bin
|
2015-03-12 06:20:12 +01:00
|
|
|
set -e
|
2015-02-10 07:02:51 +01:00
|
|
|
cd ..
|
2015-02-12 04:17:20 +01:00
|
|
|
|
2015-03-12 06:20:12 +01:00
|
|
|
set +e
|
2015-02-13 05:35:54 +01:00
|
|
|
mkdir test-coverage
|
2015-04-11 18:56:17 +02:00
|
|
|
rm test-coverage/coverage_all
|
2015-03-12 06:20:12 +01:00
|
|
|
set -e
|
2015-02-13 05:35:54 +01:00
|
|
|
|
2015-05-23 03:38:47 +02:00
|
|
|
run_test test_bloom_filter "*/bloom_filter.*" -a
|
|
|
|
run_test test_sha1_hash "*/sha1_hash.*"
|
|
|
|
run_test test_identify_client "*/identify_client.*"
|
|
|
|
run_test test_packet_buffer "*/packet_buffer.*"
|
2015-05-17 23:00:47 +02:00
|
|
|
run_test test_ip_voter "*/ip_voter.*"
|
|
|
|
run_test test_bitfield "*/bitfield.*"
|
|
|
|
run_test test_alert_manager "*/alert_manager.*"
|
2017-02-18 06:13:46 +01:00
|
|
|
run_test test_alert_types "*/alert_types.*"
|
2015-03-21 01:50:28 +01:00
|
|
|
run_test test_dht "*/kademlia/*"
|
2015-03-12 06:20:12 +01:00
|
|
|
run_test test_bdecode "*/bdecode.*"
|
2015-02-12 04:17:20 +01:00
|
|
|
run_test test_piece_picker "*/piece_picker.*"
|
|
|
|
run_test test_torrent_info "*/torrent_info.*"
|
|
|
|
run_test test_part_file "*/part_file.*"
|
|
|
|
run_test test_http_parser "*/http_parser.*"
|
|
|
|
run_test test_ip_filter "*/ip_filter.*"
|
|
|
|
run_test test_utp "*/utp_stream.*"
|
|
|
|
run_test test_peer_list "*/peer_list.*"
|
|
|
|
run_test test_gzip "*/gzip.cpp"
|
|
|
|
run_test test_file_storage "*/file_storage.*"
|
|
|
|
run_test test_storage "*/storage.*"
|
|
|
|
run_test test_xml "*/xml_parse.*"
|
|
|
|
run_test test_sliding_average "*/sliding_average.*"
|
|
|
|
run_test test_string "*/escape_string.*"
|
|
|
|
run_test test_utf8 "*/ConvertUTF.*"
|
|
|
|
|
2015-04-11 18:56:17 +02:00
|
|
|
genhtml -o test-coverage/ -t $1 --num-spaces=4 test-coverage/coverage_all
|
|
|
|
|