[Piglit] [PATCH] framework/backends/json: always flush the metadata to the disk

Martin Peres martin.peres at linux.intel.com
Mon Jan 30 12:26:25 UTC 2017


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 <martin.peres at linux.intel.com>
---
 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



More information about the Piglit mailing list