Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove static from API (rsutil.h) #9096

Closed

Conversation

Tomertech
Copy link
Contributor

@Tomertech Tomertech commented May 25, 2021

Tracked on: DSO-17046

Still need to be done:

  1. move internal functions implementation from rs.cpp (namely: next_pixel_in_line, is_pixel_in_line, adjust_2D_point_to_boundary) -Done, moved implementation to rsutil.h as inline
  2. create a sub-directory for C unit-test (figure out where, maybe change names) -Done, added both to live-tests
  3. check on Linux (maybe Travis is enough?) Done, passed Travis

@Tomertech Tomertech force-pushed the remove_static_17046 branch 5 times, most recently from 1072e43 to 1d73b87 Compare June 1, 2021 13:48
@Tomertech Tomertech closed this Jun 1, 2021
@Tomertech Tomertech reopened this Jun 1, 2021
@Tomertech Tomertech marked this pull request as ready for review June 1, 2021 15:22
@Tomertech Tomertech closed this Jun 2, 2021
@Tomertech Tomertech reopened this Jun 2, 2021
@Tomertech Tomertech marked this pull request as draft June 2, 2021 05:53
unit-tests/CMakeLists.txt Outdated Show resolved Hide resolved
unit-tests/live-test.cmake Outdated Show resolved Hide resolved
unit-tests/unit-tests-rsutil.cpp Outdated Show resolved Hide resolved
unit-tests/unit-tests-rsutil.cpp Outdated Show resolved Hide resolved
}
}
}
NOEXCEPT_RETURN(, to_pixel, data)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want the other params? (same for other functions... missing args)

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

add_executable(unit-tests-rsutil-c C/unit-tests-rsutil-c.c ../../include/librealsense2/rsutil.h)
include_directories(../C)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this for?

# minimum required cmake version: 3.1.0
cmake_minimum_required(VERSION 3.1.0)

project(unit-tests-rsutil-c)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected:

project(unit-tests-rsutil-c C)

To make is a C compile...
How is this a C compilation otherwise?

project(unit-tests-rsutil-c)

# Save the command line compile commands in the build output
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this for debug? Still needed?


printf("SUCCEED");

return 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 is a failure...

#include <stdio.h>

#ifdef __cplusplus
extern "C" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is supposed to be compiled in C only, I'd expect to see #error here.

@@ -0,0 +1,31 @@
// License: Apache 2.0. See LICENSE file in root directory.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (unit-tests/unit-tests-rsutil.cpp) is a repetition of the C code.

I honestly think a better solution would have been a Python script that calls these functions. No CMakes, no compilation, nothing weird, and it could have been included in LibCI.

{
rs2::context ctx;

if (make_context(SECTION_FROM_TEST_NAME, &ctx))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need a context?
This test isn't live...

@ev-mp ev-mp marked this pull request as ready for review June 10, 2021 10:13
@ev-mp
Copy link
Collaborator

ev-mp commented Jul 21, 2021

Superseded in #9379

@ev-mp ev-mp closed this Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants