Skip to content

Commit

Permalink
devcontainer: Add debug target for gtest
Browse files Browse the repository at this point in the history
  • Loading branch information
marcojob committed Nov 11, 2024
1 parent 0fea30d commit d50a29b
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
"ms-vscode.cpptools"
],
"settings": {
"files.hotExit": "off",
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/devcontainer_all_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ main() {
ccache
cmake
curl
gdb
gfortran
git
gnupg
Expand Down
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug test_depth_anything_v2",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/devel/lib/usb_cam/test_depth_anything_v2",
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb", // Use gdb for debugging
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ target_include_directories(${PROJECT_NAME}_node PUBLIC
# Testing
if(BUILD_TESTING)
# Find GTest package
set(CMAKE_BUILD_TYPE Debug)
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})

Expand Down
2 changes: 1 addition & 1 deletion include/usb_cam/learning/depth_anything_v2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ class DepthAnythingV2 : public LearningInterface {
cv::Size _INPUT_SIZE;
};

#endif // DEPTH_ANYTHING_HPP_
#endif // DEPTH_ANYTHING_HPP_
5 changes: 1 addition & 4 deletions src/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,4 @@ LearningInterface::~LearningInterface() {
cudaFree(_stream);
cudaFree(_buffers[0]);
cudaFree(_buffers[1]);

delete[] _input_data;
delete[] _output_data;
}
}
2 changes: 1 addition & 1 deletion src/usb_cam_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class UsbCamNode {
// Run all the networks
for (const auto& net : networks) {
net->set_input(m_image);
if (net->run_inference(1)) {
if (net->predict()) {
net->publish();
}
}
Expand Down
4 changes: 4 additions & 0 deletions test/test_depth_anything_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ TEST_F(TestDepthAnythingV2, TestSetInput) {
ASSERT_NE(input_data, nullptr);
ASSERT_FLOAT_EQ(input_data[0], img.at<cv::Vec3b>(0, 0)[0] / 255.0f);
}

TEST_F(TestDepthAnythingV2, TestPredict) {
depth_anything_v2->predict();
}

0 comments on commit d50a29b

Please sign in to comment.