[Qemu-devel] [PATCH v3 13/13] tests: acpi: print error unable to dump ACPI table during rebuild

Igor Mammedov posted 13 patches 6 years, 6 months ago
Only 12 patches received!
There is a newer version of this series
[Qemu-devel] [PATCH v3 13/13] tests: acpi: print error unable to dump ACPI table during rebuild
Posted by Igor Mammedov 6 years, 6 months ago
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 --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index f117461..5a5d036 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);
-- 
2.7.4


Re: [Qemu-devel] [PATCH v3 13/13] tests: acpi: print error unable to dump ACPI table during rebuild
Posted by Wei Yang 6 years, 6 months ago
On Thu, Apr 25, 2019 at 07:34:49AM +0200, Igor Mammedov wrote:
>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>

Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>

>---
> tests/bios-tables-test.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
>diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
>index f117461..5a5d036 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);
>-- 
>2.7.4

-- 
Wei Yang
Help you, Help me

Re: [Qemu-devel] [PATCH v3 13/13] tests: acpi: print error unable to dump ACPI table during rebuild
Posted by Philippe Mathieu-Daudé 6 years, 6 months ago
On 4/25/19 7:34 AM, Igor Mammedov wrote:
> Instead of just asserting print the error that lead to assert first.
> While at it move assert into rebuild branch, which removes reduntant

"redundant"

> 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 --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
> index f117461..5a5d036 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);
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>