Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libpthread before_start_one_thread is not racy onl...
details: https://anonhg.NetBSD.org/src/rev/0c29389588a8
branches: trunk
changeset: 756536:0c29389588a8
user: jmmv <jmmv%NetBSD.org@localhost>
date: Wed Jul 21 17:23:08 2010 +0000
description:
before_start_one_thread is not racy only in amd64; my confusion. Mark it
as an xfail everywhere and, while doing so, make the test longer so that
we trigger the failure all the time -- of course, being a race this may
still happen but the chances should be pretty low.
diffstat:
tests/lib/libpthread/t_sem.c | 29 ++++++++++++++---------------
1 files changed, 14 insertions(+), 15 deletions(-)
diffs (81 lines):
diff -r 2ced3a8a0f20 -r 0c29389588a8 tests/lib/libpthread/t_sem.c
--- a/tests/lib/libpthread/t_sem.c Wed Jul 21 15:35:39 2010 +0000
+++ b/tests/lib/libpthread/t_sem.c Wed Jul 21 17:23:08 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sem.c,v 1.3 2010/07/19 10:31:46 jmmv Exp $ */
+/* $NetBSD: t_sem.c,v 1.4 2010/07/21 17:23:08 jmmv Exp $ */
/*
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2010\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sem.c,v 1.3 2010/07/19 10:31:46 jmmv Exp $");
+__RCSID("$NetBSD: t_sem.c,v 1.4 2010/07/21 17:23:08 jmmv Exp $");
#include <errno.h>
#include <fcntl.h>
@@ -233,7 +233,7 @@
int i;
printf("Entering loop\n");
- for (i = 0; i < 10; ) {
+ for (i = 0; i < 500; ) {
if ((i & 1) != 0) {
ATF_REQUIRE(sem_wait(&sem) != -1);
} else {
@@ -244,7 +244,7 @@
}
}
printf("%s: %d\n", __func__, i);
- alarm_ms(100);
+ alarm_ms(5);
i++;
}
@@ -259,7 +259,7 @@
SEM_REQUIRE(sem_init(&sem, 0, 0));
ATF_REQUIRE(SIG_ERR != signal(SIGALRM, sighandler));
- alarm_ms(100);
+ alarm_ms(5);
if (use_pthread) {
PTHREAD_REQUIRE(pthread_create(&t, NULL, threadfunc, NULL));
@@ -274,7 +274,7 @@
{
atf_tc_set_md_var(tc, "descr", "Checks using semaphores without any "
"thread running");
- atf_tc_set_md_var(tc, "timeout", "20");
+ atf_tc_set_md_var(tc, "timeout", "40");
}
ATF_TC_BODY(before_start_no_threads, tc)
{
@@ -286,18 +286,17 @@
{
atf_tc_set_md_var(tc, "descr", "Checks using semaphores before "
"starting one thread");
- atf_tc_set_md_var(tc, "timeout", "20");
+ atf_tc_set_md_var(tc, "timeout", "40");
}
ATF_TC_BODY(before_start_one_thread, tc)
{
- if (strcmp("amd64", atf_config_get("atf_arch")) == 0) {
- /* TODO(jmmv): This really is a race condition test. However,
- * we cannot yet mark it as such because ATF does not provide
- * such functionality. Let's just mark it as an unconditional
- * expected timeout as I haven't got it to pass any single
- * time. */
- atf_tc_expect_timeout("Race condition detected");
- }
+ /* TODO(jmmv): This really is a race condition test. However, we can't
+ * yet mark it as such because ATF does not provide such functionality.
+ * Let's just mark it as an unconditional expected timeout as I haven't
+ * got it to pass any single time. */
+ atf_tc_expect_timeout("Race condition; it is probably unsafe to call "
+ "sem_post from a signal handler when using the pthread version");
+
before_start_test(true);
}
Home |
Main Index |
Thread Index |
Old Index