PERFORCE change 82984 for review
John Baldwin
jhb at FreeBSD.org
Thu Sep 1 20:54:08 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=82984
Change 82984 by jhb at 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
More information about the p4-projects
mailing list