forked from premiere/premiere-libtorrent
another attempt to get tests to link on windows
This commit is contained in:
parent
503ebc91bd
commit
f2aca363ad
|
@ -138,13 +138,13 @@ int main()
|
||||||
}
|
}
|
||||||
catch (std::exception const& e)
|
catch (std::exception const& e)
|
||||||
{
|
{
|
||||||
std::cerr << "Terminated with exception: \"" << e.what() << "\"\n";
|
char buf[200];
|
||||||
tests_failure = true;
|
snprintf(buf, sizeof(buf), "Terminated with exception: \"%s\"", e.what());
|
||||||
|
report_failure(buf, __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << "Terminated with unknown exception\n";
|
report_failure("Terminated with unknown exception", __FILE__, __LINE__);
|
||||||
tests_failure = true;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -158,21 +158,11 @@ int main()
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
if (tests_failure == 0)
|
|
||||||
{
|
remove_all(test_dir, ec);
|
||||||
remove_all(test_dir, ec);
|
if (ec)
|
||||||
if (ec)
|
fprintf(stderr, "failed to remove test dir: %s\n", ec.message().c_str());
|
||||||
fprintf(stderr, "failed to remove test dir: %s\n", ec.message().c_str());
|
|
||||||
}
|
return print_failures();
|
||||||
else
|
|
||||||
{
|
|
||||||
for (std::vector<std::string>::iterator i = failure_strings.begin()
|
|
||||||
, end(failure_strings.end()); i != end; ++i)
|
|
||||||
{
|
|
||||||
fputs(i->c_str(), stderr);
|
|
||||||
}
|
|
||||||
fprintf(stderr, "\n\n\x1b[41m == %d TEST(S) FAILED ==\x1b[0m\n\n\n", tests_failure);
|
|
||||||
}
|
|
||||||
return tests_failure;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
int tests_failure = 0;
|
static int tests_failure = 0;
|
||||||
std::vector<std::string> failure_strings;
|
static std::vector<std::string> failure_strings;
|
||||||
|
|
||||||
void report_failure(char const* err, char const* file, int line)
|
void report_failure(char const* err, char const* file, int line)
|
||||||
{
|
{
|
||||||
|
@ -78,6 +78,17 @@ void report_failure(char const* err, char const* file, int line)
|
||||||
++tests_failure;
|
++tests_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int print_failures()
|
||||||
|
{
|
||||||
|
for (std::vector<std::string>::iterator i = failure_strings.begin()
|
||||||
|
, end(failure_strings.end()); i != end; ++i)
|
||||||
|
{
|
||||||
|
fputs(i->c_str(), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\n\n\x1b[41m == %d TEST(S) FAILED ==\x1b[0m\n\n\n", tests_failure);
|
||||||
|
return tests_failure;
|
||||||
|
}
|
||||||
|
|
||||||
std::auto_ptr<alert> wait_for_alert(session& ses, int type)
|
std::auto_ptr<alert> wait_for_alert(session& ses, int type)
|
||||||
{
|
{
|
||||||
std::auto_ptr<alert> ret;
|
std::auto_ptr<alert> ret;
|
||||||
|
|
|
@ -44,8 +44,7 @@ namespace libtorrent
|
||||||
struct session_status;
|
struct session_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern EXPORT int tests_failure;
|
int EXPORT print_failures();
|
||||||
extern EXPORT std::vector<std::string> failure_strings;
|
|
||||||
|
|
||||||
int EXPORT load_file(std::string const& filename, std::vector<char>& v, libtorrent::error_code& ec, int limit = 8000000);
|
int EXPORT load_file(std::string const& filename, std::vector<char>& v, libtorrent::error_code& ec, int limit = 8000000);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue