Skip to content

Commit

Permalink
refine test asserts+logs; remove Windows requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
diablodale committed Apr 15, 2023
1 parent 22e486b commit 319a647
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions tests/src/multiple_devices_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <iostream>
#include <tuple>
#include <vector>
#include <Windows.h>

// Inludes common necessary includes for development using depthai library
#include "depthai/depthai.hpp"
Expand Down Expand Up @@ -115,9 +114,7 @@ TEST_CASE("Multiple devices created and destroyed in parallel") {
availableDevices = dai::Device::getAllAvailableDevices();
this_thread::sleep_for(500ms);
} while(availableDevices.size() <= 1 && steady_clock::now() - t1 <= 3s);
//REQUIRE(!availableDevices.empty());
if(availableDevices.empty()) throw std::runtime_error("No devices found");
if(availableDevices.size() != 3) throw std::runtime_error("All devices not found");
REQUIRE(availableDevices.size() >= 2);

// preallocate to avoid reallocation/move
threads.reserve(availableDevices.size());
Expand Down Expand Up @@ -166,11 +163,18 @@ TEST_CASE("Multiple devices created and destroyed in parallel") {
device = make_shared<dai::Device>(pipeline, selectedDevice, dai::UsbSpeed::SUPER);
}
catch(const std::exception& e) {
DebugBreak();
cout << "Failed to create device: " << e.what() << endl;
FAIL_CHECK("Fail construct Device() with " << selectedDevice.toString() << " " << e.what());
continue;
}

// Call RPC
try {
cout << "MXID: " << device->getMxId() << endl;
}
catch(const std::exception& e) {
FAIL_CHECK("Fail Device::getMxId() with " << selectedDevice.toString() << " " << e.what());
continue;
}
cout << "MXID: " << device->getMxId() << endl;

// Create queue callbacks for color and depth
if(COLOR_THRESHOLD > 0) {
Expand Down Expand Up @@ -203,6 +207,7 @@ TEST_CASE("Multiple devices created and destroyed in parallel") {
});
} else {
}
SUCCEED("Successful Device with " << selectedDevice.toString());
}
});
}
Expand Down Expand Up @@ -257,9 +262,9 @@ TEST_CASE("Device APIs after Device::close()") {
device->close();

// Validate Device API behaviors
CHECK_THROWS(std::ignore = device->getMxId());
CHECK_THROWS(device->setXLinkChunkSize(1024));
CHECK_THROWS_AS(std::ignore = device->getMxId(), std::system_error);
CHECK_THROWS_AS(device->setXLinkChunkSize(1024), std::system_error);
CHECK_THROWS_AS(std::ignore = device->readCalibration(), std::system_error);
CHECK_NOTHROW(std::ignore = device->getDeviceInfo().name);
CHECK_NOTHROW(device->setLogOutputLevel(dai::LogLevel::WARN));
CHECK_NOTHROW(std::ignore = device->readCalibration());
}

0 comments on commit 319a647

Please sign in to comment.