Skip to content

Commit 5493e90

Browse files
committed
refine test asserts+logs; remove Windows requirement
1 parent 22e486b commit 5493e90

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

tests/src/multiple_devices_test.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <iostream>
66
#include <tuple>
77
#include <vector>
8-
#include <Windows.h>
98

109
// Inludes common necessary includes for development using depthai library
1110
#include "depthai/depthai.hpp"
@@ -115,9 +114,7 @@ TEST_CASE("Multiple devices created and destroyed in parallel") {
115114
availableDevices = dai::Device::getAllAvailableDevices();
116115
this_thread::sleep_for(500ms);
117116
} 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);
121118

122119
// preallocate to avoid reallocation/move
123120
threads.reserve(availableDevices.size());
@@ -166,11 +163,18 @@ TEST_CASE("Multiple devices created and destroyed in parallel") {
166163
device = make_shared<dai::Device>(pipeline, selectedDevice, dai::UsbSpeed::SUPER);
167164
}
168165
catch(const std::exception& e) {
169-
DebugBreak();
170-
cout << "Failed to create device: " << e.what() << endl;
166+
FAIL_CHECK("Failed to construct Device(" << selectedDevice.mxid << ") " << 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("Failed to device(" << selectedDevice.mxid << ")->getMxId() " << e.what());
171176
continue;
172177
}
173-
cout << "MXID: " << device->getMxId() << endl;
174178

175179
// Create queue callbacks for color and depth
176180
if(COLOR_THRESHOLD > 0) {
@@ -203,6 +207,7 @@ TEST_CASE("Multiple devices created and destroyed in parallel") {
203207
});
204208
} else {
205209
}
210+
SUCCEED("Device behaved as expected");
206211
}
207212
});
208213
}
@@ -257,9 +262,9 @@ TEST_CASE("Device APIs after Device::close()") {
257262
device->close();
258263

259264
// 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);
262268
CHECK_NOTHROW(std::ignore = device->getDeviceInfo().name);
263269
CHECK_NOTHROW(device->setLogOutputLevel(dai::LogLevel::WARN));
264-
CHECK_NOTHROW(std::ignore = device->readCalibration());
265270
}

0 commit comments

Comments
 (0)