On Tue, Jan 24, 2017 at 9:21 AM, Markus Armbruster <arm...@redhat.com> wrote: > Peter Maydell <peter.mayd...@linaro.org> writes: > >> On 23 January 2017 at 22:17, Peter Maydell <peter.mayd...@linaro.org> wrote: >>> On 23 January 2017 at 21:21, Artyom Tarasenko <atar4q...@gmail.com> wrote: >>>> Suggested-by: Peter Maydell <peter.mayd...@linaro.org> >>>> Signed-off-by: Artyom Tarasenko <atar4q...@gmail.com> >>>> --- >>>> hw/sparc64/niagara.c | 22 +++++++++++++++------- >>>> 1 file changed, 15 insertions(+), 7 deletions(-) >>>> >>>> diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c >>>> index b55d4bb..e945b5a 100644 >>>> --- a/hw/sparc64/niagara.c >>>> +++ b/hw/sparc64/niagara.c >>>> @@ -35,6 +35,7 @@ >>>> #include "hw/timer/sun4v-rtc.h" >>>> #include "exec/address-spaces.h" >>>> #include "sysemu/block-backend.h" >>>> +#include "qemu/error-report.h" >>>> >>>> >>>> typedef struct NiagaraBoardState { >>>> @@ -85,6 +86,14 @@ typedef struct NiagaraBoardState { >>>> #define NIAGARA_OBP_OFFSET 0x80000ULL >>>> #define PROM_SIZE_MAX (4 * 1024 * 1024) >>>> >>>> +static void add_rom_or_fail(const char *file, const hwaddr addr) >>>> +{ >>>> + if (rom_add_file_fixed(file, addr, -1)) { >>>> + error_report("Unable to load a firmware for -M niagara"); >>>> + exit(1); >>> >>> It would be nice to include the name of the file in the >>> error message -- or is that reported already inside >>> rom_add_file_fixed() somehow? > > Yes, it is, in rom_add_file(): > > if (fd == -1) { > fprintf(stderr, "Could not open option rom '%s': %s\n", > rom->path, strerror(errno)); > goto err; > } > >> PS: doesn't this break 'make check' if the rom files >> are missing? > > Yes, it does. Obvious incremental fix appended. It still prints > rom_add_file()'s message. Swap the operands of && to get rid of it.
Thanks, Markus. Will resubmit. Artyom > diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c > index a14724f..6b78394 100644 > --- a/hw/sparc64/niagara.c > +++ b/hw/sparc64/niagara.c > @@ -35,6 +35,7 @@ > #include "hw/timer/sun4v-rtc.h" > #include "exec/address-spaces.h" > #include "sysemu/block-backend.h" > +#include "sysemu/qtest.h" > #include "qemu/error-report.h" > > > @@ -88,7 +89,7 @@ typedef struct NiagaraBoardState { > > static void add_rom_or_fail(const char *file, const hwaddr addr) > { > - if (rom_add_file_fixed(file, addr, -1)) { > + if (rom_add_file_fixed(file, addr, -1) && !qtest_enabled()) { > error_report("Unable to load a firmware for -M niagara"); > exit(1); > } -- Regards, Artyom Tarasenko SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu