|
5 | 5 | #include <iostream> |
6 | 6 | #include <tuple> |
7 | 7 | #include <vector> |
8 | | -#include <Windows.h> |
9 | 8 |
|
10 | 9 | // Inludes common necessary includes for development using depthai library |
11 | 10 | #include "depthai/depthai.hpp" |
@@ -115,9 +114,7 @@ TEST_CASE("Multiple devices created and destroyed in parallel") { |
115 | 114 | availableDevices = dai::Device::getAllAvailableDevices(); |
116 | 115 | this_thread::sleep_for(500ms); |
117 | 116 | } while(availableDevices.size() <= 1 && steady_clock::now() - t1 <= 3s); |
118 | | - //REQUIRE(!availableDevices.empty()); |
119 | | - if(availableDevices.empty()) throw std::runtime_error("No devices found"); |
120 | | - if(availableDevices.size() != 3) throw std::runtime_error("All devices not found"); |
| 117 | + REQUIRE(availableDevices.size() >= 2); |
121 | 118 |
|
122 | 119 | // preallocate to avoid reallocation/move |
123 | 120 | threads.reserve(availableDevices.size()); |
@@ -166,11 +163,18 @@ TEST_CASE("Multiple devices created and destroyed in parallel") { |
166 | 163 | device = make_shared<dai::Device>(pipeline, selectedDevice, dai::UsbSpeed::SUPER); |
167 | 164 | } |
168 | 165 | catch(const std::exception& e) { |
169 | | - DebugBreak(); |
170 | | - cout << "Failed to create device: " << e.what() << endl; |
| 166 | + FAIL_CHECK("Fail construct Device() with " << selectedDevice.toString() << " " << e.what()); |
| 167 | + continue; |
| 168 | + } |
| 169 | + |
| 170 | + // Call RPC |
| 171 | + try { |
| 172 | + cout << "MXID: " << device->getMxId() << endl; |
| 173 | + } |
| 174 | + catch(const std::exception& e) { |
| 175 | + FAIL_CHECK("Fail Device::getMxId() with " << selectedDevice.toString() << " " << e.what()); |
171 | 176 | continue; |
172 | 177 | } |
173 | | - cout << "MXID: " << device->getMxId() << endl; |
174 | 178 |
|
175 | 179 | // Create queue callbacks for color and depth |
176 | 180 | if(COLOR_THRESHOLD > 0) { |
@@ -203,6 +207,7 @@ TEST_CASE("Multiple devices created and destroyed in parallel") { |
203 | 207 | }); |
204 | 208 | } else { |
205 | 209 | } |
| 210 | + SUCCEED("Successful Device with " << selectedDevice.toString()); |
206 | 211 | } |
207 | 212 | }); |
208 | 213 | } |
@@ -257,9 +262,9 @@ TEST_CASE("Device APIs after Device::close()") { |
257 | 262 | device->close(); |
258 | 263 |
|
259 | 264 | // Validate Device API behaviors |
260 | | - CHECK_THROWS(std::ignore = device->getMxId()); |
261 | | - CHECK_THROWS(device->setXLinkChunkSize(1024)); |
| 265 | + CHECK_THROWS_AS(std::ignore = device->getMxId(), std::system_error); |
| 266 | + CHECK_THROWS_AS(device->setXLinkChunkSize(1024), std::system_error); |
| 267 | + CHECK_THROWS_AS(std::ignore = device->readCalibration(), std::system_error); |
262 | 268 | CHECK_NOTHROW(std::ignore = device->getDeviceInfo().name); |
263 | 269 | CHECK_NOTHROW(device->setLogOutputLevel(dai::LogLevel::WARN)); |
264 | | - CHECK_NOTHROW(std::ignore = device->readCalibration()); |
265 | 270 | } |
0 commit comments