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
This commit is contained in:
Axel Dörfler
2006-06-02 14:16:51 +00:00
parent 8265e1210c
commit 7a9de5d194
2 changed files with 41 additions and 0 deletions
+5
View File
@@ -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 ;
@@ -0,0 +1,36 @@
#include <Node.h>
#include <stdio.h>
#include <string.h>
int
main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "usage: lock_node <file>\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 <enter> to continue...");
char a[5];
fgets(a, 5, stdin);
node.Unlock();
node.Unset();
return 0;
}