From 70e6ddbe0513476aa397cf0409dadebb8587f85c Mon Sep 17 00:00:00 2001 From: Martin Peres Date: Mon, 30 Jan 2017 14:12:22 +0200 Subject: framework/backends/json: always flush the metadata to the disk 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. Reviewed-by: Dylan Baker Signed-off-by: Martin Peres --- framework/backends/json.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'framework') 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')) -- cgit v1.2.3