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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user