[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] d792bc: qemu.py: make VM() a context manager
From: |
GitHub |
Subject: |
[Qemu-commits] [qemu/qemu] d792bc: qemu.py: make VM() a context manager |
Date: |
Tue, 05 Sep 2017 08:36:21 -0700 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: d792bc3811f22a22a46c7d9a725fd29029f54095
https://github.com/qemu/qemu/commit/d792bc3811f22a22a46c7d9a725fd29029f54095
Author: Stefan Hajnoczi <address@hidden>
Date: 2017-09-05 (Tue, 05 Sep 2017)
Changed paths:
M scripts/qemu.py
Log Message:
-----------
qemu.py: make VM() a context manager
There are a number of ways to ensure that the QEMU process is shut down
when the test ends, including atexit.register(), try: finally:, or
unittest.teardown() methods. All of these require extra code and the
programmer must remember to add vm.shutdown().
A nice solution is context managers:
with VM(binary) as vm:
...
# vm is guaranteed to be shut down here
Cc: Eduardo Habkost <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Commit: f4844ac0adabc458ba4610a71155448783d37c73
https://github.com/qemu/qemu/commit/f4844ac0adabc458ba4610a71155448783d37c73
Author: Stefan Hajnoczi <address@hidden>
Date: 2017-09-05 (Tue, 05 Sep 2017)
Changed paths:
M tests/qemu-iotests/iotests.py
Log Message:
-----------
iotests.py: add FilePath context manager
The scratch/ (TEST_DIR) directory is not automatically cleaned up after
test execution. It is the responsibility of tests to remove any files
they create.
A nice way of doing this is to declare files at the beginning of the
test and automatically remove them with a context manager:
with iotests.FilePath('test.img') as img_path:
qemu_img(...)
qemu_io(...)
# img_path is guaranteed to be deleted here
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Commit: 921a32179bb0a31c45a505f4ef36de4893be9612
https://github.com/qemu/qemu/commit/921a32179bb0a31c45a505f4ef36de4893be9612
Author: Stefan Hajnoczi <address@hidden>
Date: 2017-09-05 (Tue, 05 Sep 2017)
Changed paths:
M tests/qemu-iotests/194
Log Message:
-----------
qemu-iotests: use context managers for resource cleanup in 194
Switch from atexit.register() to a more elegant idiom of declaring
resources in a with statement:
with FilePath('monitor.sock') as monitor_path,
VM() as vm:
...
The files and VMs will be automatically cleaned up whether the test
passes or fails.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Commit: b461151ff31c7925f271c297e8abed20231ac7d3
https://github.com/qemu/qemu/commit/b461151ff31c7925f271c297e8abed20231ac7d3
Author: Daniel P. Berrange <address@hidden>
Date: 2017-09-05 (Tue, 05 Sep 2017)
Changed paths:
M include/block/block_int.h
Log Message:
-----------
block: document semantics of bdrv_co_preadv|pwritev
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Commit: 6bbd7e2728f488f881f6a2a521fe7c5083684bc5
https://github.com/qemu/qemu/commit/6bbd7e2728f488f881f6a2a521fe7c5083684bc5
Author: Peter Maydell <address@hidden>
Date: 2017-09-05 (Tue, 05 Sep 2017)
Changed paths:
M include/block/block_int.h
M scripts/qemu.py
M tests/qemu-iotests/194
M tests/qemu-iotests/iotests.py
Log Message:
-----------
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into
staging
# gpg: Signature made Tue 05 Sep 2017 14:28:52 BST
# gpg: using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <address@hidden>"
# gpg: aka "Stefan Hajnoczi <address@hidden>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/block-pull-request:
block: document semantics of bdrv_co_preadv|pwritev
qemu-iotests: use context managers for resource cleanup in 194
iotests.py: add FilePath context manager
qemu.py: make VM() a context manager
Signed-off-by: Peter Maydell <address@hidden>
Compare: https://github.com/qemu/qemu/compare/6d58d50e5376...6bbd7e2728f4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [qemu/qemu] d792bc: qemu.py: make VM() a context manager,
GitHub <=