[PATCH libaio 25/28] harness: fix read into PROT_WRITE mmap test
authorJeff Moyer <jmoyer@redhat.com>
Tue, 13 Aug 2019 19:30:05 +0000 (15:30 -0400)
committerGuillem Jover <guillem@debian.org>
Thu, 24 Dec 2020 14:41:17 +0000 (14:41 +0000)
This test has been broken forever.  Fix it up to perform an
aio_read using the result of a regular read as the expected
return code.

Reported-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name 0025-harness-fix-read-into-PROT_WRITE-mmap-test.patch

harness/cases/5.t

index 2b4b4bb44cc2d18a21b736630d9f911693b4e884..7d675624262474971f230f982b92bb1bc742c917 100644 (file)
@@ -40,14 +40,14 @@ int test_main(void)
        buf = mmap(0, page_size, PROT_WRITE, MAP_SHARED, rwfd, 0);
        assert(buf != (char *)-1);
 
-       status |= attempt_rw(rwfd, buf, SIZE,  0,  READ, SIZE);
-
        /* Whether PROT_WRITE is readable is arch-dependent.  So compare
         * against read result. */
        res = read(rwfd, buf, SIZE);
        if (res < 0)
                res = -errno;
-       status |= attempt_rw(rwfd, buf, SIZE,  0, WRITE, res);
+       status |= attempt_rw(rwfd, buf, SIZE,  0,  READ, res);
+
+       status |= attempt_rw(rwfd, buf, SIZE,  0, WRITE, SIZE);
 
        return status;
 }