From af7fec0304ef55d86b1fa1e2597818c5ecb46e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 14 Oct 2009 11:05:30 +0000 Subject: [PATCH] * A small test application that shows that our abort() implementation does not work correctly. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33582 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/system/libroot/posix/Jamfile | 4 +++ src/tests/system/libroot/posix/abort_test.cpp | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/tests/system/libroot/posix/abort_test.cpp diff --git a/src/tests/system/libroot/posix/Jamfile b/src/tests/system/libroot/posix/Jamfile index 07b899e9d9..a1d15d5534 100644 --- a/src/tests/system/libroot/posix/Jamfile +++ b/src/tests/system/libroot/posix/Jamfile @@ -2,6 +2,10 @@ SubDir HAIKU_TOP src tests system libroot posix ; UsePrivateHeaders libroot syslog_daemon ; +SimpleTest abort_test + : abort_test.cpp +; + SimpleTest SyslogTest : SyslogTest.cpp syslog.cpp ; diff --git a/src/tests/system/libroot/posix/abort_test.cpp b/src/tests/system/libroot/posix/abort_test.cpp new file mode 100644 index 0000000000..ad56a60a51 --- /dev/null +++ b/src/tests/system/libroot/posix/abort_test.cpp @@ -0,0 +1,36 @@ +/* + * Copyright 2009, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include + +#include +#include +#include + + +static status_t +abort_thread(void*) +{ + snooze(50000); + abort(); + return 0; +} + + +int +main(int argc, char** argv) +{ + thread_id thread = spawn_thread(&abort_thread, "abort test", + B_NORMAL_PRIORITY, NULL); + resume_thread(thread); + + status_t status = wait_for_thread(thread, NULL); + fprintf(stderr, "abort thread aborted: %s\n", strerror(status)); + + snooze(1000000LL); + fprintf(stderr, "main exiting\n"); + return 0; +}