tests/bios-tables-test: Sanitize test verbose output
PATCH 1/1 tests/bios-tables-test: Sanitize test verbose output
Fix the extraneous extra blank lines in the test output when running with V=1.
Before:
TEST: tests/bios-tables-test... (pid=25678)
/i386/acpi/piix4:
Looking for expected file 'tests/acpi-test-data/pc/DSDT'
Using expected file 'tests/acpi-test-data/pc/DSDT'
Looking for expected file 'tests/acpi-test-data/pc/FACP'
Using expected file 'tests/acpi-test-data/pc/FACP'
Looking for expected file 'tests/acpi-test-data/pc/APIC'
Using expected file 'tests/acpi-test-data/pc/APIC'
Looking for expected file 'tests/acpi-test-data/pc/HPET'
Using expected file 'tests/acpi-test-data/pc/HPET' OK
After:
TEST: tests/bios-tables-test... (pid=667)
/i386/acpi/piix4:
Looking for expected file 'tests/acpi-test-data/pc/DSDT' Using expected file 'tests/acpi-test-data/pc/DSDT' Looking for expected file 'tests/acpi-test-data/pc/FACP' Using expected file 'tests/acpi-test-data/pc/FACP' Looking for expected file 'tests/acpi-test-data/pc/APIC' Using expected file 'tests/acpi-test-data/pc/APIC' Looking for expected file 'tests/acpi-test-data/pc/HPET' Using expected file 'tests/acpi-test-data/pc/HPET' OK
--- tests/bios-tables-test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tests/bios-tables-test.c +5 -2
@@ -371,6 +371,9 @@ static GArray *load_expected_aml(test_data *data)gboolean ret;GArray *exp_tables =g_array_new (false, true,sizeof (AcpiSdtTable)); +if (getenv ("V" )) { +fputc ('\n' , stderr); + }for (i =0 ; i < data->tables->len; ++i) {AcpiSdtTable exp_sdt;gchar *aml_file =NULL ;
@@ -385,7 +388,7 @@ try_again: aml_file =g_strdup_printf ("%s/%s/%.4s%s" , data_dir, data->machine, (gchar *)&sdt->header.signature, ext);if (getenv ("V" )) { -fprintf (stderr,"\nLooking for expected file '%s'\n" , aml_file); +fprintf (stderr,"Looking for expected file '%s'\n" , aml_file); }if (g_file_test (aml_file,G_FILE_TEST_EXISTS )) { exp_sdt.aml_file = aml_file;
@@ -397,7 +400,7 @@ try_again: }g_assert (exp_sdt.aml_file);if (getenv ("V" )) { -fprintf (stderr,"\nUsing expected file '%s'\n" , aml_file); +fprintf (stderr,"Using expected file '%s'\n" , aml_file); } ret =g_file_get_contents (aml_file, &exp_sdt.aml, &exp_sdt.aml_len, &error);
Signature · 1 line
2.17.2
Quoted 37 lines · On Tue, 30 Oct 2018 01:18:40 +0100 Philippe Mathieu-Daudé <[email protected]>…
Fix the extraneous extra blank lines in the test output when running with V=1.
Before:
TEST: tests/bios-tables-test... (pid=25678)
/i386/acpi/piix4:
Looking for expected file 'tests/acpi-test-data/pc/DSDT'Using expected file 'tests/acpi-test-data/pc/DSDT'
Looking for expected file 'tests/acpi-test-data/pc/FACP'
Using expected file 'tests/acpi-test-data/pc/FACP'
Looking for expected file 'tests/acpi-test-data/pc/APIC'
Using expected file 'tests/acpi-test-data/pc/APIC'
Looking for expected file 'tests/acpi-test-data/pc/HPET'
Using expected file 'tests/acpi-test-data/pc/HPET' OK
After:
TEST: tests/bios-tables-test... (pid=667)
/i386/acpi/piix4:
Looking for expected file 'tests/acpi-test-data/pc/DSDT' Using expected file 'tests/acpi-test-data/pc/DSDT' Looking for expected file 'tests/acpi-test-data/pc/FACP' Using expected file 'tests/acpi-test-data/pc/FACP' Looking for expected file 'tests/acpi-test-data/pc/APIC' Using expected file 'tests/acpi-test-data/pc/APIC' Looking for expected file 'tests/acpi-test-data/pc/HPET' Using expected file 'tests/acpi-test-data/pc/HPET' OK
Quoted 2 lines
Suggested-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 36 lines
--- tests/bios-tables-test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tests/bios-tables-test.c +5
-2@@ -371,6 +371,9 @@ static GArray *load_expected_aml(test_data *data)gboolean ret;GArray *exp_tables =g_array_new (false, true,sizeof (AcpiSdtTable)); +if (getenv ("V" )) { +fputc ('\n' , stderr); + }for (i =0 ; i < data->tables->len; ++i) {AcpiSdtTable exp_sdt;gchar *aml_file =NULL ;@@ -385,7 +388,7 @@ try_again: aml_file =g_strdup_printf ("%s/%s/%.4s%s" , data_dir, data->machine, (gchar *)&sdt->header.signature, ext);if (getenv ("V" )) { -fprintf (stderr,"\nLooking for expected file '%s'\n" , aml_file); +fprintf (stderr,"Looking for expected file '%s'\n" , aml_file); }if (g_file_test (aml_file,G_FILE_TEST_EXISTS )) { exp_sdt.aml_file = aml_file;@@ -397,7 +400,7 @@ try_again: }g_assert (exp_sdt.aml_file);if (getenv ("V" )) { -fprintf (stderr,"\nUsing expected file '%s'\n" , aml_file); +fprintf (stderr,"Using expected file '%s'\n" , aml_file); } ret =g_file_get_contents (aml_file, &exp_sdt.aml, &exp_sdt.aml_len, &error);
tests/bios-tables-test.c static GArray *load_expected_aml(test_data *data) · line 376
Quoted 11 lines · Philippe Mathieu-Daudé
Fix the extraneous extra blank lines in the test output when running with V=1.
+++
b/tests/bios-tables-test.ctests/bios-tables-test.c +3
-0@@ -371,6 +371,9 @@ static GArray *load_expected_aml(test_data *data)gboolean ret;GArray *exp_tables =g_array_new (false, true,sizeof (AcpiSdtTable)); +if (getenv ("V" )) { +fputc ('\n' , stderr); + }
Umm, this prints a blank line even if I run 'make check V=0' - do we support V=0 as a way to disable verbosity, in which case you need to actually inspect the contents of $V rather than just assuming that if it is in the environment things are verbose?
tests/bios-tables-test.c try_again: · line 403
Quoted 6 lines
tests/bios-tables-test.c +1
-1@@ -397,7 +400,7 @@ try_again: }g_assert (exp_sdt.aml_file);if (getenv ("V" )) { -fprintf (stderr,"\nUsing expected file '%s'\n" , aml_file); +fprintf (stderr,"Using expected file '%s'\n" , aml_file);
But that's a pre-existing question, so it doesn't affect this particular patch.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 2 lines · Eric Blake
Umm, this prints a blank line even if I run 'make check V=0' - do we support V=0 as a way to disable verbosity
Empirically, we do not. Our rules.make defines
quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
which will suppress the verbose printing of command lines only if $(V) expands to the empty string, so V=0 will print verbosely here too.
thanks
-- PMM
Quoted 68 lines · Philippe Mathieu-Daudé
Fix the extraneous extra blank lines in the test output when running with V=1.
Before:
TEST: tests/bios-tables-test... (pid=25678)
/i386/acpi/piix4:
Looking for expected file 'tests/acpi-test-data/pc/DSDT'Using expected file 'tests/acpi-test-data/pc/DSDT'
Looking for expected file 'tests/acpi-test-data/pc/FACP'
Using expected file 'tests/acpi-test-data/pc/FACP'
Looking for expected file 'tests/acpi-test-data/pc/APIC'
Using expected file 'tests/acpi-test-data/pc/APIC'
Looking for expected file 'tests/acpi-test-data/pc/HPET'
Using expected file 'tests/acpi-test-data/pc/HPET' OK
After:
TEST: tests/bios-tables-test... (pid=667)
/i386/acpi/piix4:
Looking for expected file 'tests/acpi-test-data/pc/DSDT' Using expected file 'tests/acpi-test-data/pc/DSDT' Looking for expected file 'tests/acpi-test-data/pc/FACP' Using expected file 'tests/acpi-test-data/pc/FACP' Looking for expected file 'tests/acpi-test-data/pc/APIC' Using expected file 'tests/acpi-test-data/pc/APIC' Looking for expected file 'tests/acpi-test-data/pc/HPET' Using expected file 'tests/acpi-test-data/pc/HPET' OKSuggested-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/bios-tables-test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)tests/bios-tables-test.c +4
-1@@ -371,6 +371,9 @@ static GArray *load_expected_aml(test_data *data)gboolean ret;GArray *exp_tables =g_array_new (false, true,sizeof (AcpiSdtTable)); +if (getenv ("V" )) { +fputc ('\n' , stderr); + }for (i =0 ; i < data->tables->len; ++i) {AcpiSdtTable exp_sdt;gchar *aml_file =NULL ;@@ -385,7 +388,7 @@ try_again: aml_file =g_strdup_printf ("%s/%s/%.4s%s" , data_dir, data->machine, (gchar *)&sdt->header.signature, ext);if (getenv ("V" )) { -fprintf (stderr,"\nLooking for expected file '%s'\n" , aml_file); +fprintf (stderr,"Looking for expected file '%s'\n" , aml_file); }if (g_file_test (aml_file,G_FILE_TEST_EXISTS )) { exp_sdt.aml_file = aml_file;
tests/bios-tables-test.c try_again: · line 406
Quoted 8 lines
tests/bios-tables-test.c +1
-1@@ -397,7 +400,7 @@ try_again: }g_assert (exp_sdt.aml_file);if (getenv ("V" )) { -fprintf (stderr,"\nUsing expected file '%s'\n" , aml_file); +fprintf (stderr,"Using expected file '%s'\n" , aml_file); } ret =g_file_get_contents (aml_file, &exp_sdt.aml, &exp_sdt.aml_len, &error);
Could we please get rid of the getenv + fprintf here and use g_test_message() instead, like we already do in most of the other tests that want to log additional output?
Thomas