43{
44#ifdef __GLIBC__
45 mode_t prevmode = umask(077);
46#endif
47 const char *tmp = getenv("TEMP");
48 if (!tmp)
49 tmp = "/tmp";
50 static const char *filename = "electroneum-notify-unit-test-XXXXXX";
51 const size_t len = strlen(tmp) + 1 + strlen(filename);
52 std::unique_ptr<char[]> name_template_(new char[len + 1]);
53 char *name_template = name_template_.get();
55 snprintf(name_template, len + 1, "%s/%s", tmp, filename);
56 int fd = mkstemp(name_template);
57#ifdef __GLIBC__
58 umask(prevmode);
59#endif
61 close(fd);
62
64#ifdef _WIN32
65 + ".exe"
66#endif
67 + " " + name_template + " %s";
68
70 notify.notify("%s", "1111111111111111111111111111111111111111111111111111111111111111", NULL);
71
72 bool ok = false;
73 for (int i = 0; i < 10; ++i)
74 {
76
77 std::string s;
79 {
80 if (s == "1111111111111111111111111111111111111111111111111111111111111111")
81 {
82 ok = true;
83 break;
84 }
85 }
86 }
87 boost::filesystem::remove(name_template);
89}
#define ASSERT_TRUE(condition)
bool load_file_to_string(const std::string &path_to_file, std::string &target_str, size_t max_size=1000000000)