event-test: Properly terminate strings printed from callbacks

Stdio was buffering strings in functions:
myDomainEventBlockJobCallback,
myDomainEventBlockThresholdCallback,
myDomainEventMemoryFailureCallback. It caused flushing the
printed strings from callbacks at the end of a run, not
gradually. The solution is to add \n at the end of each string.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Kristina Hanicova 2021-02-19 14:07:53 +01:00 committed by Ján Tomko
parent c0ac0144a3
commit 4fc755bec1

View File

@ -938,7 +938,7 @@ myDomainEventBlockJobCallback(virConnectPtr conn G_GNUC_UNUSED,
const char *eventName = opaque; const char *eventName = opaque;
printf("%s EVENT: Domain %s(%d) block job callback '%s' disk '%s', " printf("%s EVENT: Domain %s(%d) block job callback '%s' disk '%s', "
"type '%s' status '%s'", "type '%s' status '%s'\n",
__func__, virDomainGetName(dom), virDomainGetID(dom), eventName, __func__, virDomainGetName(dom), virDomainGetID(dom), eventName,
disk, blockJobTypeToStr(type), blockJobStatusToStr(status)); disk, blockJobTypeToStr(type), blockJobStatusToStr(status));
return 0; return 0;
@ -956,7 +956,7 @@ myDomainEventBlockThresholdCallback(virConnectPtr conn G_GNUC_UNUSED,
{ {
/* Casts to uint64_t to work around mingw not knowing %lld */ /* Casts to uint64_t to work around mingw not knowing %lld */
printf("%s EVENT: Domain %s(%d) block threshold callback dev '%s'(%s), " printf("%s EVENT: Domain %s(%d) block threshold callback dev '%s'(%s), "
"threshold: '%" PRIu64 "', excess: '%" PRIu64 "'", "threshold: '%" PRIu64 "', excess: '%" PRIu64 "'\n",
__func__, virDomainGetName(dom), virDomainGetID(dom), __func__, virDomainGetName(dom), virDomainGetID(dom),
dev, NULLSTR(path), (uint64_t)threshold, (uint64_t)excess); dev, NULLSTR(path), (uint64_t)threshold, (uint64_t)excess);
return 0; return 0;
@ -972,7 +972,7 @@ myDomainEventMemoryFailureCallback(virConnectPtr conn G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED) void *opaque G_GNUC_UNUSED)
{ {
printf("%s EVENT: Domain %s(%d) memory failure: recipient '%d', " printf("%s EVENT: Domain %s(%d) memory failure: recipient '%d', "
"aciont '%d', flags '%d'", __func__, virDomainGetName(dom), "aciont '%d', flags '%d'\n", __func__, virDomainGetName(dom),
virDomainGetID(dom), recipient, action, flags); virDomainGetID(dom), recipient, action, flags);
return 0; return 0;
} }