Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/librt Add expected-fail test for kern/56549
details: https://anonhg.NetBSD.org/src/rev/5ec510a4fa5f
branches: trunk
changeset: 1027651:5ec510a4fa5f
user: wiz <wiz%NetBSD.org@localhost>
date: Tue Dec 14 16:25:11 2021 +0000
description:
Add expected-fail test for kern/56549
consecutive sem_open() calls do not return the same address
diffstat:
tests/lib/librt/t_sem.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diffs (59 lines):
diff -r a6bff5bb2d6a -r 5ec510a4fa5f tests/lib/librt/t_sem.c
--- a/tests/lib/librt/t_sem.c Tue Dec 14 16:22:30 2021 +0000
+++ b/tests/lib/librt/t_sem.c Tue Dec 14 16:25:11 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sem.c,v 1.5 2020/05/14 08:34:19 msaitoh Exp $ */
+/* $NetBSD: t_sem.c,v 1.6 2021/12/14 16:25:11 wiz Exp $ */
/*
* Copyright (c) 2008, 2010, 2019 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2010, 2019\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sem.c,v 1.5 2020/05/14 08:34:19 msaitoh Exp $");
+__RCSID("$NetBSD: t_sem.c,v 1.6 2021/12/14 16:25:11 wiz Exp $");
#include <sys/mman.h>
#include <sys/wait.h>
@@ -313,6 +313,32 @@
(void)sem_unlink("/sem_c");
}
+ATF_TC_WITH_CLEANUP(sem_open_address);
+ATF_TC_HEAD(sem_open_address, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Validate that multiple sem_open calls "
+ "return the same address");
+}
+ATF_TC_BODY(sem_open_address, tc)
+{
+ sem_t *sem, *sem2, *sem3;
+ atf_tc_expect_fail("kern/56549: consecutive sem_open() do not return the same address");
+ sem = sem_open("/sem_d", O_CREAT | O_EXCL, 0777, 0);
+ ATF_REQUIRE(sem != SEM_FAILED);
+ sem2 = sem_open("/sem_d", O_CREAT | O_EXCL, 0777, 0);
+ ATF_REQUIRE(sem2 == SEM_FAILED && errno == EEXIST);
+ sem3 = sem_open("/sem_d", 0);
+ ATF_REQUIRE(sem3 != SEM_FAILED);
+ ATF_REQUIRE(sem == sem3);
+ ATF_REQUIRE_EQ(sem_close(sem3), 0);
+ ATF_REQUIRE_EQ(sem_close(sem), 0);
+ ATF_REQUIRE_EQ(sem_unlink("/sem_d"), 0);
+}
+ATF_TC_CLEANUP(sem_open_address, tc)
+{
+ (void)sem_unlink("/sem_d");
+}
+
ATF_TP_ADD_TCS(tp)
{
@@ -320,6 +346,7 @@
ATF_TP_ADD_TC(tp, child);
ATF_TP_ADD_TC(tp, pshared);
ATF_TP_ADD_TC(tp, invalid_ops);
+ ATF_TP_ADD_TC(tp, sem_open_address);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index