DiligentGraphics / DiligentSamples

Sample projects demonstrating the usage of Diligent Engine
http://diligentgraphics.com/diligent-engine/samples/
Apache License 2.0
320 stars 80 forks source link

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

Open XinePan opened 1 month ago

XinePan commented 1 month ago

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 commented 1 month ago

Can you please clarify what exactly does not work?

XinePan commented 1 month ago

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.

XinePan commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 3 weeks ago

I don’t know either. Close this issue?

TheMostDiligent commented 3 weeks ago

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