-
Notifications
You must be signed in to change notification settings - Fork 57
Refactor tests to actually run and not exit silently as well as add new one for data-dir parameter #200
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
Refactor tests to actually run and not exit silently as well as add new one for data-dir parameter #200
Conversation
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
|
|
||
| using namespace rta::util; | ||
|
|
||
| std::string convert_linux_path_to_windows_path( const std::string &path ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplifies tests related to path parsing.
| /// For example, {"--list-cameras"} or {"--list-illuminants", "--verbose"}. | ||
| /// | ||
| /// @return std::string containing the captured stdout output from the rawtoaces execution | ||
| std::string run_rawtoaces_command( const std::vector<std::string> &args ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've discovered that not all tests were running previouslu, because of the exit(0) inside parse_parameters.
tests/test_image_converter.cpp
Outdated
| std::string run_rawtoaces_command( const std::vector<std::string> &args ) | ||
| { | ||
| // Build the command line - from build/tests/ to build/src/rawtoaces/ | ||
| std::string command = "../src/rawtoaces/rawtoaces"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ ] TODO: deal with windows
| OIIO_CHECK_EQUAL( paths[0], "/usr/local/share/rawtoaces/data" ); | ||
| OIIO_CHECK_EQUAL( paths[1], "/usr/local/include/rawtoaces/data" ); | ||
| #else | ||
| #ifdef WIN32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simpler then #if !defined( WIN32 ) && !defined( WIN64 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you've made sure that you don't need to check for WIN64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you assumed wrong. I believe it was just a crap AI code that thought that would be the way to say "If UNIX like OS" 🤷
| } | ||
|
|
||
| /// Tests convert_linux_path_to_windows_path utility function | ||
| void test_convert_linux_path_to_windows_path() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a bit meta. testing testing utility. otherwise how do I know it works 🤷🏻♂️
tests/test_image_converter.cpp
Outdated
| lines[0], | ||
| "Spectral sensitivity data is available for the following cameras:" ); | ||
| OIIO_CHECK_EQUAL( lines[1], "Mamiya / Mamiya 7" ); | ||
| OIIO_CHECK_EQUAL( lines[2], "Canon / EOS R6" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much simpler assertion then confoluted previously
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (42.85%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #200 +/- ##
==========================================
+ Coverage 71.33% 72.27% +0.93%
==========================================
Files 10 10
Lines 2348 2348
Branches 311 311
==========================================
+ Hits 1675 1697 +22
+ Misses 673 651 -22
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
tests/test_image_converter.cpp
Outdated
| #endif | ||
|
|
||
| #include "../src/rawtoaces_util/rawtoaces_util_priv.h" | ||
| #include <rawtoaces/image_converter.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's merge conflict artifact. to be corrected.
tests/test_image_converter.cpp
Outdated
| OIIO_CHECK_EQUAL( exit_status, 0 ); | ||
| #else | ||
| // Unix implementation using popen | ||
| FILE *pipe = popen( command.c_str(), "r" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code seems identical, can't we just set up a macro holding either popen or _popen; same for pclose
tests/test_image_converter.cpp
Outdated
| */ | ||
| #ifdef WIN32 | ||
| void set_env_var( const char *name, const char *value ) | ||
| void set_env_var( std::string name, std::string value ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use const ref
antond-weta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Signed-off-by: Aleksandr Motsjonov <[email protected]>
|
|
||
| // Get exit status and validate | ||
| int exit_status = platform_pclose( pipe ); | ||
| OIIO_CHECK_EQUAL( exit_status, 0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as an aside...
I'm glad you find OIIO's little unittest library helpful!
We make the unittest.h header available in case it's of use to others (as it is here), but we don't really consider it a supported part of the OIIO public APIs, so I can't promise that we'll be careful to never do anything that might break your downstream usage.
I think it's fine for you to copy it and rename to R2A_CHECK_FOO so that you aren't directly dependent on the version you get from OIIO, and aren't brittle to any future changes made to these macros on the OIIO side. That also would allow you to customize them on your end to your particular taste or use cases.
That's the approach that OpenColorIO did many years ago.
No description provided.