From cd3931efded057feba2849e234ee39aa152eb3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 22 Nov 2004 17:44:11 +0000 Subject: [PATCH] Added find_directory() test application. Unlike the other tests, it only tests the libroot.so implementation, so it has to be run under Haiku to test its implementation (it only prints out all directories, anyway). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10182 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/libroot/os/FindDirectoryTest.cpp | 31 +++++++++++++++++++ src/tests/kernel/libroot/os/Jamfile | 4 +++ 2 files changed, 35 insertions(+) create mode 100644 src/tests/kernel/libroot/os/FindDirectoryTest.cpp diff --git a/src/tests/kernel/libroot/os/FindDirectoryTest.cpp b/src/tests/kernel/libroot/os/FindDirectoryTest.cpp new file mode 100644 index 0000000000..793f05cdf7 --- /dev/null +++ b/src/tests/kernel/libroot/os/FindDirectoryTest.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2004, François Revol. + * Distributed under the terms of the MIT license. + */ + + +#include +#include + +#include + + +int +main(int argc, char **argv) +{ + dev_t dev = -1; + + if (argc > 1) + dev = dev_for_path(argv[1]); + + for (int32 i = B_DESKTOP_DIRECTORY; i < B_UTILITIES_DIRECTORY; i++) { + char buffer[B_PATH_NAME_LENGTH]; + status_t err = find_directory((directory_which)i, dev, false, buffer, B_PATH_NAME_LENGTH); + if (err) + continue; + + printf("dir[%04ld] = '%s'\n", i, buffer); + } + return 0; +} + diff --git a/src/tests/kernel/libroot/os/Jamfile b/src/tests/kernel/libroot/os/Jamfile index 0bb1e42836..67f3f8d9c4 100644 --- a/src/tests/kernel/libroot/os/Jamfile +++ b/src/tests/kernel/libroot/os/Jamfile @@ -9,6 +9,10 @@ SimpleTest ParseDateTest : ParseDateTest.cpp parsedate.cpp ; +SimpleTest FindDirectoryTest + : FindDirectoryTest.cpp + ; + # Tell Jam where to find these sources SEARCH on [ FGristFiles driver_settings.c