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

Return code from the application is not reflected in errorlevel #166

Open
XinePan opened this issue May 28, 2024 · 9 comments
Open

Return code from the application is not reflected in errorlevel #166

XinePan opened this issue May 28, 2024 · 9 comments

Comments

@XinePan
Copy link

XinePan commented May 28, 2024

First capture

Tutorial02_Cube.exe --capture_path ./ --golden_image_mode capture --capture_name cube -w 640 -h 480 -m d3d11

Then Edit the dump image
Then compare

Tutorial02_Cube.exe --capture_path ./ --golden_image_mode compare --capture_name cube -w 640 -h 480 -m d3d11

But it worked when I debug with visual studio
image

@TheMostDiligent
Copy link
Contributor

Can you please clarify what exactly does not work?

@XinePan
Copy link
Author

XinePan commented May 29, 2024

When I run

Tutorial02_Cube.exe --capture_path C:/Users/xin.pan/source/repos/DiligentEngine/cmake_build/DiligentSamples/Tutorials/Tutorial02_Cube/Debug --golden_image_mode compare --capture_name cube -w 640 -h 480 -m d3d11

I get the exitcode 0. And there is no information indicating whether the result was a success or a failure.
In fact, it will be fail, because the golden image has been modify.
But when I debug with visual studio, set Tutorial02_Cube as startup project and set Debugging commad arguments

--capture_path C:/Users/xin.pan/source/repos/DiligentEngine/cmake_build/DiligentSamples/Tutorials/Tutorial02_Cube/Debug --golden_image_mode compare --capture_name cube -w 640 -h 480 -m d3d11

Then I got the info about compare fail with the golden and exit code 10
image
image

Maybe I use the wrong cmd to compare, pls tell me the right. Thx.

1 similar comment
@XinePan
Copy link
Author

XinePan commented May 29, 2024

When I run

Tutorial02_Cube.exe --capture_path C:/Users/xin.pan/source/repos/DiligentEngine/cmake_build/DiligentSamples/Tutorials/Tutorial02_Cube/Debug --golden_image_mode compare --capture_name cube -w 640 -h 480 -m d3d11

I get the exitcode 0. And there is no information indicating whether the result was a success or a failure.
In fact, it will be fail, because the golden image has been modify.
But when I debug with visual studio, set Tutorial02_Cube as startup project and set Debugging commad arguments

--capture_path C:/Users/xin.pan/source/repos/DiligentEngine/cmake_build/DiligentSamples/Tutorials/Tutorial02_Cube/Debug --golden_image_mode compare --capture_name cube -w 640 -h 480 -m d3d11

Then I got the info about compare fail with the golden and exit code 10
image
image

Maybe I use the wrong cmd to compare, pls tell me the right. Thx.

@TheMostDiligent
Copy link
Contributor

I can reproduce the problem too - when I run the command, I see the return code is 0.
However, when I put the same command into a bat file and ran it, the return code was correct.
To be honest, I have no idea what is going on. Windows bash has always been a mystery to me.

@XinePan
Copy link
Author

XinePan commented May 31, 2024

I'm not very familiar too. It seems that should give the exit code to quit-message. It work here.

   if (GoldenImgMode != NativeAppBase::GoldenImageMode::None)
    {
        g_pTheApp->Update(0, 0);
        g_pTheApp->Render();
        // Dear imgui windows that don't have initial size are not rendered in the first frame,
        // see https://github.com/ocornut/imgui/issues/2949
        g_pTheApp->Update(0, 0);
        g_pTheApp->Render();
        g_pTheApp->Present();
        auto ExitCode = g_pTheApp->GetExitCode();
        g_pTheApp.reset();
        PostQuitMessage(ExitCode);
        return ExitCode;
    }

@TheMostDiligent
Copy link
Contributor

I tried that, but it does not seem to make any difference.
The PostQuitMessage does not define the exit code, the code is still what is returned by the main function.
Why it is not picked up by the bash, I don't know really.

@XinePan
Copy link
Author

XinePan commented Jun 4, 2024

I don’t know either. Close this issue?

@TheMostDiligent
Copy link
Contributor

Let's keep it open - this is really strange behavior. Maybe we will find solution at some point later.

@TheMostDiligent TheMostDiligent changed the title It does not work when compare with golden Return code from the application is not reflected in errorlevel Jun 4, 2024
@XinePan
Copy link
Author

XinePan commented Jul 18, 2024

Can you try these?

index 69b6e0c..ef58563 100644
--- a/NativeApp/src/Win32/WinMain.cpp
+++ b/NativeApp/src/Win32/WinMain.cpp
@@ -40,6 +40,10 @@
 #include "StringTools.hpp"
 #include "Timer.hpp"

+// clang-format off
+#pragma comment( linker, "/subsystem:\"console\" /entry:\"WinMainCRTStartup\"")
+// clang-format on
+
 using namespace Diligent;

 std::unique_ptr<NativeAppBase> g_pTheApp;```

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

No branches or pull requests

2 participants