forked from premiere/premiere-libtorrent
fix msvc test build. make test framework robust to tmpfile() failing. add missing files and tests to makefile
This commit is contained in:
parent
5ebb7d203b
commit
2921caf95e
2
Jamfile
2
Jamfile
|
@ -284,6 +284,8 @@ rule warnings ( properties * )
|
|||
result += <cflags>/wd4018 ;
|
||||
# disable warning C4244: 'argument' : conversion from 'int' to 'unsigned short', possible loss of data
|
||||
result += <cflags>/wd4244 ;
|
||||
# disable warning C4512: assignment operator could not be generated
|
||||
result += <cflags>/wd4512 ;
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
|
|
|
@ -23,8 +23,8 @@ chmod a-x docs/*.rst docs/*.htm* src/*.cpp include/libtorrent/*.hpp
|
|||
|
||||
./autotool.sh
|
||||
./configure --enable-python-binding --enable-examples=yes --enable-encryption --enable-tests=yes --with-boost-system=mt --with-boost-chrono=mt --with-boost-random=mt --with-boost-python=mt
|
||||
make V=1 -j8 check distcheck
|
||||
|
||||
./configure --enable-python-binding --enable-examples=yes --enable-encryption --with-boost-system=mt --with-boost-chrono=mt --with-boost-random=mt --with-boost-python=mt
|
||||
make V=1 -j8 distcheck
|
||||
|
||||
./configure --enable-python-binding --enable-examples=yes --enable-encryption --with-boost-system=mt --with-boost-chrono=mt --with-boost-random=mt --with-boost-python=mt
|
||||
make V=1 -j8 dist
|
||||
|
||||
|
|
|
@ -30,12 +30,21 @@ test_programs = \
|
|||
test_utp \
|
||||
test_session \
|
||||
test_web_seed \
|
||||
test_web_seed_ban \
|
||||
test_web_seed_chunked \
|
||||
test_web_seed_http \
|
||||
test_web_seed_http_pw \
|
||||
test_web_seed_redirect \
|
||||
test_web_seed_socks4 \
|
||||
test_web_seed_socks5 \
|
||||
test_web_seed_socks5_no_peers \
|
||||
test_web_seed_socks5_pw \
|
||||
test_url_seed \
|
||||
test_remap_files \
|
||||
test_enum_net \
|
||||
test_file_progress \
|
||||
test_linked_list
|
||||
test_linked_list \
|
||||
test_direct_dht
|
||||
|
||||
if ENABLE_TESTS
|
||||
check_PROGRAMS = $(test_programs) $(benchmark_programs)
|
||||
|
@ -101,13 +110,17 @@ EXTRA_DIST = Jamfile \
|
|||
mutable_test_torrents/test3.torrent \
|
||||
mutable_test_torrents/test3_pad_files.torrent \
|
||||
zeroes.gz \
|
||||
utf8_test.txt
|
||||
utf8_test.txt \
|
||||
web_server.py \
|
||||
socks.py \
|
||||
http.py
|
||||
|
||||
EXTRA_PROGRAMS = $(test_programs) $(benchmark_programs)
|
||||
|
||||
noinst_HEADERS = test.hpp setup_transfer.hpp dht_server.hpp \
|
||||
peer_server.hpp udp_tracker.hpp web_seed_suite.hpp swarm_suite.hpp \
|
||||
test_utils.hpp settings.hpp make_torrent.hpp
|
||||
test_utils.hpp settings.hpp make_torrent.hpp bittorrent_peer.hpp \
|
||||
print_alerts.hpp
|
||||
|
||||
libtest_la_SOURCES = main.cpp \
|
||||
test.cpp \
|
||||
|
@ -115,11 +128,13 @@ libtest_la_SOURCES = main.cpp \
|
|||
dht_server.cpp \
|
||||
udp_tracker.cpp \
|
||||
peer_server.cpp \
|
||||
bittorrent_peer.cpp \
|
||||
make_torrent.cpp \
|
||||
web_seed_suite.cpp \
|
||||
swarm_suite.cpp \
|
||||
test_utils.cpp \
|
||||
settings.cpp
|
||||
settings.cpp \
|
||||
print_alerts.cpp
|
||||
|
||||
test_primitives_SOURCES = \
|
||||
test_primitives.cpp \
|
||||
|
@ -195,11 +210,20 @@ enum_if_SOURCES = enum_if.cpp
|
|||
test_utp_SOURCES = test_utp.cpp
|
||||
test_session_SOURCES = test_session.cpp
|
||||
test_web_seed_SOURCES = test_web_seed.cpp
|
||||
test_web_seed_ban_SOURCES = test_web_seed_ban.cpp
|
||||
test_web_seed_chunked_SOURCES = test_web_seed_chunked.cpp
|
||||
test_web_seed_http_SOURCES = test_web_seed_http.cpp
|
||||
test_web_seed_http_pw_SOURCES = test_web_seed_http_pw.cpp
|
||||
test_web_seed_redirect_SOURCES = test_web_seed_redirect.cpp
|
||||
test_web_seed_socks4_SOURCES = test_web_seed_socks4.cpp
|
||||
test_web_seed_socks5_SOURCES = test_web_seed_socks5.cpp
|
||||
test_web_seed_socks5_no_peers_SOURCES = test_web_seed_socks5_no_peers.cpp
|
||||
test_web_seed_socks5_pw_SOURCES = test_web_seed_socks5_pw.cpp
|
||||
test_url_seed_SOURCES = test_url_seed.cpp
|
||||
test_remap_files_SOURCES = test_remap_files.cpp
|
||||
test_file_progress_SOURCES = test_file_progress.cpp
|
||||
test_linked_list_SOURCES = test_linked_list.cpp
|
||||
test_direct_dht_SOURCES = test_direct_dht.cpp
|
||||
|
||||
LDADD = libtest.la $(top_builddir)/src/libtorrent-rasterbar.la
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ unit_test_t* current_test = NULL;
|
|||
void output_test_log_to_terminal()
|
||||
{
|
||||
if (current_test == NULL || old_stdout == -1 || old_stderr == -1
|
||||
|| !redirect_output)
|
||||
|| !redirect_output || current_test->output == NULL)
|
||||
return;
|
||||
|
||||
fflush(stdout);
|
||||
|
@ -299,14 +299,25 @@ EXPORT int main(int argc, char const* argv[])
|
|||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
t.output = tmpfile();
|
||||
int ret1 = dup2(fileno(t.output), fileno(stdout));
|
||||
dup2(fileno(t.output), fileno(stderr));
|
||||
if (ret1 < 0 )
|
||||
FILE* f = tmpfile();
|
||||
if (f != NULL)
|
||||
{
|
||||
fprintf(stderr, "failed to redirect output: (%d) %s\n"
|
||||
, errno, strerror(errno));
|
||||
continue;
|
||||
int ret1 = dup2(fileno(f), fileno(stdout));
|
||||
dup2(fileno(f), fileno(stderr));
|
||||
if (ret1 >= 0)
|
||||
{
|
||||
t.output = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "failed to redirect output: (%d) %s\n"
|
||||
, errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "failed to create temporary file for redirecting "
|
||||
"output: (%d) %s\n", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,7 +361,7 @@ EXPORT int main(int argc, char const* argv[])
|
|||
total_failures += _g_test_failures;
|
||||
++num_run;
|
||||
|
||||
if (redirect_output)
|
||||
if (redirect_output && t.output)
|
||||
{
|
||||
fclose(t.output);
|
||||
}
|
||||
|
|
|
@ -232,8 +232,8 @@ void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_fil
|
|||
, int(cnt["disk.disk_blocks_in_use"]));
|
||||
test_sleep(100);
|
||||
}
|
||||
TEST_CHECK(std::abs(cnt["disk.disk_blocks_in_use"]
|
||||
- (torrent_file->total_size() + 0x3fff) / 0x4000) <= 2);
|
||||
TEST_CHECK(std::abs(int(cnt["disk.disk_blocks_in_use"]
|
||||
- (torrent_file->total_size() + 0x3fff) / 0x4000)) <= 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue