From 7a9de5d194f5ca338e4b35651b426cc2aec39cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 2 Jun 2006 14:16:51 +0000 Subject: [PATCH] Added simple test for the BNode::Lock()/Unlock() feature. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17698 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/system/kernel/Jamfile | 5 +++ src/tests/system/kernel/lock_node_test.cpp | 36 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/tests/system/kernel/lock_node_test.cpp diff --git a/src/tests/system/kernel/Jamfile b/src/tests/system/kernel/Jamfile index 2a68ba76cf..b6472bf292 100644 --- a/src/tests/system/kernel/Jamfile +++ b/src/tests/system/kernel/Jamfile @@ -63,6 +63,11 @@ SimpleTest yield_test : yield_test.cpp ; +SimpleTest lock_node_test : + lock_node_test.cpp + : be + ; + SubInclude HAIKU_TOP src tests system kernel cache ; #SubInclude HAIKU_TOP src tests system kernel disk_device_manager ; SubInclude HAIKU_TOP src tests system kernel util ; diff --git a/src/tests/system/kernel/lock_node_test.cpp b/src/tests/system/kernel/lock_node_test.cpp new file mode 100644 index 0000000000..82d7a4c91b --- /dev/null +++ b/src/tests/system/kernel/lock_node_test.cpp @@ -0,0 +1,36 @@ +#include + +#include +#include + + +int +main(int argc, char **argv) +{ + if (argc != 2) { + fprintf(stderr, "usage: lock_node \n"); + return 1; + } + + BNode node; + status_t status = node.SetTo(argv[1]); + if (status != B_OK) { + fprintf(stderr, "lock_node: could not open \"%s\": %s\n", argv[1], strerror(status)); + return 1; + } + + status = node.Lock(); + if (status != B_OK) { + fprintf(stderr, "lock_node: could not lock \"%s\": %s\n", argv[1], strerror(status)); + return 1; + } + + puts("press to continue..."); + char a[5]; + fgets(a, 5, stdin); + + node.Unlock(); + node.Unset(); + return 0; +} +