tests/boot-sector: Drop dependence on global_qtest

As a general rule, we prefer avoiding implicit global state
because it makes code harder to safely copy and paste without
thinking about the global state.  Adjust the helper code to
use explicit state instead, and update all callers.

Fix some trailing whitespace while touching the file.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Eric Blake 2017-09-11 12:20:07 -05:00 committed by Thomas Huth
parent 6a5c88f572
commit 8b19f2b77e
5 changed files with 11 additions and 9 deletions

View file

@ -5,7 +5,7 @@
*
* Authors:
* Michael S. Tsirkin <mst@redhat.com>
* Victor Kaplansky <victork@redhat.com>
* Victor Kaplansky <victork@redhat.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
@ -130,7 +130,7 @@ int boot_sector_init(char *fname)
}
/* Loop until signature in memory is OK. */
void boot_sector_test(void)
void boot_sector_test(QTestState *qts)
{
uint8_t signature_low;
uint8_t signature_high;
@ -146,8 +146,8 @@ void boot_sector_test(void)
* instruction.
*/
for (i = 0; i < TEST_CYCLES; ++i) {
signature_low = readb(SIGNATURE_ADDR);
signature_high = readb(SIGNATURE_ADDR + 1);
signature_low = qtest_readb(qts, SIGNATURE_ADDR);
signature_high = qtest_readb(qts, SIGNATURE_ADDR + 1);
signature = (signature_high << 8) | signature_low;
if (signature == SIGNATURE) {
break;