Add waiver info to log sessionInfo
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Mon, 30 Mar 2020 16:47:30 +0000 (18:47 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Mon, 20 Apr 2020 07:56:32 +0000 (03:56 -0400)
Writing of session info was separated from log constructor.
It is now possible for test package to specify additional
session info content.

Components: Framework, OpenGL, Vulkan

VK-GL-CTS issue: 2222

Affects:
 dEQP-VK.*
 cts-runner

Change-Id: Id03855a72a0690fcac2eaff645abf04893ad80f6

20 files changed:
external/openglcts/modules/common/glcTestPackage.cpp
external/openglcts/modules/runner/glcTestRunner.cpp
external/vulkancts/modules/vulkan/vktBuildPrograms.cpp
external/vulkancts/modules/vulkan/vktTestPackage.cpp
framework/common/tcuCommandLine.cpp
framework/common/tcuCommandLine.hpp
framework/common/tcuTestContext.cpp
framework/common/tcuTestContext.hpp
framework/common/tcuTestHierarchyIterator.cpp
framework/common/tcuTestLog.cpp
framework/common/tcuTestLog.hpp
framework/common/tcuWaiverUtil.cpp
framework/common/tcuWaiverUtil.hpp
framework/platform/android/tcuAndroidTestActivity.cpp
framework/platform/tcuMain.cpp
framework/qphelper/qpTestLog.c
framework/qphelper/qpTestLog.h
modules/gles2/tes2TestPackage.cpp
modules/gles3/tes3TestPackage.cpp
modules/gles31/tes31TestPackage.cpp

index 5d2be56..ca7bb1f 100644 (file)
@@ -71,8 +71,12 @@ void TestPackage::init(void)
                {
                        Context&                                context         = m_packageCtx->getContext();
                        const glu::ContextInfo& contextInfo = context.getContextInfo();
-                       m_waiverMechanism->setup(context.getTestContext().getCommandLine().getWaiverFileName(), m_name,
-                                                                        contextInfo.getString(GL_VENDOR), contextInfo.getString(GL_RENDERER));
+                       std::string                             vendor          = contextInfo.getString(GL_VENDOR);
+                       std::string                             renderer        = contextInfo.getString(GL_RENDERER);
+                       const tcu::CommandLine& commandLine     = context.getTestContext().getCommandLine();
+                       tcu::SessionInfo                sessionInfo     (vendor, renderer, commandLine.getInitialCmdLine());
+                       m_waiverMechanism->setup(commandLine.getWaiverFileName(), m_name, vendor, renderer, sessionInfo);
+                       context.getTestContext().getLog().writeSessionInfo(sessionInfo.get());
                }
        }
        catch (...)
index e5423d8..a151312 100644 (file)
@@ -48,9 +48,11 @@ class RunSession
 public:
        RunSession(tcu::Platform& platform, tcu::Archive& archive, const int numArgs, const char* const* args)
                : m_cmdLine(numArgs, args)
-               , m_log(m_cmdLine.getLogFileName(), (numArgs - 1), (char**)(args + 1), m_cmdLine.getLogFlags())
+               , m_log(m_cmdLine.getLogFileName(), m_cmdLine.getLogFlags())
                , m_app(platform, archive, m_log, m_cmdLine)
        {
+               const std::string sessionInfo = "#sessionInfo commandLineParameters \"";
+               m_log.writeSessionInfo(sessionInfo + m_cmdLine.getInitialCmdLine() + "\"\n");
        }
 
        inline bool iterate(void)
index 5ff16ca..ed76356 100644 (file)
@@ -674,12 +674,14 @@ int main (int argc, const char* argv[])
        try
        {
                tcu::DirArchive                 archive                                 (".");
-               tcu::TestLog                    log                                     (deqpCmdLine.getLogFileName(), (argc - 1), (char **)(argv + 1), deqpCmdLine.getLogFlags());
+               tcu::TestLog                    log                                             (deqpCmdLine.getLogFileName(), deqpCmdLine.getLogFlags());
                tcu::Platform                   platform;
                tcu::TestContext                testCtx                                 (platform, archive, log, deqpCmdLine, DE_NULL);
                vk::SpirvVersion                baselineSpirvVersion    = vk::getBaselineSpirvVersion(cmdLine.getOption<opt::VulkanVersion>());
                vk::SpirvVersion                maxSpirvVersion                 = vk::getMaxSpirvVersionForGlsl(cmdLine.getOption<opt::VulkanVersion>());
 
+               testCtx.writeSessionInfo();
+
                tcu::print("SPIR-V versions: baseline: %s, max supported: %s\n",
                                        getSpirvVersionName(baselineSpirvVersion).c_str(),
                                        getSpirvVersionName(maxSpirvVersion).c_str());
index 3040583..5a3ec6a 100644 (file)
@@ -249,8 +249,15 @@ TestCaseExecutor::TestCaseExecutor (tcu::TestContext& testCtx)
        , m_deviceProperties    (getPhysicalDeviceProperties(m_context))
        , m_instance                    (DE_NULL)
 {
-       m_waiverMechanism.setup(testCtx.getCommandLine().getWaiverFileName(), "dEQP-VK",
-                                                       m_deviceProperties.vendorID, m_deviceProperties.deviceID);
+       tcu::SessionInfo sessionInfo(m_deviceProperties.vendorID,
+                                                                m_deviceProperties.deviceID,
+                                                                testCtx.getCommandLine().getInitialCmdLine());
+       m_waiverMechanism.setup(testCtx.getCommandLine().getWaiverFileName(),
+                                                       "dEQP-VK",
+                                                       m_deviceProperties.vendorID,
+                                                       m_deviceProperties.deviceID,
+                                                       sessionInfo);
+       testCtx.getLog().writeSessionInfo(sessionInfo.get());
 }
 
 TestCaseExecutor::~TestCaseExecutor (void)
index b94b6a5..707718c 100644 (file)
@@ -687,6 +687,18 @@ CommandLine::CommandLine (void)
 CommandLine::CommandLine (int argc, const char* const* argv)
        : m_logFlags    (0)
 {
+       if (argc > 1)
+       {
+               int loop = 1;           // skip application name
+               while (true)
+               {
+                       m_initialCmdLine += std::string(argv[loop++]);
+                       if (loop >= argc)
+                               break;
+                       m_initialCmdLine += " ";
+               }
+       }
+
        if (!parse(argc, argv))
                throw Exception("Failed to parse command line");
 }
@@ -699,6 +711,7 @@ CommandLine::CommandLine (int argc, const char* const* argv)
  * \param cmdLine Full command line string.
  *//*--------------------------------------------------------------------*/
 CommandLine::CommandLine (const std::string& cmdLine)
+       : m_initialCmdLine      (cmdLine)
 {
        if (!parse(cmdLine))
                throw Exception("Failed to parse command line");
@@ -719,6 +732,11 @@ const de::cmdline::CommandLine& CommandLine::getCommandLine (void) const
        return m_cmdLine;
 }
 
+const std::string& CommandLine::getInitialCmdLine(void) const
+{
+       return m_initialCmdLine;
+}
+
 void CommandLine::registerExtendedOptions (de::cmdline::Parser& parser)
 {
        DE_UNREF(parser);
index fbef41d..f5b8f65 100644 (file)
@@ -141,6 +141,8 @@ public:
        bool                                                    parse                                                   (int argc, const char* const* argv);
        bool                                                    parse                                                   (const std::string& cmdLine);
 
+       const std::string&                              getInitialCmdLine                               (void) const;
+
        //! Get log file name (--deqp-log-filename)
        const char*                                             getLogFileName                                  (void) const;
 
@@ -282,6 +284,8 @@ private:
 
        de::cmdline::CommandLine                m_cmdLine;
        deUint32                                                m_logFlags;
+
+       std::string                                             m_initialCmdLine;
 };
 
 } // tcu
index 965d918..94f4f79 100644 (file)
@@ -22,7 +22,7 @@
  *//*--------------------------------------------------------------------*/
 
 #include "tcuTestContext.hpp"
-
+#include "tcuCommandLine.hpp"
 #include "tcuTestLog.hpp"
 
 namespace tcu
@@ -46,6 +46,12 @@ TestContext::TestContext (
        setCurrentArchive(m_rootArchive);
 }
 
+void TestContext::writeSessionInfo(void)
+{
+       const std::string sessionInfo = "#sessionInfo commandLineParameters \"";
+       m_log.writeSessionInfo(sessionInfo + m_cmdLine.getInitialCmdLine() + "\"\n");
+}
+
 void TestContext::touchWatchdog (void)
 {
        if (m_watchDog)
index 0a8bddc..060a261 100644 (file)
@@ -51,6 +51,8 @@ public:
                                                        TestContext                     (Platform& platform, Archive& rootArchive, TestLog& log, const CommandLine& cmdLine, qpWatchDog* watchDog);
                                                        ~TestContext            (void) {}
 
+       void                                    writeSessionInfo        (void);
+
        // API for test cases
        TestLog&                                getLog                          (void)                  { return m_log;                 }
        Archive&                                getArchive                      (void)                  { return *m_curArchive; } //!< \note Do not access in TestNode constructors.
index 1fbb662..5c4ba63 100644 (file)
@@ -64,6 +64,9 @@ void DefaultHierarchyInflater::enterTestPackage (TestPackage* testPackage, vecto
 
        testPackage->init();
        testPackage->getChildren(children);
+
+       // write default session info if it was not done by package
+       m_testCtx.writeSessionInfo();
 }
 
 void DefaultHierarchyInflater::leaveTestPackage (TestPackage* testPackage)
index 3c84ebb..16e2d2d 100644 (file)
@@ -181,25 +181,16 @@ TestLog& SampleBuilder::operator<< (const TestLog::EndSampleToken&)
 
 // TestLog
 
-TestLog::TestLog (const char* fileName, int argc, char** argv, deUint32 flags)
-       : m_log(qpTestLog_createFileLog(fileName, argc, argv, flags))
+TestLog::TestLog (const char* fileName, deUint32 flags)
+       : m_log(qpTestLog_createFileLog(fileName, flags))
 {
        if (!m_log)
                throw ResourceError(std::string("Failed to open test log file '") + fileName + "'");
 }
 
-TestLog::TestLog (const char* fileName, const std::string& cmdLine, deUint32 flags)
+void TestLog::writeSessionInfo(std::string additionalInfo)
 {
-
-       deCommandLine* parsedCmdLine = deCommandLine_parse(cmdLine.c_str());
-       if (!parsedCmdLine)
-               throw std::bad_alloc();
-
-       m_log = qpTestLog_createFileLog(fileName, parsedCmdLine->numArgs, parsedCmdLine->args, flags);
-       deCommandLine_destroy(parsedCmdLine);
-
-       if (!m_log)
-               throw ResourceError(std::string("Failed to open test log file '") + fileName + "'");
+       qpTestLog_beginSession(m_log, additionalInfo.c_str());
 }
 
 TestLog::~TestLog (void)
index 8323a8b..ab08573 100644 (file)
@@ -102,10 +102,11 @@ public:
        typedef LogNumber<float>                Float;
        typedef LogNumber<deInt64>              Integer;
 
-       explicit                        TestLog                                 (const char* fileName, int argc = 0, char** argv = DE_NULL, deUint32 flags = 0);
-       explicit                        TestLog                                 (const char* fileName, const std::string& cmdLine, deUint32 flags = 0);
+       explicit                        TestLog                                 (const char* fileName, deUint32 flags = 0);
                                                ~TestLog                                (void);
 
+       void                            writeSessionInfo                (std::string additionalInfo = "");
+
        MessageBuilder          operator<<                              (const BeginMessageToken&);
        MessageBuilder          message                                 (void);
 
index a35e79d..facaffe 100644 (file)
@@ -25,6 +25,7 @@
 #include <fstream>
 #include <iostream>
 #include <sstream>
+#include <iomanip>
 #include "deString.h"
 #include "deStringUtil.hpp"
 #include "xeXMLParser.hpp"
 namespace tcu
 {
 
+SessionInfo::SessionInfo(deUint32                              vendorId,
+                                                deUint32                               deviceId,
+                                                const std::string&             cmdLine)
+       : m_cmdLine     (cmdLine)
+{
+       m_info << std::hex
+                  << "#sessionInfo vendorID 0x" << vendorId << "\n"
+                  << "#sessionInfo deviceID 0x" << deviceId << "\n";
+}
+
+SessionInfo::SessionInfo(std::string                   vendor,
+                                                std::string                    renderer,
+                                                const std::string&             cmdLine)
+       : m_cmdLine     (cmdLine)
+{
+       m_info << "#sessionInfo vendor \"" << vendor << "\"\n"
+                  << "#sessionInfo renderer \"" << renderer << "\"\n";
+}
+
+std::string SessionInfo::get()
+{
+       if (!m_waiverUrls.empty())
+       {
+               m_info << "#sessionInfo waiverUrls \"" << m_waiverUrls << "\"\n";
+               m_waiverUrls.clear();
+       }
+       if (!m_cmdLine.empty())
+       {
+               m_info << "#sessionInfo commandLineParameters \"" << m_cmdLine << "\"\n";
+               m_cmdLine.clear();
+       }
+       return m_info.str();
+}
+
 // Base class for GL and VK waiver tree builders
 class WaiverTreeBuilder
 {
@@ -45,6 +80,7 @@ public:
                                                                                                                                 const std::string&                             packageName,
                                                                                                                                 const char*                                    vendorTag,
                                                                                                                                 const char*                                    deviceTag,
+                                                                                                                                SessionInfo&                                   sessionInfo,
                                                                                                                                 std::vector<WaiverComponent>&  waiverTree);
 
        virtual                                                         ~WaiverTreeBuilder();
@@ -68,27 +104,27 @@ protected:
 
        // parse waiver.xml and read list of waived tests defined
        // specificly for current device id and current vendor id
-       void                    readWaivedTestsFromXML  (void);
+       void                            readWaivedTestsFromXML  (void);
 
        // use list of paths to build a temporary tree which
        // consists of BuilComponents that help with tree construction
-       void                    buildTreeFromPathList   (void);
+       void                            buildTreeFromPathList   (void);
 
        // use temporary tree to create final tree containing
        // only things that are needed during searches
-       void                    constructFinalTree              (void);
+       void                            constructFinalTree              (void);
 
        // helper methods used to identify if proper waiver for vendor was found
-       virtual bool    matchVendor                             (const std::string& vendor) const = 0;
+       virtual bool            matchVendor                             (const std::string& vendor) const = 0;
 
        // helper methods used after waiver for current vendor was found to check
        // if it is defined also for currend deviceId/renderer
-       virtual bool    matchDevice                             (const std::string& device) const = 0;
+       virtual bool            matchDevice                             (const std::string& device) const = 0;
 
        // helper method used in buildTreeFromPathList; returns index
        // of component having same ancestors as the component specified
        // in the argument or 0 when build tree does not include this component
-       deUint32                findComponentInBuildTree(const std::vector<std::string>& pathComponents, deUint32 index) const;
+       deUint32                        findComponentInBuildTree(const std::vector<std::string>& pathComponents, deUint32 index) const;
 
 private:
        const std::string&                              m_waiverFile;
@@ -101,6 +137,9 @@ private:
        std::vector<std::string>                m_testList;
        std::vector<BuilComponent>              m_buildTree;
 
+       // reference to object containing information about used waivers
+       SessionInfo&                                    m_sessionInfo;
+
        // reference to vector containing final tree
        std::vector<WaiverComponent>&   m_finalTree;
 };
@@ -109,11 +148,13 @@ WaiverTreeBuilder::WaiverTreeBuilder(const std::string&                           waiverFile,
                                                                         const std::string&                             packageName,
                                                                         const char*                                    vendorTag,
                                                                         const char*                                    deviceTag,
+                                                                        SessionInfo&                                   sessionInfo,
                                                                         std::vector<WaiverComponent>&  waiverTree)
        : m_waiverFile          (waiverFile)
        , m_packageName         (packageName)
        , m_vendorTag           (vendorTag)
        , m_deviceTag           (deviceTag)
+       , m_sessionInfo         (sessionInfo)
        , m_finalTree           (waiverTree)
 {
 }
@@ -150,6 +191,7 @@ void WaiverTreeBuilder::readWaivedTestsFromXML()
        bool                                            deviceFound             = false;
        bool                                            scanDevice              = false;
        bool                                            memorizeCase    = false;
+       std::string                                     waiverUrl;
        std::vector<std::string>        waiverTestList;
 
        while (true)
@@ -190,7 +232,13 @@ void WaiverTreeBuilder::readWaivedTestsFromXML()
                        // we found waiver tag, check if it is deffined for current vendor
                        waiverTestList.clear();
                        if (xmlParser.hasAttribute(m_vendorTag))
+                       {
                                vendorFound = matchVendor(xmlParser.getAttribute(m_vendorTag));
+                               // if waiver vendor matches current one then memorize waiver url
+                               // it will be needed when deviceId/renderer will match current one
+                               if (vendorFound)
+                                       waiverUrl = xmlParser.getAttribute("url");
+                       }
                        break;
 
                case xe::xml::ELEMENT_DATA:
@@ -217,9 +265,21 @@ void WaiverTreeBuilder::readWaivedTestsFromXML()
                        scanDevice              = false;
                        if (deStringEqual(elemName, "waiver"))
                        {
-                               // when we found proper waiver we can copy memorized cases
-                               if(vendorFound && deviceFound)
+                               // when we found proper waiver we can copy memorized cases and update waiver info
+                               if (vendorFound && deviceFound)
+                               {
+                                       DE_ASSERT(m_testList.empty() || waiverUrl.empty());
+
+                                       std::string& urls = m_sessionInfo.m_waiverUrls;
                                        m_testList.insert(m_testList.end(), waiverTestList.begin(), waiverTestList.end());
+
+                                       // if m_waiverUrls is not empty then we found another waiver
+                                       // definition that should be applyed for this device; we need to
+                                       // add space to urls attribute to separate new url from previous one
+                                       if (!urls.empty())
+                                               urls.append(" ");
+                                       urls.append(waiverUrl);
+                               }
                                vendorFound = false;
                                deviceFound = false;
                        }
@@ -352,6 +412,7 @@ public:
                                                                                                 const std::string&                             packageName,
                                                                                                 const std::string&                             currentVendor,
                                                                                                 const std::string&                             currentRenderer,
+                                                                                                SessionInfo&                                   sessionInfo,
                                                                                                 std::vector<WaiverComponent>&  waiverTree);
 
        bool                            matchVendor                             (const std::string& vendor) const override;
@@ -367,8 +428,9 @@ GLWaiverTreeBuilder::GLWaiverTreeBuilder(const std::string&                         waiverFile,
                                                                                 const std::string&                             packageName,
                                                                                 const std::string&                             currentVendor,
                                                                                 const std::string&                             currentRenderer,
+                                                                                SessionInfo&                                   sessionInfo,
                                                                                 std::vector<WaiverComponent>&  waiverTree)
-       : WaiverTreeBuilder     (waiverFile, packageName, "vendor", "r", waiverTree)
+       : WaiverTreeBuilder     (waiverFile, packageName, "vendor", "r", sessionInfo, waiverTree)
        , m_currentVendor       (currentVendor)
        , m_currentRenderer     (currentRenderer)
 {
@@ -401,6 +463,7 @@ public:
                                                                                                 const std::string&                             packageName,
                                                                                                 const deUint32                                 currentVendor,
                                                                                                 const deUint32                                 currentRenderer,
+                                                                                                SessionInfo&                                   sessionInfo,
                                                                                                 std::vector<WaiverComponent>&  waiverTree);
 
        bool                            matchVendor                             (const std::string& vendor) const override;
@@ -416,8 +479,9 @@ VKWaiverTreeBuilder::VKWaiverTreeBuilder(const std::string&                         waiverFile,
                                                                                 const std::string&                             packageName,
                                                                                 const deUint32                                 currentVendor,
                                                                                 const deUint32                                 currentRenderer,
+                                                                                SessionInfo&                                   sessionInfo,
                                                                                 std::vector<WaiverComponent>&  waiverTree)
-       : WaiverTreeBuilder(waiverFile, packageName, "vendorId", "d", waiverTree)
+       : WaiverTreeBuilder(waiverFile, packageName, "vendorId", "d", sessionInfo, waiverTree)
        , m_currentVendorId(currentVendor)
        , m_currentDeviceId(currentRenderer)
 {
@@ -433,14 +497,14 @@ bool VKWaiverTreeBuilder::matchDevice(const std::string& device) const
        return (m_currentDeviceId == static_cast<deUint32>(std::stoul(device, 0, 0)));
 }
 
-void WaiverUtil::setup(const std::string waiverFile, std::string packageName, deUint32 vendorId, deUint32 deviceId)
+void WaiverUtil::setup(const std::string waiverFile, std::string packageName, deUint32 vendorId, deUint32 deviceId, SessionInfo& sessionInfo)
 {
-       VKWaiverTreeBuilder(waiverFile, packageName, vendorId, deviceId, m_waiverTree).build();
+       VKWaiverTreeBuilder(waiverFile, packageName, vendorId, deviceId, sessionInfo, m_waiverTree).build();
 }
 
-void WaiverUtil::setup(const std::string waiverFile, std::string packageName, std::string vendor, std::string renderer)
+void WaiverUtil::setup(const std::string waiverFile, std::string packageName, std::string vendor, std::string renderer, SessionInfo& sessionInfo)
 {
-       GLWaiverTreeBuilder(waiverFile, packageName, vendor, renderer, m_waiverTree).build();
+       GLWaiverTreeBuilder(waiverFile, packageName, vendor, renderer, sessionInfo, m_waiverTree).build();
 }
 
 bool WaiverUtil::isOnWaiverList(const std::string& casePath) const
index d59bdfd..7c805d7 100644 (file)
  *//*--------------------------------------------------------------------*/
 
 #include "deDefs.h"
-#include <string>
+#include <sstream>
 #include <vector>
 
 namespace tcu
 {
 
+// Class containing information about session that are printed at the beginning of log.
+class SessionInfo
+{
+public:
+
+                                       SessionInfo             (deUint32                               vendorId,
+                                                                        deUint32                               deviceId,
+                                                                        const std::string&             cmdLine);
+                                       SessionInfo             (std::string                    vendor,
+                                                                        std::string                    renderer,
+                                                                        const std::string&             cmdLine);
+
+       std::string             get                             ();
+
+private:
+
+       // WaiverTreeBuilder fills private fields of this class.
+       friend class WaiverTreeBuilder;
+
+       // String containing urls to gitlab issues
+       // that enable currently used waivers
+       std::string                     m_waiverUrls;
+
+       // String containing command line
+       std::string                     m_cmdLine;
+
+       // Stream containing all info
+       std::stringstream       m_info;
+};
+
+// Class that uses paths to waived tests represented in a form of tree.
+// Main functionality of this class is to quickly test test paths in
+// order to verify if it is on waived tests list that was read from xml.
 class WaiverUtil
 {
 public:
                        WaiverUtil              () = default;
 
-       void    setup                   (const std::string waiverFile, std::string packageName, deUint32 vendorId, deUint32 deviceId);
-       void    setup                   (const std::string waiverFile, std::string packageName, std::string vendor, std::string renderer);
+       void    setup                   (const std::string      waiverFile,
+                                                        std::string            packageName,
+                                                        deUint32                       vendorId,
+                                                        deUint32                       deviceId,
+                                                        SessionInfo&           sessionInfo);
+       void    setup                   (const std::string      waiverFile,
+                                                        std::string            packageName,
+                                                        std::string            vendor,
+                                                        std::string            renderer,
+                                                        SessionInfo&           sessionInfo);
 
        bool    isOnWaiverList  (const std::string& casePath) const;
 
index cfe53cb..10f21ec 100644 (file)
@@ -43,10 +43,12 @@ TestThread::TestThread (NativeActivity& activity, const std::string& cmdLineStri
        , m_cmdLine             (cmdLine)
        , m_platform    (activity)
        , m_archive             (activity.getNativeActivity()->assetManager)
-       , m_log                 (m_cmdLine.getLogFileName(), cmdLineString, m_cmdLine.getLogFlags())
+       , m_log                 (m_cmdLine.getLogFileName(), m_cmdLine.getLogFlags())
        , m_app                 (m_platform, m_archive, m_log, m_cmdLine)
        , m_finished    (false)
 {
+       const std::string sessionInfo = "#sessionInfo commandLineParameters \"";
+       m_log.writeSessionInfo(sessionInfo + cmdLineString + "\"\n");
 }
 
 TestThread::~TestThread (void)
index 57d62e8..ede44b4 100644 (file)
@@ -37,7 +37,7 @@ tcu::Platform* createPlatform (void);
 
 int main (int argc, char** argv)
 {
-    int exitStatus = EXIT_SUCCESS;
+       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).
@@ -48,7 +48,7 @@ int main (int argc, char** argv)
        {
                tcu::CommandLine                                cmdLine         (argc, argv);
                tcu::DirArchive                                 archive         (cmdLine.getArchiveDir());
-               tcu::TestLog                                    log                     (cmdLine.getLogFileName(), argc-1, argv+1, cmdLine.getLogFlags());
+               tcu::TestLog                                    log                     (cmdLine.getLogFileName(), cmdLine.getLogFlags());
                de::UniquePtr<tcu::Platform>    platform        (createPlatform());
                de::UniquePtr<tcu::App>                 app                     (new tcu::App(*platform, archive, log, cmdLine));
 
index 3b1f488..0ffceb9 100644 (file)
@@ -297,40 +297,14 @@ DE_INLINE void doubleToString (double value, char* buf, size_t bufSize)
        deSprintf(buf, bufSize, "%f", value);
 }
 
-static deBool beginSession (qpTestLog* log, int argc, char** argv)
-{
-       DE_ASSERT(log && !log->isSessionOpen);
-
-       /* Write session info. */
-       fprintf(log->outputFile, "#sessionInfo releaseName %s\n", qpGetReleaseName());
-       fprintf(log->outputFile, "#sessionInfo releaseId 0x%08x\n", qpGetReleaseId());
-       fprintf(log->outputFile, "#sessionInfo targetName \"%s\"\n", qpGetTargetName());
-       fprintf(log->outputFile, "#sessionInfo commandLineParameters \"");
-       for (int i = 0; i < argc && argv != NULL; ++i)
-       {
-               fprintf(log->outputFile, "%s", argv[i]);
-               if (i < argc-1)
-                       fprintf(log->outputFile, " ");
-       }
-       fprintf(log->outputFile, "\"\n");
-
-    /* Write out #beginSession. */
-       fprintf(log->outputFile, "#beginSession\n");
-       qpTestLog_flushFile(log);
-
-       log->isSessionOpen = DE_TRUE;
-
-       return DE_TRUE;
-}
-
 static deBool endSession (qpTestLog* log)
 {
        DE_ASSERT(log && log->isSessionOpen);
 
-    /* Make sure xml is flushed. */
-    qpXmlWriter_flush(log->writer);
+       /* Make sure xml is flushed. */
+       qpXmlWriter_flush(log->writer);
 
-    /* Write out #endSession. */
+       /* Write out #endSession. */
        fprintf(log->outputFile, "\n#endSession\n");
        qpTestLog_flushFile(log);
 
@@ -344,7 +318,7 @@ static deBool endSession (qpTestLog* log)
  * \param fileName Name of the file where to put logs
  * \return qpTestLog instance, or DE_NULL if cannot create file
  *//*--------------------------------------------------------------------*/
-qpTestLog* qpTestLog_createFileLog (const char* fileName, int argc, char** argv, deUint32 flags)
+qpTestLog* qpTestLog_createFileLog (const char* fileName, deUint32 flags)
 {
        qpTestLog* log = (qpTestLog*)deCalloc(sizeof(qpTestLog));
        if (!log)
@@ -387,14 +361,42 @@ qpTestLog* qpTestLog_createFileLog (const char* fileName, int argc, char** argv,
                return DE_NULL;
        }
 
-       beginSession(log, argc, argv);
-
        return log;
 }
 
 /*--------------------------------------------------------------------*//*!
+ * \brief Log information about test session
+ * \param log qpTestLog instance
+ * \param additionalSessionInfo string contatining additional sessionInfo data
+ *//*--------------------------------------------------------------------*/
+deBool qpTestLog_beginSession(qpTestLog* log, const char* additionalSessionInfo)
+{
+       DE_ASSERT(log);
+
+       /* Make sure this function is called once*/
+       if (log->isSessionOpen)
+               return DE_TRUE;
+
+       /* Write session info. */
+       fprintf(log->outputFile, "#sessionInfo releaseName %s\n", qpGetReleaseName());
+       fprintf(log->outputFile, "#sessionInfo releaseId 0x%08x\n", qpGetReleaseId());
+       fprintf(log->outputFile, "#sessionInfo targetName \"%s\"\n", qpGetTargetName());
+
+       if (strlen(additionalSessionInfo) > 1)
+               fprintf(log->outputFile, "%s\n", additionalSessionInfo);
+
+       /* Write out #beginSession. */
+       fprintf(log->outputFile, "#beginSession\n");
+       qpTestLog_flushFile(log);
+
+       log->isSessionOpen = DE_TRUE;
+
+       return DE_TRUE;
+}
+
+/*--------------------------------------------------------------------*//*!
  * \brief Destroy a logger instance
- * \param a    qpTestLog instance
+ * \param log qpTestLog instance
  *//*--------------------------------------------------------------------*/
 void qpTestLog_destroy (qpTestLog* log)
 {
index a5c8c6e..76d9693 100644 (file)
@@ -195,7 +195,8 @@ typedef struct qpEglConfigInfo_s
 } qpEglConfigInfo;
 
 
-qpTestLog*             qpTestLog_createFileLog                 (const char* fileName, int argc, char** argv, deUint32 flags);
+qpTestLog*             qpTestLog_createFileLog                 (const char* fileName, deUint32 flags);
+deBool                 qpTestLog_beginSession                  (qpTestLog* log, const char* additionalSessionInfo);
 void                   qpTestLog_destroy                               (qpTestLog* log);
 
 deBool                 qpTestLog_startCase                             (qpTestLog* log, const char* testCasePath, qpTestCaseType testCaseType);
index bab00dc..3b3f2ac 100644 (file)
@@ -146,8 +146,12 @@ void TestPackage::init (void)
                if (m_testCtx.getCommandLine().getRunMode() == tcu::RUNMODE_EXECUTE)
                {
                        const glu::ContextInfo& contextInfo = m_context->getContextInfo();
-                       m_waiverMechanism->setup(m_context->getTestContext().getCommandLine().getWaiverFileName(), m_name,
-                                                                        contextInfo.getString(GL_VENDOR), contextInfo.getString(GL_RENDERER));
+                       std::string                             vendor          = contextInfo.getString(GL_VENDOR);
+                       std::string                             renderer        = contextInfo.getString(GL_RENDERER);
+                       const tcu::CommandLine& commandLine = m_context->getTestContext().getCommandLine();
+                       tcu::SessionInfo                sessionInfo     (vendor, renderer, commandLine.getInitialCmdLine());
+                       m_waiverMechanism->setup(commandLine.getWaiverFileName(), m_name, vendor, renderer, sessionInfo);
+                       m_context->getTestContext().getLog().writeSessionInfo(sessionInfo.get());
                }
 
                // Add main test groups
index 9caafae..ba7e166 100644 (file)
@@ -142,9 +142,13 @@ void TestPackage::init (void)
                // Setup waiver mechanism
                if (m_testCtx.getCommandLine().getRunMode() == tcu::RUNMODE_EXECUTE)
                {
-                       const glu::ContextInfo& contextInfo = m_context->getContextInfo();
-                       m_waiverMechanism->setup(m_context->getTestContext().getCommandLine().getWaiverFileName(), m_name,
-                                                                        contextInfo.getString(GL_VENDOR), contextInfo.getString(GL_RENDERER));
+                       const glu::ContextInfo& contextInfo = m_context->getContextInfo();
+                       std::string                             vendor          = contextInfo.getString(GL_VENDOR);
+                       std::string                             renderer        = contextInfo.getString(GL_RENDERER);
+                       const tcu::CommandLine& commandLine     = m_context->getTestContext().getCommandLine();
+                       tcu::SessionInfo                sessionInfo     (vendor, renderer, commandLine.getInitialCmdLine());
+                       m_waiverMechanism->setup(commandLine.getWaiverFileName(), m_name, vendor, renderer, sessionInfo);
+                       m_context->getTestContext().getLog().writeSessionInfo(sessionInfo.get());
                }
 
                // Add main test groups
index c618795..40aa24e 100644 (file)
@@ -131,10 +131,12 @@ void TestPackage::init (void)
                if (m_testCtx.getCommandLine().getRunMode() == tcu::RUNMODE_EXECUTE)
                {
                        const glu::ContextInfo& contextInfo = m_context->getContextInfo();
-                       m_waiverMechanism->setup(m_context->getTestContext().getCommandLine().getWaiverFileName(),
-                                                                        m_name,
-                                                                        contextInfo.getString(GL_VENDOR),
-                                                                        contextInfo.getString(GL_RENDERER));
+                       std::string                             vendor          = contextInfo.getString(GL_VENDOR);
+                       std::string                             renderer        = contextInfo.getString(GL_RENDERER);
+                       const tcu::CommandLine& commandLine     = m_context->getTestContext().getCommandLine();
+                       tcu::SessionInfo                sessionInfo     (vendor, renderer, commandLine.getInitialCmdLine());
+                       m_waiverMechanism->setup(commandLine.getWaiverFileName(), m_name, vendor, renderer, sessionInfo);
+                       m_context->getTestContext().getLog().writeSessionInfo(sessionInfo.get());
                }
 
                // Add main test groups