log_to_callback + unit-tests - #5584
Merged
Merged
Conversation
* Travis "Linux - cpp" build is now "Linux - cpp -static" and uses static (non-shared; BUILD_SHARED_LIBS is off) compilation * Added unit-testing mechanism: * Any test-*.cpp (and, in future, test-*.py, etc.) under unit-tests/ is a unit-test * Tests can be nested inside directories * Each test creates its own project (in Visual Studio under Unit-Tests, with same nested structure) and thus its own executable * A script (unit-tests/run-unit-tests.py) runs all unit-tests and exits with status 1 or 0 * Unit-tests can be specifically shared or static * Unit-tests are now run in Travis, in both shared and static builds * BUILD_SHARED_LIBS is now a compiler definition, too * Added rs2::log_to_callback, rs2_log_to_callback, rs2_log_to_callback_cpp * Minimum level can be set for a callback (e.g., warnings and above) * Added RS2_LOG_SEVERITY_ALL, same as _DEBUG, so it's easier to say "log all messages" * Logging to file now flushes immediately after each message (down from every 10 messages) mostly so unit-testing works better) * 21 unit-tests under unit-tests/log/
dorodnic
reviewed
Jan 6, 2020
dorodnic
left a comment
Contributor
There was a problem hiding this comment.
Very nice, I have some questions on the python stuff
| /* Return the number of lines in a file */ | ||
| size_t count_lines( char const* filename ) | ||
| { | ||
| FILE* pFile = fopen( filename, "r" ); |
Contributor
There was a problem hiding this comment.
Why like this and not c++ style?
- removed rs2_string and any related functions - rs2_build_log_message -> rs2_get_full_log_message; messages are only built when first called - C-style log callbacks now accept a void* argument - restored original file-flush behavior; unit-tests now flush before checking files - restored original realsense-viewer behavior (no callback logging for now)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.