projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: Fix: `wait_on_file()` returns too early
[lttng-tools.git]
/
tests
/
regression
/
tools
/
notification
/
notification.c
diff --git
a/tests/regression/tools/notification/notification.c
b/tests/regression/tools/notification/notification.c
index de8734603fd309ba8d42db1cffac97015b5cd3e9..b6ef0df4f1dc6c7ef9f751ad4a2a54b7d15e4745 100644
(file)
--- a/
tests/regression/tools/notification/notification.c
+++ b/
tests/regression/tools/notification/notification.c
@@
-50,6
+50,7
@@
#include <lttng/notification/channel.h>
#include <lttng/notification/notification.h>
#include <lttng/trigger/trigger.h>
#include <lttng/notification/channel.h>
#include <lttng/notification/notification.h>
#include <lttng/trigger/trigger.h>
+#include <lttng/lttng.h>
#include <tap/tap.h>
#include <tap/tap.h>
@@
-73,16
+74,31
@@
void wait_on_file(const char *path, bool file_exist)
ret = stat(path, &buf);
if (ret == -1 && errno == ENOENT) {
if (file_exist) {
ret = stat(path, &buf);
if (ret == -1 && errno == ENOENT) {
if (file_exist) {
- (void) poll(NULL, 0, 10); /* 10 ms delay */
- continue; /* retry */
+ /*
+ * The file does not exist. wait a bit and
+ * continue looping until it does.
+ */
+ (void) poll(NULL, 0, 10);
+ continue;
}
}
- break; /* File does not exist */
+
+ /*
+ * File does not exist and the exit condition we want.
+ * Break from the loop and return.
+ */
+ break;
}
if (ret) {
perror("stat");
exit(EXIT_FAILURE);
}
}
if (ret) {
perror("stat");
exit(EXIT_FAILURE);
}
- break; /* found */
+ /*
+ * stat() returned 0, so the file exists. break now only if
+ * that's the exit condition we want.
+ */
+ if (file_exist) {
+ break;
+ }
}
}
}
}
@@
-359,7
+375,7
@@
loop_end:
* registered trigger fail.
*/
loop_ret = lttng_unregister_trigger(trigger);
* registered trigger fail.
*/
loop_ret = lttng_unregister_trigger(trigger);
- ok(loop_ret == -LTTNG_ERR_TRIGGER_NOT_FOUND, "Unregister of a non-register
d
trigger fails as expected: %s", test_tuple_string);
+ ok(loop_ret == -LTTNG_ERR_TRIGGER_NOT_FOUND, "Unregister of a non-register
ed
trigger fails as expected: %s", test_tuple_string);
} else {
ok(loop_ret == -LTTNG_ERR_INVALID_TRIGGER, "Trigger is invalid as expected and cannot be registered: %s", test_tuple_string);
}
} else {
ok(loop_ret == -LTTNG_ERR_INVALID_TRIGGER, "Trigger is invalid as expected and cannot be registered: %s", test_tuple_string);
}
@@
-566,10
+582,10
@@
void test_notification_channel(const char *session_name, const char *channel_nam
ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID, "Subscribing to an invalid condition");
nc_status = lttng_notification_channel_unsubscribe(notification_channel, dummy_invalid_condition);
ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID, "Subscribing to an invalid condition");
nc_status = lttng_notification_channel_unsubscribe(notification_channel, dummy_invalid_condition);
- ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID, "Unsubscribing
to
an invalid condition");
+ ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INVALID, "Unsubscribing
from
an invalid condition");
nc_status = lttng_notification_channel_unsubscribe(notification_channel, dummy_condition);
nc_status = lttng_notification_channel_unsubscribe(notification_channel, dummy_condition);
- ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION, "Unsubscribing
to an
valid unknown condition");
+ ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_UNKNOWN_CONDITION, "Unsubscribing
from a
valid unknown condition");
/* Subscribe a valid low condition */
nc_status = lttng_notification_channel_subscribe(notification_channel, low_condition);
/* Subscribe a valid low condition */
nc_status = lttng_notification_channel_subscribe(notification_channel, low_condition);
This page took
0.026052 seconds
and
4
git commands to generate.