Skip to content

Conversation

@soswow
Copy link
Contributor

@soswow soswow commented Sep 22, 2025

No description provided.

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 )
Copy link
Contributor Author

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 )
Copy link
Contributor Author

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.

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";
Copy link
Contributor Author

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
Copy link
Contributor Author

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 )

Copy link
Contributor

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

Copy link
Contributor Author

@soswow soswow Sep 23, 2025

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()
Copy link
Contributor Author

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 🤷🏻‍♂️

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" );
Copy link
Contributor Author

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

@codecov-commenter
Copy link

codecov-commenter commented Sep 22, 2025

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.27%. Comparing base (f2192c3) to head (f4992a7).

Files with missing lines Patch % Lines
src/rawtoaces_util/image_converter.cpp 42.85% 4 Missing ⚠️

❌ 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     
Files with missing lines Coverage Δ
src/rawtoaces_util/image_converter.cpp 54.11% <42.85%> (+1.98%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f2192c3...f4992a7. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
Signed-off-by: Aleksandr Motsjonov <[email protected]>
#endif

#include "../src/rawtoaces_util/rawtoaces_util_priv.h"
#include <rawtoaces/image_converter.h>
Copy link
Contributor Author

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.

OIIO_CHECK_EQUAL( exit_status, 0 );
#else
// Unix implementation using popen
FILE *pipe = popen( command.c_str(), "r" );
Copy link
Contributor

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

*/
#ifdef WIN32
void set_env_var( const char *name, const char *value )
void set_env_var( std::string name, std::string value )
Copy link
Contributor

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

Copy link
Contributor

@antond-weta antond-weta left a 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 );
Copy link

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.

@antond-weta antond-weta merged commit 4f1a2ce into AcademySoftwareFoundation:main Sep 23, 2025
14 checks passed
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.

4 participants