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

Fix asserts and build buster in debug build. #930

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,49 @@ jobs:
tar xzf Natron-v${OCIO_CONFIG_VERSION}.tar.gz
mv OpenColorIO-Configs-Natron-v${OCIO_CONFIG_VERSION} OpenColorIO-Configs

- name: Build Unix
- name: Download Plugins
run: |
mkdir build && cd build
cmake ../
mkdir Plugins && cd Plugins
wget https://github.com/NatronGitHub/openfx-io/releases/download/natron_testing/openfx-io-build-ubuntu_22-testing.zip
unzip openfx-io-build-ubuntu_22-testing.zip
cd ..

- name: Build Unix (debug)
run: |
mkdir debug && cd debug
cmake -DCMAKE_BUILD_TYPE=Debug ../
make -j2

- name: Run Unix Tests
id: run-unix-tests
- name: Run Unix Tests (debug)
id: run-unix-tests-debug
# Allow continuing after error so logs can be uploaded.
continue-on-error: true
run: |
cd build
cd debug
OFX_PLUGIN_PATH=$PWD/../Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V

mkdir Plugins && cd Plugins
wget https://github.com/NatronGitHub/openfx-io/releases/download/natron_testing/openfx-io-build-ubuntu_22-testing.zip
unzip openfx-io-build-ubuntu_22-testing.zip
cd ..
- name: Build Unix (release)
run: |
mkdir release && cd release
cmake ../
make -j2

OFX_PLUGIN_PATH=$PWD/Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V
- name: Run Unix Tests (release)
id: run-unix-tests-release
# Allow continuing after error so logs can be uploaded.
continue-on-error: true
run: |
cd release
OFX_PLUGIN_PATH=$PWD/../Plugins OCIO=$PWD/../OpenColorIO-Configs/blender/config.ocio ctest -V

- name: Upload ${{ matrix.os }} Test Log artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }} Test Logs
path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log
path: ${{ github.workspace }}/release/Testing/Temporary/LastTest.log

- name: Check for test failures
if: steps.run-unix-tests.outcome == 'failure'
if: steps.run-unix-tests-debug.outcome == 'failure' || steps.run-unix-tests-release.outcome == 'failure'
run: exit 1

win-test:
Expand Down
16 changes: 10 additions & 6 deletions Engine/EffectInstanceRenderRoI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,17 +737,21 @@ EffectInstance::renderRoI(const RenderRoIArgs & args,
//renderRoIInternal should check the bitmap of 'image' and not downscaledImage!
roi = args.roi.toNewMipmapLevel(args.mipmapLevel, 0, par, rod);

if (frameArgs->tilesSupported && !roi.clipIfOverlaps(upscaledImageBoundsNc)) {
return eRenderRoIRetCodeOk;
if (frameArgs->tilesSupported) {
if (!roi.clipIfOverlaps(upscaledImageBoundsNc)) {
return eRenderRoIRetCodeOk;
}
assert(upscaledImageBoundsNc.contains(roi));
}
assert( upscaledImageBoundsNc.contains(roi));
} else {
roi = args.roi;

if (frameArgs->tilesSupported && !roi.clipIfOverlaps(downscaledImageBoundsNc)) {
return eRenderRoIRetCodeOk;
if (frameArgs->tilesSupported) {
if (!roi.clipIfOverlaps(downscaledImageBoundsNc)) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we avoid side effects in conditions, and either have a const function overlaps(), and do the clip outside of the condition?
I think this clipIfOverlaps() function should be removed from the code, because it is used as a test at many places but also has a dangerous and misleading side effect.
No one expects a condition to modify the variable being tested. See c++ core guideline es.40 https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es40-avoid-complicated-expressions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I take your point and have some ideas on how to rework the clipIfOverlap() call sites so they don't need this type of function in a conditional. Can I defer those changes to a follow-up PR? I'd like to land this and #929 so that Windows and debug builds start working again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Friendly ping. I'd like to land this and #929 so the CI builds start working again. I'm happy to follow up with clipIfOverlap() fixes once the build and tests have been restored.

return eRenderRoIRetCodeOk;
}
assert(downscaledImageBoundsNc.contains(roi));
}
assert(downscaledImageBoundsNc.contains(roi));
}

/*
Expand Down
8 changes: 3 additions & 5 deletions Tests/FileSystemModel_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,8 @@ TEST(FileSystemModelTest, CleanPath) {
expectedOutput = testCase.input;
}
#endif
// Make sure the expectation was actually set to something.
assert(!expectedOutput.isNull());

const auto output = FileSystemModel::cleanPath(input).toStdString();
EXPECT_EQ(expectedOutput, output) << " input '" << testCase.input << "'";
const QString output = FileSystemModel::cleanPath(input);
ASSERT_TRUE(!output.isNull());
EXPECT_EQ(expectedOutput, output.toStdString()) << " input '" << testCase.input << "'";
}
}
Loading