MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _AddTaskData_WaitUntilSignalisedValue

Function _AddTaskData_WaitUntilSignalisedValue

tests/unit/test_cron.c:142–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142static void _AddTaskData_WaitUntilSignalisedValue
143(
144 const AddTaskData data,
145 const unsigned char signalised_value
146) {
147 struct timeval timeout = _get_test_timeout_value();
148 unsigned char read_signal_data = INVALID_SIGNAL_VALUE;
149
150 // Prepare the read file descriptors by including our signal pipe.
151 fd_set read_fds;
152 FD_ZERO(&read_fds);
153 FD_SET(data.pipe_read_fd, &read_fds);
154
155 while (read_signal_data != signalised_value) {
156 const int result = select(FD_SETSIZE, &read_fds, NULL, NULL, &timeout);
157 // Check that there wasn't an error of "select".
158 TEST_ASSERT(result != -1);
159 // Check that we didn't encounter the timeout scenario and
160 // there is data available for reading, meaning the AddTask task
161 // has successfully completed.
162 TEST_ASSERT(result > 0);
163 // Check that the read channel is available for reading and has unread
164 // data.
165 TEST_ASSERT(FD_ISSET(data.pipe_read_fd, &read_fds));
166 // Wait until the signal expected is received.
167 assert(read(data.pipe_read_fd, (void *)&read_signal_data, 1) == 1);
168 }
169}
170
171static void _AddTaskData_WaitForRunning
172(

Callers 2

Calls 1

_get_test_timeout_valueFunction · 0.85

Tested by

no test coverage detected