diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-09-25 04:26:40 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-09-25 04:26:40 +0000 |
commit | b9b7f896c0989ace786c4764b1af88925c7291ec (patch) | |
tree | 2bcadd6fe6334c8cc80e05117061eeaa08e57ff4 /tools/regression/pthread/unwind/Test.cpp | |
parent | 2aedc66f1220dcc147eceb6cfe800aea0d722adf (diff) | |
download | FreeBSD-src-b9b7f896c0989ace786c4764b1af88925c7291ec.zip FreeBSD-src-b9b7f896c0989ace786c4764b1af88925c7291ec.tar.gz |
Add test cases for stack unwinding.
Diffstat (limited to 'tools/regression/pthread/unwind/Test.cpp')
-rw-r--r-- | tools/regression/pthread/unwind/Test.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/regression/pthread/unwind/Test.cpp b/tools/regression/pthread/unwind/Test.cpp new file mode 100644 index 0000000..9322def --- /dev/null +++ b/tools/regression/pthread/unwind/Test.cpp @@ -0,0 +1,37 @@ +/* $FreeBSD$ */ + +int destructed; +int destructed2; + +class Test { +public: + Test() { printf("Test::Test()\n"); } + ~Test() { printf("Test::~Test()\n"); destructed = 1; } +}; + +void +cleanup_handler(void *arg) +{ + destructed2 = 1; + printf("%s()\n", __func__); +} + +void +check_destruct(void) +{ + if (!destructed) + printf("Bug, object destructor is not called\n"); + else + printf("OK\n"); +} + +void +check_destruct2(void) +{ + if (!destructed) + printf("Bug, object destructor is not called\n"); + else if (!destructed2) + printf("Bug, cleanup handler is not called\n"); + else + printf("OK\n"); +} |