From 3f4524a309f305c5b0218de82a36217653eb5256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 3 Sep 2003 16:33:14 +0000 Subject: [PATCH] Improved the test application: it now accepts a test disk image as first parameter (else it falls back to the old behaviour, trying to open /boot/home/tmp/test-file-device). Also fixed the hackish busy loop to at least snooze() a bit (so that it doesn't use all your CPU energy while debugging a partitioning module :-)). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4475 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../disk_device_manager/DiskDeviceManagerTest.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/tests/kernel/core/disk_device_manager/DiskDeviceManagerTest.cpp b/src/tests/kernel/core/disk_device_manager/DiskDeviceManagerTest.cpp index f0837126f2..1ff1d9081b 100644 --- a/src/tests/kernel/core/disk_device_manager/DiskDeviceManagerTest.cpp +++ b/src/tests/kernel/core/disk_device_manager/DiskDeviceManagerTest.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -16,21 +17,30 @@ const char *kTestFileDevice = "/boot/home/tmp/test-file-device"; // main int -main() +main(int argc, char **argv) { + const char *testFileDevice = kTestFileDevice; + + if (argc > 1) + testFileDevice = argv[1]; + KDiskDeviceManager::CreateDefault(); KDiskDeviceManager *manager = KDiskDeviceManager::Default(); manager->InitialDeviceScan(); - partition_id id = manager->CreateFileDevice(kTestFileDevice); + partition_id id = manager->CreateFileDevice(testFileDevice); if (id < B_OK) printf("creating the file device failed: %s\n", strerror(id)); + // wait for scanning jobs to finish + // (that's hopefully a hack :-)) for (;;) { if (ManagerLocker locker = manager) { if (manager->CountJobs() == 0) break; } + snooze(50000); } + // print devices for (int32 cookie = 0; KDiskDevice *device = manager->RegisterNextDevice(&cookie); ) {