summaryrefslogtreecommitdiff
path: root/tests/boot-sector.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-10-11 17:19:35 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-10-14 10:06:47 +1100
commit1ef2ef96296f061c89b60e77c3c50577fd6fe415 (patch)
treec733e2a5097bbf23784de4eba1a3e2f745744db2 /tests/boot-sector.c
parent54ce6f22e86977b6e94692d90e13fce6fc9aa641 (diff)
downloadqemu-1ef2ef96296f061c89b60e77c3c50577fd6fe415.tar.gz
tests/boot-sector: Use minimum length for the Forth boot script
The pxe-test is quite slow on ppc64 with tcg. We can speed it up a little bit by decreasing the size of the file that has to be loaded via TFTP. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/boot-sector.c')
-rw-r--r--tests/boot-sector.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/boot-sector.c b/tests/boot-sector.c
index e3193c0a12..0168fd0247 100644
--- a/tests/boot-sector.c
+++ b/tests/boot-sector.c
@@ -72,6 +72,7 @@ static uint8_t boot_sector[0x7e000] = {
int boot_sector_init(const char *fname)
{
FILE *f = fopen(fname, "w");
+ size_t len = sizeof boot_sector;
if (!f) {
fprintf(stderr, "Couldn't open \"%s\": %s", fname, strerror(errno));
@@ -80,13 +81,12 @@ int boot_sector_init(const char *fname)
/* For Open Firmware based system, we can use a Forth script instead */
if (strcmp(qtest_get_arch(), "ppc64") == 0) {
- memset(boot_sector, ' ', sizeof boot_sector);
- sprintf((char *)boot_sector, "\\ Bootscript\n%x %x c! %x %x c!\n",
+ len = sprintf((char *)boot_sector, "\\ Bootscript\n%x %x c! %x %x c!\n",
LOW(SIGNATURE), BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET,
HIGH(SIGNATURE), BOOT_SECTOR_ADDRESS + SIGNATURE_OFFSET + 1);
}
- fwrite(boot_sector, 1, sizeof boot_sector, f);
+ fwrite(boot_sector, 1, len, f);
fclose(f);
return 0;
}