28c28
< __FBSDID("$FreeBSD: user/ngie/more-tests2/tests/sys/posixshm/posixshm_test.c 289437 2015-10-17 03:13:22Z ngie $");
---
> __FBSDID("$FreeBSD: head/tests/sys/posixshm/posixshm_test.c 289441 2015-10-17 04:32:21Z ngie $");
113c113
< atf_tc_fail("shm_open");
---
> atf_tc_fail("shm_open failed; errno=%d", errno);
115c115
< atf_tc_fail("ftruncate");
---
> atf_tc_fail("ftruncate failed; errno=%d", errno);
120c120
< atf_tc_fail("mmap");
---
> atf_tc_fail("mmap failed; errno=%d", errno);
124c124
< atf_tc_fail("munmap");
---
> atf_tc_fail("munmap failed; errno=%d", errno);
139,144c139,140
< if (page == MAP_FAILED) {
< atf_tc_fail("mmap(2)");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page == MAP_FAILED)
> atf_tc_fail("mmap(2) failed; errno=%d", errno);
146,151c142,143
< if (page[0] != '1') {
< atf_tc_fail("missing data");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page[0] != '1')
> atf_tc_fail("missing data ('%c' != '1')", page[0]);
154,158c146,147
< if (munmap(page, getpagesize()) < 0) {
< atf_tc_fail("munmap");
< shm_unlink(test_path);
< return;
< }
---
> if (munmap(page, getpagesize()) < 0)
> atf_tc_fail("munmap failed; errno=%d", errno);
160,164c149,150
< if (shm_unlink(test_path) < 0) {
< atf_tc_fail("shm_unlink");
< return;
< }
<
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
177,181c163,165
< if (fd < 0) {
< atf_tc_fail("shm_open(2)");
< shm_unlink(test_path);
< return;
< }
---
> if (fd < 0)
> atf_tc_fail("shm_open(2) failed; errno=%d", errno);
>
183,188c167,168
< if (page == MAP_FAILED) {
< atf_tc_fail("mmap(2)");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page == MAP_FAILED)
> atf_tc_fail("mmap(2) failed; errno=%d", errno);
190,196c170,171
< if (page[0] != '1') {
< atf_tc_fail("missing data");
< munmap(page, getpagesize());
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page[0] != '1')
> atf_tc_fail("missing data ('%c' != '1')", page[0]);
200c175,176
< shm_unlink(test_path);
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
212,215c188
< if (fd < 0) {
< atf_tc_fail("shm_open");
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno);
220,232c193,194
< if (page != MAP_FAILED) {
< atf_tc_fail("mmap(PROT_WRITE) succeeded");
< munmap(page, getpagesize());
< close(fd);
< shm_unlink(test_path);
< return;
< }
< if (errno != EACCES) {
< atf_tc_fail("mmap");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page != MAP_FAILED)
> atf_tc_fail("mmap(PROT_WRITE) succeeded unexpectedly");
233a196,199
> if (errno != EACCES)
> atf_tc_fail("mmap(PROT_WRITE) didn't fail with EACCES; "
> "errno=%d", errno);
>
235c201,202
< shm_unlink(test_path);
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
246,249c213
< if (fd < 0) {
< atf_tc_fail("shm_open(1)");
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open(1) failed; errno=%d", errno);
252,255c216,217
< if (shm_unlink(test_path) < 0) {
< atf_tc_fail("shm_unlink");
< return;
< }
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, "shm_unlink failed: %d",
> errno);
291,294c253
< if (fd < 0) {
< atf_tc_fail("shm_open");
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno);
339c298
< ATF_REQUIRE_MSG(fd != -1, "shm_open(O_CREAT) failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno);
345c304,305
< shm_unlink("shm_object");
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
358,376c318,323
< if (fd < 0) {
< atf_tc_fail("shm_open(1)");
< return;
< }
< if (ftruncate(fd, 1024) < 0) {
< atf_tc_fail("ftruncate");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(1)");
< close(fd);
< return;
< }
< if (sb.st_size != 1024) {
< atf_tc_fail("size %d != 1024", (int)sb.st_size);
< close(fd);
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open(1) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(ftruncate(fd, 1024) != -1,
> "ftruncate failed; errno=%d", errno);
> ATF_REQUIRE_MSG(fstat(fd, &sb) != -1,
> "fstat(1) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(sb.st_size == 1024, "size %d != 1024", (int)sb.st_size);
381,394c328,332
< if (fd < 0) {
< atf_tc_fail("shm_open(2)");
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(2)");
< close(fd);
< return;
< }
< if (sb.st_size != 0) {
< atf_tc_fail("size after O_TRUNC %d != 0", (int)sb.st_size);
< close(fd);
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open(2) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(fstat(fd, &sb) != -1,
> "fstat(2) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(sb.st_size == 0,
> "size was not 0 after truncation: %d", (int)sb.st_size);
396,399c334,335
< if (shm_unlink(test_path) < 0) {
< atf_tc_fail("shm_unlink");
< return;
< }
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
426c362
< char *page;
---
> char err_buf[1024], *page;
430,449c366,368
< fd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0777);
< if (fd < 0) {
< atf_tc_fail("shm_open");
< return;
< }
< if (ftruncate(fd, getpagesize()) < 0) {
< atf_tc_fail("ftruncate(1)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(1)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize()) {
< atf_tc_fail("first resize failed");
< close(fd);
< return;
< }
---
> fd = shm_open(SHM_ANON, O_CREAT|O_RDWR, 0777);
> if (fd < 0)
> atf_tc_fail("shm_open failed; errno=%d", errno);
450a370,379
> if (ftruncate(fd, getpagesize()) < 0)
> atf_tc_fail("ftruncate(1) failed; errno=%d", errno);
>
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(1) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize())
> atf_tc_fail("first resize failed (%d != %d)",
> (int)sb.st_size, getpagesize());
>
452c381
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
---
> page = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
454c383
< if (page == MAP_FAILED) {
---
> if (page == MAP_FAILED)
456,458d384
< close(fd);
< return;
< }
462,466c388,389
< if (munmap(page, getpagesize()) < 0) {
< atf_tc_fail("munmap(1)");
< close(fd);
< return;
< }
---
> if (munmap(page, getpagesize()) < 0)
> atf_tc_fail("munmap(1) failed; errno=%d", errno);
469,483c392,393
< if (ftruncate(fd, getpagesize() * 2) < 0) {
< atf_tc_fail("ftruncate(2)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(2)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize() * 2) {
< atf_tc_fail("second resize failed");
< close(fd);
< return;
< }
---
> if (ftruncate(fd, getpagesize() * 2) < 0)
> atf_tc_fail("ftruncate(2) failed; errno=%d", errno);
484a395,401
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(2) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize() * 2)
> atf_tc_fail("second resize failed (%d != %d)",
> (int)sb.st_size, getpagesize() * 2);
>
486c403
< page = mmap(0, getpagesize() * 2, PROT_READ | PROT_WRITE, MAP_SHARED,
---
> page = mmap(0, getpagesize() * 2, PROT_READ|PROT_WRITE, MAP_SHARED,
488,492c405,406
< if (page == MAP_FAILED) {
< atf_tc_fail("mmap(2)");
< close(fd);
< return;
< }
---
> if (page == MAP_FAILED)
> atf_tc_fail("mmap(2) failed; errno=%d", errno);
494,498c408,409
< if (page[0] != '1') {
< atf_tc_fail("missing data at 0");
< close(fd);
< return;
< }
---
> if (page[0] != '1')
> atf_tc_fail("'%c' != '1'", page[0]);
504,518c415,416
< if (ftruncate(fd, getpagesize()) < 0) {
< atf_tc_fail("ftruncate(3)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(3)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize()) {
< atf_tc_fail("third resize failed");
< close(fd);
< return;
< }
---
> if (ftruncate(fd, getpagesize()) < 0)
> atf_tc_fail("ftruncate(3) failed; errno=%d", errno);
519a418,424
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(3) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize())
> atf_tc_fail("third resize failed (%d != %d)",
> (int)sb.st_size, getpagesize());
>
525,529c430,431
< if (pid < 0) {
< atf_tc_fail("fork");
< close(fd);
< return;
< }
---
> if (pid == -1)
> atf_tc_fail("fork failed; errno=%d", errno);
549,554c451,455
< if (wait(&status) < 0) {
< atf_tc_fail("wait");
< close(fd);
< return;
< }
< if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGSEGV) {
---
>
> if (wait(&status) < 0)
> atf_tc_fail("wait failed; errno=%d", errno);
>
> if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGSEGV)
556,558d456
< close(fd);
< return;
< }
561,575c459,460
< if (ftruncate(fd, getpagesize() * 2) < 0) {
< atf_tc_fail("ftruncate(4)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(4)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize() * 2) {
< atf_tc_fail("second resize failed");
< close(fd);
< return;
< }
---
> if (ftruncate(fd, getpagesize() * 2) < 0)
> atf_tc_fail("ftruncate(2) failed; errno=%d", errno);
576a462,468
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(2) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize() * 2)
> atf_tc_fail("fourth resize failed (%d != %d)",
> (int)sb.st_size, getpagesize());
>
586,590c478,480
< if (page[getpagesize()] != 0) {
< atf_tc_fail("invalid data at %d", getpagesize());
< close(fd);
< return;
< }
---
> if (page[getpagesize()] != 0)
> atf_tc_fail("invalid data at %d: %x != 0",
> getpagesize(), (int)page[getpagesize()]);
< __FBSDID("$FreeBSD: user/ngie/more-tests2/tests/sys/posixshm/posixshm_test.c 289437 2015-10-17 03:13:22Z ngie $");
---
> __FBSDID("$FreeBSD: head/tests/sys/posixshm/posixshm_test.c 289441 2015-10-17 04:32:21Z ngie $");
113c113
< atf_tc_fail("shm_open");
---
> atf_tc_fail("shm_open failed; errno=%d", errno);
115c115
< atf_tc_fail("ftruncate");
---
> atf_tc_fail("ftruncate failed; errno=%d", errno);
120c120
< atf_tc_fail("mmap");
---
> atf_tc_fail("mmap failed; errno=%d", errno);
124c124
< atf_tc_fail("munmap");
---
> atf_tc_fail("munmap failed; errno=%d", errno);
139,144c139,140
< if (page == MAP_FAILED) {
< atf_tc_fail("mmap(2)");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page == MAP_FAILED)
> atf_tc_fail("mmap(2) failed; errno=%d", errno);
146,151c142,143
< if (page[0] != '1') {
< atf_tc_fail("missing data");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page[0] != '1')
> atf_tc_fail("missing data ('%c' != '1')", page[0]);
154,158c146,147
< if (munmap(page, getpagesize()) < 0) {
< atf_tc_fail("munmap");
< shm_unlink(test_path);
< return;
< }
---
> if (munmap(page, getpagesize()) < 0)
> atf_tc_fail("munmap failed; errno=%d", errno);
160,164c149,150
< if (shm_unlink(test_path) < 0) {
< atf_tc_fail("shm_unlink");
< return;
< }
<
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
177,181c163,165
< if (fd < 0) {
< atf_tc_fail("shm_open(2)");
< shm_unlink(test_path);
< return;
< }
---
> if (fd < 0)
> atf_tc_fail("shm_open(2) failed; errno=%d", errno);
>
183,188c167,168
< if (page == MAP_FAILED) {
< atf_tc_fail("mmap(2)");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page == MAP_FAILED)
> atf_tc_fail("mmap(2) failed; errno=%d", errno);
190,196c170,171
< if (page[0] != '1') {
< atf_tc_fail("missing data");
< munmap(page, getpagesize());
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page[0] != '1')
> atf_tc_fail("missing data ('%c' != '1')", page[0]);
200c175,176
< shm_unlink(test_path);
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
212,215c188
< if (fd < 0) {
< atf_tc_fail("shm_open");
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno);
220,232c193,194
< if (page != MAP_FAILED) {
< atf_tc_fail("mmap(PROT_WRITE) succeeded");
< munmap(page, getpagesize());
< close(fd);
< shm_unlink(test_path);
< return;
< }
< if (errno != EACCES) {
< atf_tc_fail("mmap");
< close(fd);
< shm_unlink(test_path);
< return;
< }
---
> if (page != MAP_FAILED)
> atf_tc_fail("mmap(PROT_WRITE) succeeded unexpectedly");
233a196,199
> if (errno != EACCES)
> atf_tc_fail("mmap(PROT_WRITE) didn't fail with EACCES; "
> "errno=%d", errno);
>
235c201,202
< shm_unlink(test_path);
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
246,249c213
< if (fd < 0) {
< atf_tc_fail("shm_open(1)");
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open(1) failed; errno=%d", errno);
252,255c216,217
< if (shm_unlink(test_path) < 0) {
< atf_tc_fail("shm_unlink");
< return;
< }
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1, "shm_unlink failed: %d",
> errno);
291,294c253
< if (fd < 0) {
< atf_tc_fail("shm_open");
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno);
339c298
< ATF_REQUIRE_MSG(fd != -1, "shm_open(O_CREAT) failed; errno=%d", errno);
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open failed; errno=%d", errno);
345c304,305
< shm_unlink("shm_object");
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
358,376c318,323
< if (fd < 0) {
< atf_tc_fail("shm_open(1)");
< return;
< }
< if (ftruncate(fd, 1024) < 0) {
< atf_tc_fail("ftruncate");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(1)");
< close(fd);
< return;
< }
< if (sb.st_size != 1024) {
< atf_tc_fail("size %d != 1024", (int)sb.st_size);
< close(fd);
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open(1) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(ftruncate(fd, 1024) != -1,
> "ftruncate failed; errno=%d", errno);
> ATF_REQUIRE_MSG(fstat(fd, &sb) != -1,
> "fstat(1) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(sb.st_size == 1024, "size %d != 1024", (int)sb.st_size);
381,394c328,332
< if (fd < 0) {
< atf_tc_fail("shm_open(2)");
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(2)");
< close(fd);
< return;
< }
< if (sb.st_size != 0) {
< atf_tc_fail("size after O_TRUNC %d != 0", (int)sb.st_size);
< close(fd);
< return;
< }
---
> ATF_REQUIRE_MSG(fd >= 0, "shm_open(2) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(fstat(fd, &sb) != -1,
> "fstat(2) failed; errno=%d", errno);
> ATF_REQUIRE_MSG(sb.st_size == 0,
> "size was not 0 after truncation: %d", (int)sb.st_size);
396,399c334,335
< if (shm_unlink(test_path) < 0) {
< atf_tc_fail("shm_unlink");
< return;
< }
---
> ATF_REQUIRE_MSG(shm_unlink(test_path) != -1,
> "shm_unlink failed; errno=%d", errno);
426c362
< char *page;
---
> char err_buf[1024], *page;
430,449c366,368
< fd = shm_open(SHM_ANON, O_CREAT | O_RDWR, 0777);
< if (fd < 0) {
< atf_tc_fail("shm_open");
< return;
< }
< if (ftruncate(fd, getpagesize()) < 0) {
< atf_tc_fail("ftruncate(1)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(1)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize()) {
< atf_tc_fail("first resize failed");
< close(fd);
< return;
< }
---
> fd = shm_open(SHM_ANON, O_CREAT|O_RDWR, 0777);
> if (fd < 0)
> atf_tc_fail("shm_open failed; errno=%d", errno);
450a370,379
> if (ftruncate(fd, getpagesize()) < 0)
> atf_tc_fail("ftruncate(1) failed; errno=%d", errno);
>
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(1) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize())
> atf_tc_fail("first resize failed (%d != %d)",
> (int)sb.st_size, getpagesize());
>
452c381
< page = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_SHARED, fd,
---
> page = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
454c383
< if (page == MAP_FAILED) {
---
> if (page == MAP_FAILED)
456,458d384
< close(fd);
< return;
< }
462,466c388,389
< if (munmap(page, getpagesize()) < 0) {
< atf_tc_fail("munmap(1)");
< close(fd);
< return;
< }
---
> if (munmap(page, getpagesize()) < 0)
> atf_tc_fail("munmap(1) failed; errno=%d", errno);
469,483c392,393
< if (ftruncate(fd, getpagesize() * 2) < 0) {
< atf_tc_fail("ftruncate(2)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(2)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize() * 2) {
< atf_tc_fail("second resize failed");
< close(fd);
< return;
< }
---
> if (ftruncate(fd, getpagesize() * 2) < 0)
> atf_tc_fail("ftruncate(2) failed; errno=%d", errno);
484a395,401
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(2) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize() * 2)
> atf_tc_fail("second resize failed (%d != %d)",
> (int)sb.st_size, getpagesize() * 2);
>
486c403
< page = mmap(0, getpagesize() * 2, PROT_READ | PROT_WRITE, MAP_SHARED,
---
> page = mmap(0, getpagesize() * 2, PROT_READ|PROT_WRITE, MAP_SHARED,
488,492c405,406
< if (page == MAP_FAILED) {
< atf_tc_fail("mmap(2)");
< close(fd);
< return;
< }
---
> if (page == MAP_FAILED)
> atf_tc_fail("mmap(2) failed; errno=%d", errno);
494,498c408,409
< if (page[0] != '1') {
< atf_tc_fail("missing data at 0");
< close(fd);
< return;
< }
---
> if (page[0] != '1')
> atf_tc_fail("'%c' != '1'", page[0]);
504,518c415,416
< if (ftruncate(fd, getpagesize()) < 0) {
< atf_tc_fail("ftruncate(3)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(3)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize()) {
< atf_tc_fail("third resize failed");
< close(fd);
< return;
< }
---
> if (ftruncate(fd, getpagesize()) < 0)
> atf_tc_fail("ftruncate(3) failed; errno=%d", errno);
519a418,424
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(3) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize())
> atf_tc_fail("third resize failed (%d != %d)",
> (int)sb.st_size, getpagesize());
>
525,529c430,431
< if (pid < 0) {
< atf_tc_fail("fork");
< close(fd);
< return;
< }
---
> if (pid == -1)
> atf_tc_fail("fork failed; errno=%d", errno);
549,554c451,455
< if (wait(&status) < 0) {
< atf_tc_fail("wait");
< close(fd);
< return;
< }
< if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGSEGV) {
---
>
> if (wait(&status) < 0)
> atf_tc_fail("wait failed; errno=%d", errno);
>
> if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGSEGV)
556,558d456
< close(fd);
< return;
< }
561,575c459,460
< if (ftruncate(fd, getpagesize() * 2) < 0) {
< atf_tc_fail("ftruncate(4)");
< close(fd);
< return;
< }
< if (fstat(fd, &sb) < 0) {
< atf_tc_fail("fstat(4)");
< close(fd);
< return;
< }
< if (sb.st_size != getpagesize() * 2) {
< atf_tc_fail("second resize failed");
< close(fd);
< return;
< }
---
> if (ftruncate(fd, getpagesize() * 2) < 0)
> atf_tc_fail("ftruncate(2) failed; errno=%d", errno);
576a462,468
> if (fstat(fd, &sb) < 0)
> atf_tc_fail("fstat(2) failed; errno=%d", errno);
>
> if (sb.st_size != getpagesize() * 2)
> atf_tc_fail("fourth resize failed (%d != %d)",
> (int)sb.st_size, getpagesize());
>
586,590c478,480
< if (page[getpagesize()] != 0) {
< atf_tc_fail("invalid data at %d", getpagesize());
< close(fd);
< return;
< }
---
> if (page[getpagesize()] != 0)
> atf_tc_fail("invalid data at %d: %x != 0",
> getpagesize(), (int)page[getpagesize()]);