[Spice-commits] server/tests
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 3 07:49:02 UTC 2020
server/tests/test-record.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
New commits:
commit f77f7d74a1a60e61256764ccdf7f7dfc23215cc9
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Mar 27 10:35:23 2020 +0000
test-record: Fix a race condition running the test
This could happen if the machine is pretty busy.
I saw intermittent failures on CI and it happened on my
machine also while doing other batch job.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/tests/test-record.c b/server/tests/test-record.c
index 66f408d6..acade46c 100644
--- a/server/tests/test-record.c
+++ b/server/tests/test-record.c
@@ -59,6 +59,26 @@ test_record(bool compress)
red_record_unref(rec);
+ // this code prevents a race between closing the record and using the file
+ // in case of a filter is used. red_record_unref flushed data to external
+ // program but don't wait. Make sure other program wrote some data
+ if (compress) {
+ int n;
+ for (n = 0; n < 10; ++n) {
+ FILE *f = fopen(fn, "rb");
+ if (f) {
+ long size;
+ fseek(f, 0, SEEK_END);
+ size = ftell(f);
+ fclose(f);
+ if (size > 0) {
+ break;
+ }
+ }
+ usleep(100000);
+ }
+ }
+
// check content of the output file
FILE *f;
if (!compress) {
More information about the Spice-commits
mailing list