unit_tests: strengthen notify test against OS scheduling

This commit is contained in:
moneromooo-monero 2018-12-05 00:30:39 +00:00
parent e282e9fa40
commit 1cfd6f1060
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 16 additions and 5 deletions

View File

@ -69,11 +69,22 @@ TEST(notify, works)
tools::Notify notify(spec.c_str());
notify.notify("1111111111111111111111111111111111111111111111111111111111111111");
epee::misc_utils::sleep_no_w(100);
std::string s;
ASSERT_TRUE(epee::file_io_utils::load_file_to_string(name_template, s));
ASSERT_TRUE(s == "1111111111111111111111111111111111111111111111111111111111111111");
bool ok = false;
for (int i = 0; i < 10; ++i)
{
epee::misc_utils::sleep_no_w(100);
std::string s;
if (epee::file_io_utils::load_file_to_string(name_template, s))
{
if (s == "1111111111111111111111111111111111111111111111111111111111111111")
{
ok = true;
break;
}
std::cout << "got: [" << s << "]" << std::endl;
}
}
boost::filesystem::remove(name_template);
ASSERT_TRUE(ok);
}