Generate a non-zero exit code on test failure
authorPiers Daniell <pdaniell@nvidia.com>
Fri, 6 Sep 2019 18:27:31 +0000 (12:27 -0600)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 17 Oct 2019 08:37:25 +0000 (04:37 -0400)
If there are any failed tests, or the test run was not
compelte, the process will now generate EXIT_FAILURE (1)
instead of EXIT_SUCCESS (0).

Affects:

dEQP-VK.*

Components: Framework

VK-GL-CTS issue: 1982

Change-Id: I061d9a3b6703e1f23c48ce8a31e943744f915c92

framework/platform/tcuMain.cpp

index 1641a1c..f3e0fb4 100644 (file)
@@ -27,6 +27,7 @@
 #include "tcuApp.hpp"
 #include "tcuResource.hpp"
 #include "tcuTestLog.hpp"
+#include "tcuTestSessionExecutor.hpp"
 #include "deUniquePtr.hpp"
 
 #include <cstdio>
@@ -36,6 +37,8 @@ tcu::Platform* createPlatform (void);
 
 int main (int argc, char** argv)
 {
+    int exitStatus = EXIT_SUCCESS;
+
 #if (DE_OS != DE_OS_WIN32)
        // Set stdout to line-buffered mode (will be fully buffered by default if stdout is pipe).
        setvbuf(stdout, DE_NULL, _IOLBF, 4*1024);
@@ -53,7 +56,15 @@ int main (int argc, char** argv)
                for (;;)
                {
                        if (!app->iterate())
+                       {
+                               if (cmdLine.getRunMode() == tcu::RUNMODE_EXECUTE &&
+                                       (!app->getResult().isComplete || app->getResult().numFailed))
+                               {
+                                       exitStatus = EXIT_FAILURE;
+                               }
+
                                break;
+                       }
                }
        }
        catch (const std::exception& e)
@@ -61,5 +72,5 @@ int main (int argc, char** argv)
                tcu::die("%s", e.what());
        }
 
-       return 0;
+       return exitStatus;
 }