This guarantees that whatever the state we are in, we can always
continue the piglit run. Do not use FileBackend.__fsync as it would
not do the fsync call in the non-sync mode.

This change makes it easier to integrate into a CI system that is
hard-reboot-resistant.

Signed-off-by: Martin Peres <[email protected]>
---
 framework/backends/json.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/framework/backends/json.py b/framework/backends/json.py
index 55169191d..174c0ca96 100644
--- a/framework/backends/json.py
+++ b/framework/backends/json.py
@@ -108,6 +108,10 @@ class JSONBackend(FileBackend):
         with open(os.path.join(self._dest, 'metadata.json'), 'w') as f:
             json.dump(metadata, f, default=piglit_encoder)
 
+            # Flush the metadata to the disk, always
+            f.flush()
+            os.fsync(f.fileno())
+
         # make the directory for the tests
         try:
             os.mkdir(os.path.join(self._dest, 'tests'))
-- 
2.11.0

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to