Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libpthread mutex2/mutex3 are expected to fail on p...



details:   https://anonhg.NetBSD.org/src/rev/8fc2b1194f1e
branches:  trunk
changeset: 762485:8fc2b1194f1e
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Feb 21 21:43:41 2011 +0000

description:
mutex2/mutex3 are expected to fail on powerpc because of
PR port-powerpc/44387.

XXX the ugly sleep at the end is because ATF will mark an un-triggered
race condition (ie, the test passes unexpectedly) as a test failure otherwise.

diffstat:

 tests/lib/libpthread/t_mutex.c |  38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

diffs (105 lines):

diff -r 8063f7b2b15f -r 8fc2b1194f1e tests/lib/libpthread/t_mutex.c
--- a/tests/lib/libpthread/t_mutex.c    Mon Feb 21 20:23:28 2011 +0000
+++ b/tests/lib/libpthread/t_mutex.c    Mon Feb 21 21:43:41 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.3 2011/02/20 14:37:44 jmmv Exp $ */
+/* $NetBSD: t_mutex.c,v 1.4 2011/02/21 21:43:41 riz Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,13 +29,15 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mutex.c,v 1.3 2011/02/20 14:37:44 jmmv Exp $");
+__RCSID("$NetBSD: t_mutex.c,v 1.4 2011/02/21 21:43:41 riz Exp $");
 
 #include <pthread.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 #include <atf-c.h>
+#include <atf-c/config.h>
 
 #include "h_common.h"
 
@@ -116,17 +118,24 @@
 ATF_TC_HEAD(mutex2, tc)
 {
        atf_tc_set_md_var(tc, "descr", "Checks mutexes");
+       atf_tc_set_md_var(tc, "timeout", "40");
 }
 ATF_TC_BODY(mutex2, tc)
 {
+       const char *m_arch;
        int count, count2;
        pthread_t new;
        void *joinval;
 
        printf("1: Mutex-test 2\n");
 
+       m_arch = atf_config_get("atf_arch");
+       if (strcmp(m_arch, "powerpc") == 0) {
+               atf_tc_expect_timeout("PR port-powerpc/44387");
+       }
+
        PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL));
-
+       
        global_x = 0;
        count = count2 = 10000000;
 
@@ -149,6 +158,14 @@
        printf("1: Thread joined. X was %d. Return value (long) was %ld\n",
                global_x, (long)joinval);
        ATF_REQUIRE_EQ(global_x, 20000000);
+
+       /* XXX force a timeout in ppc case since an un-triggered race
+          otherwise looks like a "failure" */
+       if (strcmp(m_arch, "powerpc") == 0) {
+               /* We sleep for longer than the timeout to make ATF not
+                  complain about unexpected success */
+               sleep(41);
+       }
 }
 
 static void *
@@ -172,15 +189,22 @@
 {
        atf_tc_set_md_var(tc, "descr", "Checks mutexes using a static "
            "initializer");
+       atf_tc_set_md_var(tc, "timeout", "40");
 }
 ATF_TC_BODY(mutex3, tc)
 {
+       const char *m_arch;
        int count, count2;
        pthread_t new;
        void *joinval;
 
        printf("1: Mutex-test 3\n");
 
+       m_arch = atf_config_get("atf_arch");
+       if (strcmp(m_arch, "powerpc") == 0) {
+               atf_tc_expect_timeout("PR port-powerpc/44387");
+       }
+
        global_x = 0;
        count = count2 = 10000000;
 
@@ -203,6 +227,14 @@
        printf("1: Thread joined. X was %d. Return value (long) was %ld\n",
                global_x, (long)joinval);
        ATF_REQUIRE_EQ(global_x, 20000000);
+
+       /* XXX force a timeout in ppc case since an un-triggered race
+          otherwise looks like a "failure" */
+       if (strcmp(m_arch, "powerpc") == 0) {
+               /* We sleep for longer than the timeout to make ATF not
+                  complain about unexpected success */
+               sleep(41);
+       }
 }
 
 static void *



Home | Main Index | Thread Index | Old Index