diff mbox series

[v4,3/3] tests/qtest/i440fx-test.c: Enable full test of i440FX PAM operation

Message ID 20220630005058.500449-4-lkujaw@member.fsf.org (mailing list archive)
State New, archived
Headers show
Series [v4,1/3] hw/pci-host/pam.c: Fully support RE^WE semantics of i440FX PAM | expand

Commit Message

Lev Kujawski June 30, 2022, 12:50 a.m. UTC
With the prior patch in this series adding support for RE^WE PAM
semantics, the '#ifndef BROKEN' segments of test_i440fx_pam can now be
enabled.

* tests/qtest/i440fx-test.c
test_i440fx_pam:
- Verify that changing attributes does not affect the initial contents
  of the PAM region;
- Verify that that the first new mask is written before switching
  attributes;
- Verify that just PAM_WE works by writing a new mask;
- Switch back to PAM_RE after PAM_WE to read the new mask;
- Tighten logic of the !WE write test because we know what the
  original contents were; and
- Write the last mask before testing for it.

Signed-off-by: Lev Kujawski <lkujaw@member.fsf.org>
---
(v4) Minor tweaks:
- Use spacing to delineate the functionality being tested.
- Ensure that PAM_WE is working by writing a mask within
  that portion.
(v2-v3) No changes

 tests/qtest/i440fx-test.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/tests/qtest/i440fx-test.c b/tests/qtest/i440fx-test.c
index 6d7d4d8d8f..b761ae53cb 100644
--- a/tests/qtest/i440fx-test.c
+++ b/tests/qtest/i440fx-test.c
@@ -229,6 +229,7 @@  static void test_i440fx_pam(gconstpointer opaque)
 
         g_test_message("Checking area 0x%05x..0x%05x",
                        pam_area[i].start, pam_area[i].end);
+
         /* Switch to RE for the area */
         pam_set(dev, i, PAM_RE);
         /* Verify the RAM is all zeros */
@@ -236,33 +237,35 @@  static void test_i440fx_pam(gconstpointer opaque)
 
         /* Switch to WE for the area */
         pam_set(dev, i, PAM_RE | PAM_WE);
+        /* Verify the RAM is still all zeros */
+        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0));
         /* Write out a non-zero mask to the full area */
         write_area(pam_area[i].start, pam_area[i].end, 0x42);
-
-#ifndef BROKEN
-        /* QEMU only supports a limited form of PAM */
+        /* Verify the area contains the new mask */
+        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x42));
 
         /* Switch to !RE for the area */
         pam_set(dev, i, PAM_WE);
         /* Verify the area is not our mask */
         g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x42));
-#endif
-
-        /* Verify the area is our new mask */
-        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x42));
+        /* Write out a new mask */
+        write_area(pam_area[i].start, pam_area[i].end, 0xaa);
+        /* Verify the area is not our new mask */
+        g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0xaa));
 
+        /* Switch to !WE for the area */
+        pam_set(dev, i, PAM_RE);
+        /* Verify the area is the new mask */
+        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0xaa));
         /* Write out a new mask */
         write_area(pam_area[i].start, pam_area[i].end, 0x82);
-
-#ifndef BROKEN
-        /* QEMU only supports a limited form of PAM */
-
-        /* Verify the area is not our mask */
-        g_assert(!verify_area(pam_area[i].start, pam_area[i].end, 0x82));
+        /* Verify the area is not the new mask */
+        g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0xaa));
 
         /* Switch to RE for the area */
         pam_set(dev, i, PAM_RE | PAM_WE);
-#endif
+        /* Write out a new mask again */
+        write_area(pam_area[i].start, pam_area[i].end, 0x82);
         /* Verify the area is our new mask */
         g_assert(verify_area(pam_area[i].start, pam_area[i].end, 0x82));