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

Dylan Baker dylan at pnwbakers.com
Mon Jan 30 18:09:16 UTC 2017


Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

Quoting Martin Peres (2017-01-30 04:26:25)
> 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
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20170130/ebd1bca5/attachment.sig>


More information about the Piglit mailing list