From owner-p4-projects@FreeBSD.ORG Thu Sep 1 20:54:08 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 871BA16A422; Thu, 1 Sep 2005 20:54:07 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 574AA16A435 for ; Thu, 1 Sep 2005 20:54:07 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E186343D53 for ; Thu, 1 Sep 2005 20:54:06 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j81Ks6F1062917 for ; Thu, 1 Sep 2005 20:54:06 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j81Ks6DY062914 for perforce@freebsd.org; Thu, 1 Sep 2005 20:54:06 GMT (envelope-from jhb@freebsd.org) Date: Thu, 1 Sep 2005 20:54:06 GMT Message-Id: <200509012054.j81Ks6DY062914@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 82984 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2005 20:54:08 -0000 http://perforce.freebsd.org/chv.cgi?CH=82984 Change 82984 by jhb@jhb_slimer on 2005/09/01 20:53:46 - Wrap test that depend on witness in #ifdef WITNESS. - Add two new tests to check witness changes in this branch. Affected files ... .. //depot/projects/smpng/sys/modules/crash/crash.c#16 edit Differences ... ==== //depot/projects/smpng/sys/modules/crash/crash.c#16 (text+ko) ==== @@ -82,6 +82,7 @@ /* Events. */ +#ifdef WITNESS static void foo_then_bar(void) { @@ -129,6 +130,7 @@ mtx_unlock(&Giant); } CRASH_EVENT("wakeup then foo then Giant", wakeup_then_foo_then_Giant); +#endif static void upgrade_foo(void) @@ -213,6 +215,7 @@ CRASH_EVENT("assert that foo is slocked while it is xlocked", test_sx_assert_slocked); +#ifdef WITNESS static void test_sx_and_mtx_order(void) { @@ -246,6 +249,7 @@ } CRASH_EVENT("use test1 and test2 mutexes to test witness removal", test_witness_removal); +#endif static void test_try_locks(void) @@ -277,7 +281,7 @@ } CRASH_EVENT("try lock tests including recursion test", test_try_locks); -#if 0 +#ifdef WITNESS static void test_witness_order_funcs(void) { @@ -351,6 +355,35 @@ } CRASH_EVENT("test deep stack backtraces", test_deep_stack_trace); +#ifdef WITNESS +static void +test_thread_exit(void) +{ + + bzero(&test1_mtx, sizeof(test1_mtx)); + mtx_init(&test1_mtx, "test1", NULL, MTX_DEF); + mtx_lock(&test1_mtx); + printf("Locking test1 and then exiting, should get a witness panic.\n"); + kthread_exit(0); +} +CRASH_EVENT("exit a thread while holding a mutex", test_thread_exit); + +static void +test_mtx_then_Giant(void) +{ + + bzero(&test1_mtx, sizeof(test1_mtx)); + mtx_init(&test1_mtx, "test1", NULL, MTX_DEF); + mtx_lock(&test1_mtx); + printf("Locking Giant after test1, should get a LOR.\n"); + mtx_lock(&Giant); + mtx_unlock(&Giant); + mtx_unlock(&test1_mtx); + mtx_destroy(&test1_mtx); +} +CRASH_EVENT("lock test1 mutex and then Giant", test_mtx_then_Giant); +#endif + /* Help event should be last so that it is always event 1. */ static void