diff mbox series

[for,4.1,v2,12/13] tests: acpi: print error unable to dump ACPI table during rebuild

Message ID 1553605799-168605-13-git-send-email-imammedo@redhat.com
State New
Headers show
Series tests: acpi: add UEFI (ARM) testing support | expand

Commit Message

Igor Mammedov March 26, 2019, 1:09 p.m. UTC
Instead of just asserting print the error that lead to assert first.
While at it move assert into rebuild branch, which removes reduntant
check done in case of !rebuild branch is taken (the later is taken
care of by g_assert_no_error).

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/bios-tables-test.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index b5cb425..dc52a65 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -199,11 +199,14 @@  static void dump_aml_files(test_data *data, bool rebuild)
                                        sdt->aml, ext);
             fd = g_open(aml_file, O_WRONLY|O_TRUNC|O_CREAT,
                         S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
+            if (fd < 0) {
+                perror(aml_file);
+            }
+            g_assert(fd >= 0);
         } else {
             fd = g_file_open_tmp("aml-XXXXXX", &sdt->aml_file, &error);
             g_assert_no_error(error);
         }
-        g_assert(fd >= 0);
 
         ret = qemu_write_full(fd, sdt->aml, sdt->aml_len);
         g_assert(ret == sdt->aml_len);