Author: cfinck
Date: Sun Mar  1 11:19:30 2015
New Revision: 66516

URL: http://svn.reactos.org/svn/reactos?rev=66516&view=rev
Log:
[ROSAUTOTEST]
- Finish a test run in the database when all tests have successfully been run. 
This got lost during the C++ rewrite of rosautotest in r40147.
- Don't spam the logs with useless OK messages. Only report the web service 
response if an error occurred.

Modified:
    trunk/rostests/rosautotest/CWebService.cpp
    trunk/rostests/rosautotest/CWebService.h
    trunk/rostests/rosautotest/CWineTest.cpp

Modified: trunk/rostests/rosautotest/CWebService.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CWebService.cpp?rev=66516&r1=66515&r2=66516&view=diff
==============================================================================
--- trunk/rostests/rosautotest/CWebService.cpp  [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/CWebService.cpp  [iso-8859-1] Sun Mar  1 
11:19:30 2015
@@ -92,6 +92,38 @@
     Data[DataLength] = 0;
 
     return Data.release();
+}
+
+/**
+* Interface to other classes for finishing this test run
+*
+* @param TestType
+* Constant pointer to a char array containing the test type to be run (i.e. 
"wine")
+*/
+void
+CWebService::Finish(const char* TestType)
+{
+    auto_array_ptr<char> Response;
+    string Data;
+    stringstream ss;
+
+    if (!m_TestID)
+        EXCEPTION("CWebService::Finish was called, but not a single result had 
been submitted!");
+
+    Data = "action=finish";
+    Data += Configuration.GetAuthenticationRequestString();
+    Data += "&testtype=";
+    Data += TestType;
+    Data += "&testid=";
+    Data += m_TestID;
+
+    Response.reset(DoRequest(Data));
+
+    if (strcmp(Response, "OK"))
+    {
+        ss << "When finishing the test run, the server responded:" << endl << 
Response << endl;
+        SSEXCEPTION;
+    }
 }
 
 /**
@@ -206,9 +238,9 @@
 
     Response.reset(DoRequest(Data));
 
-    ss << "The server responded:" << endl << Response << endl;
-    StringOut(ss.str());
-
-    if(strcmp(Response, "OK"))
-        EXCEPTION("Aborted!\n");
-}
+    if (strcmp(Response, "OK"))
+    {
+        ss << "When submitting the result, the server responded:" << endl << 
Response << endl;
+        SSEXCEPTION;
+    }
+}

Modified: trunk/rostests/rosautotest/CWebService.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CWebService.h?rev=66516&r1=66515&r2=66516&view=diff
==============================================================================
--- trunk/rostests/rosautotest/CWebService.h    [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/CWebService.h    [iso-8859-1] Sun Mar  1 
11:19:30 2015
@@ -2,7 +2,7 @@
  * PROJECT:     ReactOS Automatic Testing Utility
  * LICENSE:     GNU GPLv2 or any later version as published by the Free 
Software Foundation
  * PURPOSE:     Class implementing the interface to the "testman" Web Service
- * COPYRIGHT:   Copyright 2009 Colin Finck <co...@reactos.org>
+ * COPYRIGHT:   Copyright 2009-2015 Colin Finck <co...@reactos.org>
  */
 
 class CWebService
@@ -21,5 +21,6 @@
     CWebService();
     ~CWebService();
 
+    void Finish(const char* TestType);
     void Submit(const char* TestType, CTestInfo* TestInfo);
 };

Modified: trunk/rostests/rosautotest/CWineTest.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CWineTest.cpp?rev=66516&r1=66515&r2=66516&view=diff
==============================================================================
--- trunk/rostests/rosautotest/CWineTest.cpp    [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/CWineTest.cpp    [iso-8859-1] Sun Mar  1 
11:19:30 2015
@@ -372,6 +372,10 @@
         StringOut("\n\n");
     }
 
+    /* We're done with all tests. Finish this run */
+    if(Configuration.DoSubmit())
+        WebService->Finish("wine");
+
     /* Restore the original error mode */
     if(!Configuration.IsInteractive())
         SetErrorMode(ErrorMode);


Reply via email to