Skip to contentSkip to conversation

tests: acpi: improve tests reproducability

PATCH Superseded Igor Mammedov 4 participants 10 messages Jul 4, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover tests: acpi: improve tests reproducability

series should help to make tests more reproducable and not depend on IASL being installed. IASL will be required only is user needs to get textual diff of mismatching files.

Igor Mammedov (2):
tests: acpi: do not require IASL for dumping AML blobs
tests: acpi: do not skip tests when IASL is not installed

 tests/bios-tables-test.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
Signature · 1 line
2.18.1
#1 lore raw

PATCH 1/2 tests: acpi: do not require IASL for dumping AML blobs

IASL isn't needed when dumping ACPI tables from guest for rebuild purposes. So move this part out from IASL branch.

Makes rebuild-expected-aml.sh work without IASL installed on host.

---
 tests/bios-tables-test.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
tests/bios-tables-test.c +4 -6
index d863233fe9..13bd166b81 100644
@@ -597,12 +597,10 @@ static void test_acpi_one(const char *params, test_data *data)
     test_acpi_rxsdt_table(data);
     test_acpi_fadt_table(data);
 
-    if (iasl) {
-        if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
-            dump_aml_files(data, true);
-        } else {
-            test_acpi_asl(data);
-        }
+    if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
+        dump_aml_files(data, true);
+    } else if (iasl) {
+        test_acpi_asl(data);
     }
 
     /*
Signature · 1 line
2.18.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] tests: acpi: do not require IASL for dumping AML blobs

Quoted 7 lines · Igor Mammedov

IASL isn't needed when dumping ACPI tables from guest for rebuild purposes. So move this part out from IASL branch.

Makes rebuild-expected-aml.sh work without IASL installed on host.

Quoted 26 lines
---
 tests/bios-tables-test.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
tests/bios-tables-test.c +4 -6
index d863233fe9..13bd166b81 100644
@@ -597,12 +597,10 @@ static void test_acpi_one(const char *params, test_data *data)
     test_acpi_rxsdt_table(data);
     test_acpi_fadt_table(data);
 
-    if (iasl) {
-        if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
-            dump_aml_files(data, true);
-        } else {
-            test_acpi_asl(data);
-        }
+    if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
+        dump_aml_files(data, true);
+    } else if (iasl) {
+        test_acpi_asl(data);
     }
 
     /*
Reviewed-by on v1 1/2
#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] tests: acpi: do not require IASL for dumping AML blobs

In reply to Igor Mammedov

Hi Igor,

Quoted 23 lines · Igor Mammedov

IASL isn't needed when dumping ACPI tables from guest for rebuild purposes. So move this part out from IASL branch.

Makes rebuild-expected-aml.sh work without IASL installed on host.

---
 tests/bios-tables-test.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
tests/bios-tables-test.c +0 -3
index d863233fe9..13bd166b81 100644
@@ -597,12 +597,10 @@ static void test_acpi_one(const char *params, test_data *data)
     test_acpi_rxsdt_table(data);
     test_acpi_fadt_table(data);
 
-    if (iasl) {
-        if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
-            dump_aml_files(data, true);

tests/bios-tables-test.c static void test_acpi_one(const char *params, test_data *data) · line 606

Quoted 10 lines
tests/bios-tables-test.c +4 -3
-        } else {
-            test_acpi_asl(data);
-        }
+    if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
+        dump_aml_files(data, true);
+    } else if (iasl) {
+        test_acpi_asl(data);
     }
 
     /*

Thanks

Eric

#4 lore raw

PATCH 2/2 tests: acpi: do not skip tests when IASL is not installed

In reply to Igor Mammedov

tests do binary comparition so we can check tables without IASL. Move IASL condition right before decompilation step and skip it if IASL is not installed.

---
 tests/bios-tables-test.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
tests/bios-tables-test.c +14 -1
index 13bd166b81..a356ac3489 100644
@@ -389,6 +389,14 @@ static void test_acpi_asl(test_data *data)
         all_tables_match = all_tables_match &&
             test_acpi_find_diff_allowed(exp_sdt);
 
+        /*
+         * don't try to decompile if IASL isn't present, in this case user
+         * will just 'get binary file mismatch' warnings and test failure
+         */
+        if (!iasl) {
+            continue;
+        }
+
         err = load_asl(data->tables, sdt);
         asl = normalize_asl(sdt->asl);
 
@@ -431,6 +439,11 @@ static void test_acpi_asl(test_data *data)
         g_string_free(asl, true);
         g_string_free(exp_asl, true);
     }
+    if (!iasl && !all_tables_match) {
+        fprintf(stderr, "to see ASL diff between mismatched files install IASL,"
+                " rebuild QEMU from scratch and re-run tests with V=1"
+                " environment variable set");
+    }
     g_assert(all_tables_match);
 
     free_test_data(&exp_data);
@@ -599,7 +612,7 @@ static void test_acpi_one(const char *params, test_data *data)
 
     if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
         dump_aml_files(data, true);
-    } else if (iasl) {
+    } else {
         test_acpi_asl(data);
     }
 
Signature · 1 line
2.18.1
Reviewed-by on v1 2/2
#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] tests: acpi: do not skip tests when IASL is not installed

Quoted 29 lines · Igor Mammedov

tests do binary comparition so we can check tables without IASL. Move IASL condition right before decompilation step and skip it if IASL is not installed.

---
 tests/bios-tables-test.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
tests/bios-tables-test.c +8 -0
index 13bd166b81..a356ac3489 100644
@@ -389,6 +389,14 @@ static void test_acpi_asl(test_data *data)
         all_tables_match = all_tables_match &&
             test_acpi_find_diff_allowed(exp_sdt);
 
+        /*
+         * don't try to decompile if IASL isn't present, in this case user
+         * will just 'get binary file mismatch' warnings and test failure
+         */
+        if (!iasl) {
+            continue;
+        }
+
         err = load_asl(data->tables, sdt);
         asl = normalize_asl(sdt->asl);
 

tests/bios-tables-test.c static void test_acpi_asl(test_data *data) · line 445

Quoted 7 lines
tests/bios-tables-test.c +4 -0
@@ -431,6 +439,11 @@ static void test_acpi_asl(test_data *data)
         g_string_free(asl, true);
         g_string_free(exp_asl, true);
     }
+    if (!iasl && !all_tables_match) {
+        fprintf(stderr, "to see ASL diff between mismatched files install IASL,"
+                " rebuild QEMU from scratch and re-run tests with V=1"
+                " environment variable set");

I guess remember Thomas asked to use g_printerr() instead of fprintf() in tests/*.c.

Anyway,

Quoted 14 lines
tests/bios-tables-test.c +2 -1
+    }
     g_assert(all_tables_match);
 
     free_test_data(&exp_data);
@@ -599,7 +612,7 @@ static void test_acpi_one(const char *params, test_data *data)
 
     if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
         dump_aml_files(data, true);
-    } else if (iasl) {
+    } else {
         test_acpi_asl(data);
     }
 
#6 lore raw

Re: [Qemu-devel] [PATCH 2/2] tests: acpi: do not skip tests when IASL is not installed

Quoted 29 lines · On Thu, 4 Jul 2019 11:33:19 +0200 Philippe Mathieu-Daudé <[email protected]>…
Quoted 28 lines · Igor Mammedov

tests do binary comparition so we can check tables without IASL. Move IASL condition right before decompilation step and skip it if IASL is not installed.

---
 tests/bios-tables-test.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
tests/bios-tables-test.c +8 -0
index 13bd166b81..a356ac3489 100644
@@ -389,6 +389,14 @@ static void test_acpi_asl(test_data *data)
         all_tables_match = all_tables_match &&
             test_acpi_find_diff_allowed(exp_sdt);
 
+        /*
+         * don't try to decompile if IASL isn't present, in this case user
+         * will just 'get binary file mismatch' warnings and test failure
+         */
+        if (!iasl) {
+            continue;
+        }
+
         err = load_asl(data->tables, sdt);
         asl = normalize_asl(sdt->asl);
 
Quoted 10 lines

tests/bios-tables-test.c static void test_acpi_asl(test_data *data) · line 445

Quoted 8 lines
tests/bios-tables-test.c +4 -0
@@ -431,6 +439,11 @@ static void test_acpi_asl(test_data *data)
         g_string_free(asl, true);
         g_string_free(exp_asl, true);
     }
+    if (!iasl && !all_tables_match) {
+        fprintf(stderr, "to see ASL diff between mismatched files install IASL,"
+                " rebuild QEMU from scratch and re-run tests with V=1"
+                " environment variable set");  

I guess remember Thomas asked to use g_printerr() instead of fprintf()

whole file uses fprintf().
I'd rather send extra patch on top that consistently changes test to g_printerr()

Quoted 4 lines

in tests/*.c.

Anyway,

Thanks!

Quoted 16 lines
Quoted 15 lines
tests/bios-tables-test.c +2 -1
+    }
     g_assert(all_tables_match);
 
     free_test_data(&exp_data);
@@ -599,7 +612,7 @@ static void test_acpi_one(const char *params, test_data *data)
 
     if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
         dump_aml_files(data, true);
-    } else if (iasl) {
+    } else {
         test_acpi_asl(data);
     }
 
Reviewed-by on v1 2/2
#7 lore raw

Re: [Qemu-devel] [PATCH 2/2] tests: acpi: do not skip tests when IASL is not installed

In reply to Igor Mammedov

Hi,

Quoted 1 line · Igor Mammedov

tests do binary comparition so we can check tables without

comparison

Quoted 41 lines

IASL. Move IASL condition right before decompilation step and skip it if IASL is not installed.

---
 tests/bios-tables-test.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
tests/bios-tables-test.c +13 -0
index 13bd166b81..a356ac3489 100644
@@ -389,6 +389,14 @@ static void test_acpi_asl(test_data *data)
         all_tables_match = all_tables_match &&
             test_acpi_find_diff_allowed(exp_sdt);
 
+        /*
+         * don't try to decompile if IASL isn't present, in this case user
+         * will just 'get binary file mismatch' warnings and test failure
+         */
+        if (!iasl) {
+            continue;
+        }
+
         err = load_asl(data->tables, sdt);
         asl = normalize_asl(sdt->asl);
 
@@ -431,6 +439,11 @@ static void test_acpi_asl(test_data *data)
         g_string_free(asl, true);
         g_string_free(exp_asl, true);
     }
+    if (!iasl && !all_tables_match) {
+        fprintf(stderr, "to see ASL diff between mismatched files install IASL,"
+                " rebuild QEMU from scratch and re-run tests with V=1"
+                " environment variable set");
+    }
     g_assert(all_tables_match);
 
     free_test_data(&exp_data);

tests/bios-tables-test.c static void test_acpi_one(const char *params, test_data *data) · line 618

Quoted 8 lines
tests/bios-tables-test.c +1 -1
@@ -599,7 +612,7 @@ static void test_acpi_one(const char *params, test_data *data)
 
     if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
         dump_aml_files(data, true);
-    } else if (iasl) {
+    } else {
         test_acpi_asl(data);
     }
 

Thanks

Eric

#8 lore raw

PATCH v2 2/2 tests: acpi: do not skip tests when IASL is not installed

In reply to Igor Mammedov

tests do binary comparision so we can check tables without IASL. Move IASL condition right before decompilation step and skip it if IASL is not installed.

---
v2:
- fix typo in commit message
Eric Auger <[email protected]>

 tests/bios-tables-test.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
tests/bios-tables-test.c +14 -1
index 13bd166b81..a356ac3489 100644
@@ -389,6 +389,14 @@ static void test_acpi_asl(test_data *data)
         all_tables_match = all_tables_match &&
             test_acpi_find_diff_allowed(exp_sdt);
 
+        /*
+         *  don't try to decompile if IASL isn't present, in this case user
+         * will just 'get binary file mismatch' warnings and test failure
+         */
+        if (!iasl) {
+            continue;
+        }
+
         err = load_asl(data->tables, sdt);
         asl = normalize_asl(sdt->asl);
 
@@ -431,6 +439,11 @@ static void test_acpi_asl(test_data *data)
         g_string_free(asl, true);
         g_string_free(exp_asl, true);
     }
+    if (!iasl && !all_tables_match) {
+        fprintf(stderr, "to see ASL diff between mismatched files install IASL,"
+                " rebuild QEMU from scratch and re-run tests with V=1"
+                " environment variable set");
+    }
     g_assert(all_tables_match);
 
     free_test_data(&exp_data);
@@ -599,7 +612,7 @@ static void test_acpi_one(const char *params, test_data *data)
 
     if (getenv(ACPI_REBUILD_EXPECTED_AML)) {
         dump_aml_files(data, true);
-    } else if (iasl) {
+    } else {
         test_acpi_asl(data);
     }
 
Signature · 1 line
2.18.1
#9 lore raw
In reply to Igor Mammedov
Quoted 4 lines · Igor Mammedov

series should help to make tests more reproducable and not depend on IASL being installed. IASL will be required only is user needs to get textual diff of mismatching files.

I like this very much but pls send v3 with both patches so I can apply it easily.

Quoted 9 lines

Igor Mammedov (2):
tests: acpi: do not require IASL for dumping AML blobs
tests: acpi: do not skip tests when IASL is not installed

 tests/bios-tables-test.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
Signature · 1 line
2.18.1