[gjs/gnome-3-34] tests: Avoid filename conflict when tests run in parallel
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gnome-3-34] tests: Avoid filename conflict when tests run in parallel
- Date: Sat, 28 Mar 2020 05:49:19 +0000 (UTC)
commit 8847621de405ae336e80804be8a279535b3c4604
Author: Philip Chimento <philip chimento gmail com>
Date: Thu Feb 20 23:11:17 2020 -0800
tests: Avoid filename conflict when tests run in parallel
It seems that it's possible for the profiler start/stop test to have run
during the script test that verifies that the profiler doesn't write a
file, which causes it to fail because they both use the default profiler
file name. Give the start/stop test a different file name and delete it
afterwards.
test/gjs-tests.cpp | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 45ebe243..c5bd9e17 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -27,6 +27,7 @@
#include <glib-object.h>
#include <glib.h>
+#include <glib/gstdio.h> // for g_unlink
#include "gjs/jsapi-wrapper.h"
@@ -370,6 +371,7 @@ gjstest_test_profiler_start_stop(void)
nullptr));
GjsProfiler *profiler = gjs_context_get_profiler(context);
+ gjs_profiler_set_filename(profiler, "dont-conflict-with-other-test.syscap");
gjs_profiler_start(profiler);
for (size_t ix = 0; ix < 100; ix++) {
@@ -385,6 +387,9 @@ gjstest_test_profiler_start_stop(void)
}
gjs_profiler_stop(profiler);
+
+ if (g_unlink("dont-conflict-with-other-test.syscap") != 0)
+ g_message("Temp profiler file not deleted");
}
int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]