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
|
|
|
# $1 = test_name
|
|
|
|
# $2 = filename pattern for tested source files
|
2015-02-12 04:17:20 +01:00
|
|
|
function run_test {
|
2019-09-14 19:31:31 +02:00
|
|
|
|
2015-03-12 06:20:12 +01:00
|
|
|
set -e
|
2019-09-14 19:31:31 +02:00
|
|
|
if [[ ! -f test-coverage/coverage_$1_full ]]; then
|
|
|
|
cd test
|
|
|
|
B2_ARGS='sanitize=off asserts=off invariant-checks=off link=static deprecated-functions=off debug-iterators=off test-coverage=on picker-debugging=off -j4'
|
|
|
|
bjam $B2_ARGS $1 testing.execute=off
|
|
|
|
EXE_PATH=$(ls -d bin/$1.test/*/debug/debug-iterators-off/deprecated-functions-off/export-extra-on/link-static/test-coverage-on/threading-multi)
|
2015-02-12 04:17:20 +01:00
|
|
|
|
2019-09-14 19:31:31 +02:00
|
|
|
# force running the test
|
|
|
|
rm -f $EXE_PATH/$1.output
|
|
|
|
rm -f $EXE_PATH/$1.run
|
|
|
|
rm -f $EXE_PATH/$1.test
|
|
|
|
cd ..
|
|
|
|
# expand the pattern to find the path to the object files
|
|
|
|
OBJECT_PATH=$(ls -d bin/*/debug/debug-iterators-off/deprecated-functions-off/export-extra-on/link-static/test-coverage-on/threading-multi)
|
|
|
|
# clear counters from last run
|
|
|
|
rm -f $OBJECT_PATH/src/*.gcda
|
|
|
|
rm -f $OBJECT_PATH/e25519/src/*.gcda
|
|
|
|
rm -f test/$EXE_PATH/*.gcda
|
|
|
|
cd test
|
|
|
|
# now run the test
|
|
|
|
bjam $B2_ARGS $1 -l250
|
|
|
|
cd ..
|
2015-03-12 06:20:12 +01:00
|
|
|
|
2019-09-14 19:31:31 +02:00
|
|
|
lcov --base-directory test -d test/$EXE_PATH -d $OBJECT_PATH/src -d $OBJECT_PATH/ed25519/src -c -o test-coverage/coverage_$1_full --exclude "/usr/*" --exclude "/Applications/Xcode.app/*" --exclude "*/boost/*"
|
|
|
|
fi
|
|
|
|
lcov --extract test-coverage/coverage_$1_full "$2" -o test-coverage/coverage_$1
|
2015-02-12 04:17:20 +01:00
|
|
|
|
2015-04-11 18:56:17 +02:00
|
|
|
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
|
2015-02-12 04:17:20 +01:00
|
|
|
|
2019-09-14 19:31:31 +02:00
|
|
|
if [[ $# > 2 ]]; then
|
|
|
|
lcov --extract test-coverage/coverage_$1_full "$3" -o test-coverage/coverage_$1
|
|
|
|
lcov --add-tracefile test-coverage/coverage_$1 --add-tracefile test-coverage/coverage_all -o test-coverage/coverage_all
|
|
|
|
fi
|
|
|
|
if [[ $# > 3 ]]; then
|
|
|
|
lcov --extract test-coverage/coverage_$1_full "$4" -o test-coverage/coverage_$1
|
|
|
|
lcov --add-tracefile test-coverage/coverage_$1 --add-tracefile test-coverage/coverage_all -o test-coverage/coverage_all
|
|
|
|
fi
|
|
|
|
set +e
|
|
|
|
}
|
2015-02-12 04:17:20 +01:00
|
|
|
|
2019-09-14 19:31:31 +02:00
|
|
|
mkdir -p test-coverage
|
|
|
|
rm -f test-coverage/coverage_all
|
2015-02-13 05:35:54 +01:00
|
|
|
|
2019-09-14 19:31:31 +02:00
|
|
|
run_test test_create_torrent "*/create_torrent.*"
|
|
|
|
run_test test_bandwidth_limiter "*/bandwidth_*.*"
|
|
|
|
run_test test_alloca "*/alloca.hpp"
|
|
|
|
run_test test_generate_peer_id "*/generate_peer_id.*"
|
|
|
|
run_test test_file_progress "*/file_progress.*"
|
|
|
|
run_test test_stack_allocator "*/stack_allocator.*"
|
|
|
|
run_test test_linked_list "*/linked_list.*"
|
|
|
|
run_test test_enum_net "*/broadcast_socket.*"
|
|
|
|
run_test test_stat_cache "*/stat_cache.*"
|
|
|
|
run_test test_dos_blocker "*/dos_blocker.*"
|
|
|
|
run_test test_fence "*/disk_job_fence.*"
|
|
|
|
run_test test_settings_pack "*/settings_pack.*"
|
|
|
|
run_test test_timestamp_history "*/timestamp_history.*"
|
|
|
|
run_test test_merkle "*/merkle.*"
|
|
|
|
run_test test_resolve_links "*/resolve_links.*"
|
|
|
|
run_test test_heterogeneous_queue "*/heterogeneous_queue.*"
|
|
|
|
run_test test_socket_io "*/socket_io.*"
|
|
|
|
run_test test_peer_priority "*/torrent_peer.*"
|
|
|
|
run_test test_tailqueue "*/tailqueue.*"
|
|
|
|
run_test test_bencoding "*/entry.*" "*/bencode.*" "*/bdecode.*"
|
|
|
|
run_test test_bdecode "*/bdecode.*"
|
|
|
|
run_test test_io "*/io.hpp"
|
|
|
|
run_test test_block_cache "*/block_cache.*"
|
|
|
|
run_test test_peer_classes "*/peer_class*.*"
|
|
|
|
run_test test_bloom_filter "*/bloom_filter.*"
|
2015-05-23 03:38:47 +02:00
|
|
|
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-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.*"
|
2019-09-14 19:31:31 +02:00
|
|
|
run_test test_string "*/escape_string.*" "*/string_util.*"
|
2015-02-12 04:17:20 +01:00
|
|
|
run_test test_utf8 "*/ConvertUTF.*"
|
2019-09-14 19:31:31 +02:00
|
|
|
run_test test_hasher "*/hasher.*"
|
|
|
|
run_test test_hasher512 "*/hasher512.*"
|
|
|
|
run_test test_span "*/span.hpp"
|
|
|
|
run_test test_crc32 "*/crc32c.*"
|
|
|
|
run_test test_ffs "*/ffs.cpp"
|
|
|
|
run_test test_ed25519 "*/ed25519/src/*"
|
|
|
|
run_test test_receive_buffer "*/receive_buffer.*"
|
|
|
|
run_test test_magnet "*/magnet_uri.*"
|
|
|
|
run_test test_session "*/session_impl.*" "*/session.*"
|
|
|
|
run_test test_remove_torrent "*/session_impl.*"
|
|
|
|
run_test test_read_piece "*/torrent.*"
|
|
|
|
run_test test_session_params "*/session.*"
|
|
|
|
run_test test_buffer "*/buffer.*"
|
|
|
|
run_test test_file "*/file.*"
|
|
|
|
run_test test_read_resume "*/read_resume_data.*" "*/write_resume_data.*"
|
|
|
|
run_test test_resume "*/torrent.*"
|
|
|
|
run_test test_checking "*/torrent.*"
|
|
|
|
run_test test_pe_crypto "*/pe_crypto.*"
|
|
|
|
run_test test_remap_files "*/file_storage.*" "*/torrent.*"
|
|
|
|
run_test test_time_critical "*/torrent.*" "*/peer_connection.*" "*/bt_peer_connection.*"
|
|
|
|
run_test test_pex "*/ut_pex.*"
|
|
|
|
run_test test_checking "*/torrent.*" "*/disk_io_thread.*"
|
|
|
|
run_test test_url_seed "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_redirect "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_socks4 "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_socks5 "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_socks5_pw "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_http "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_http_pw "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_chunked "*/web_peer_connection.*"
|
|
|
|
run_test test_web_seed_ban "*/web_peer_connection.*"
|
|
|
|
run_test test_torrent "*/torrent.*"
|
|
|
|
run_test test_auto_unchoke "*/session_impl.*"
|
2015-02-12 04:17:20 +01:00
|
|
|
|
2019-09-14 19:31:31 +02:00
|
|
|
genhtml -o test-coverage/ -t libtorrent-unit-tests --num-spaces=4 test-coverage/coverage_all
|
2015-04-11 18:56:17 +02:00
|
|
|
|