Record command line arguments in .qpa file
authorPawel Ksiezopolski <pawel.ksiezopolski@mobica.com>
Tue, 30 Apr 2019 13:24:37 +0000 (15:24 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 22 May 2019 06:43:35 +0000 (02:43 -0400)
Command line parameters are written to .qpa file in sessionInfo section.

Components: Framework

VK-GL-CTS issue: 1666

Change-Id: If8fb1ce85408141362f046c318016039e06e228a

executor/xeBatchResult.hpp
executor/xeTestLogParser.cpp
framework/common/tcuTestLog.cpp
framework/common/tcuTestLog.hpp
framework/platform/tcuMain.cpp
framework/qphelper/qpTestLog.c
framework/qphelper/qpTestLog.h

index f76b61c..52269d9 100644 (file)
@@ -42,6 +42,7 @@ public:
        std::string                     releaseName;
        std::string                     releaseId;
        std::string                     targetName;
+       std::string                     qpaCommandLineParameters;
 
        // Produced by Candy.
        std::string                     candyTargetName;
index 01627c1..0cbe734 100644 (file)
@@ -103,6 +103,8 @@ void TestLogParser::parse (const deUint8* bytes, size_t numBytes)
                                        m_sessionInfo.resultName = value;
                                else if (deStringEqual(attribute, "timestamp"))
                                        m_sessionInfo.timestamp = value;
+                               else if (deStringEqual(attribute, "commandLineParameters"))
+                                       m_sessionInfo.qpaCommandLineParameters = value;
 
                                // \todo [2012-06-09 pyry] What to do with unknown/duplicate attributes? Currently just ignored.
                                break;
index d7ee182..277d896 100644 (file)
@@ -180,8 +180,8 @@ TestLog& SampleBuilder::operator<< (const TestLog::EndSampleToken&)
 
 // TestLog
 
-TestLog::TestLog (const char* fileName, deUint32 flags)
-       : m_log(qpTestLog_createFileLog(fileName, flags))
+TestLog::TestLog (const char* fileName, int argc, char** argv, deUint32 flags)
+       : m_log(qpTestLog_createFileLog(fileName, argc, argv, flags))
 {
        if (!m_log)
                throw ResourceError(std::string("Failed to open test log file '") + fileName + "'");
index fef2dc6..6ba0524 100644 (file)
@@ -102,7 +102,7 @@ public:
        typedef LogNumber<float>                Float;
        typedef LogNumber<deInt64>              Integer;
 
-       explicit                        TestLog                                 (const char* fileName, deUint32 flags = 0);
+       explicit                        TestLog                                 (const char* fileName, int argc = 0, char** argv = DE_NULL, deUint32 flags = 0);
                                                ~TestLog                                (void);
 
        MessageBuilder          operator<<                              (const BeginMessageToken&);
index 5b0ccb0..1641a1c 100644 (file)
@@ -45,7 +45,7 @@ int main (int argc, char** argv)
        {
                tcu::CommandLine                                cmdLine         (argc, argv);
                tcu::DirArchive                                 archive         (".");
-               tcu::TestLog                                    log                     (cmdLine.getLogFileName(), cmdLine.getLogFlags());
+               tcu::TestLog                                    log                     (cmdLine.getLogFileName(), argc-1, argv+1, cmdLine.getLogFlags());
                de::UniquePtr<tcu::Platform>    platform        (createPlatform());
                de::UniquePtr<tcu::App>                 app                     (new tcu::App(*platform, archive, log, cmdLine));
 
index 220b7e9..58e8a8e 100644 (file)
@@ -289,7 +289,7 @@ DE_INLINE void doubleToString (double value, char* buf, size_t bufSize)
        deSprintf(buf, bufSize, "%f", value);
 }
 
-static deBool beginSession (qpTestLog* log)
+static deBool beginSession (qpTestLog* log, int argc, char** argv)
 {
        DE_ASSERT(log && !log->isSessionOpen);
 
@@ -297,6 +297,14 @@ static deBool beginSession (qpTestLog* log)
        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");
@@ -328,7 +336,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, deUint32 flags)
+qpTestLog* qpTestLog_createFileLog (const char* fileName, int argc, char** argv, deUint32 flags)
 {
        qpTestLog* log = (qpTestLog*)deCalloc(sizeof(qpTestLog));
        if (!log)
@@ -371,7 +379,7 @@ qpTestLog* qpTestLog_createFileLog (const char* fileName, deUint32 flags)
                return DE_NULL;
        }
 
-       beginSession(log);
+       beginSession(log, argc, argv);
 
        return log;
 }
index fcf0938..8e2e290 100644 (file)
@@ -188,7 +188,7 @@ typedef struct qpEglConfigInfo_s
 } qpEglConfigInfo;
 
 
-qpTestLog*             qpTestLog_createFileLog                 (const char* fileName, deUint32 flags);
+qpTestLog*             qpTestLog_createFileLog                 (const char* fileName, int argc, char** argv, deUint32 flags);
 void                   qpTestLog_destroy                               (qpTestLog* log);
 
 deBool                 qpTestLog_startCase                             (qpTestLog* log, const char* testCasePath, qpTestCaseType testCaseType);