diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-12-05 00:30:39 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-12-05 00:32:02 +0000 |
commit | 1cfd6f1060ca1a8f731638826c3a436a10ccb37e (patch) | |
tree | 040b27e83446217694562af79d0b194e36519c4a /tests | |
parent | Merge pull request #4878 (diff) | |
download | monero-1cfd6f1060ca1a8f731638826c3a436a10ccb37e.tar.xz |
unit_tests: strengthen notify test against OS scheduling
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit_tests/notify.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/unit_tests/notify.cpp b/tests/unit_tests/notify.cpp index edc4eabdf..a5c570bf4 100644 --- a/tests/unit_tests/notify.cpp +++ b/tests/unit_tests/notify.cpp @@ -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); } |