[ros-diffs] [cfinck] 39698: Add a /c option to supply a comment for the web service submission. This can be useful for giving more information about the used build for the test. The necessary changes in testman will follow later :-P

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sat Feb 21 18:02:40 CET 2009


Author: cfinck
Date: Sat Feb 21 20:02:39 2009
New Revision: 39698

URL: http://svn.reactos.org/svn/reactos?rev=39698&view=rev
Log:
Add a /c option to supply a comment for the web service submission.
This can be useful for giving more information about the used build for the test.

The necessary changes in testman will follow later :-P

Modified:
    trunk/rostests/rosautotest/main.c
    trunk/rostests/rosautotest/precomp.h
    trunk/rostests/rosautotest/webservice.c

Modified: trunk/rostests/rosautotest/main.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/main.c?rev=39698&r1=39697&r2=39698&view=diff
==============================================================================
--- trunk/rostests/rosautotest/main.c [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/main.c [iso-8859-1] Sat Feb 21 20:02:39 2009
@@ -73,57 +73,58 @@
     PCHAR UserName = NULL;
     WCHAR ConfigFile[MAX_PATH];
 
-    /* We only need this if the results are going to be submitted */
-    if(!AppOptions.Submit)
-    {
-        ReturnValue = TRUE;
-        goto Cleanup;
-    }
-
-    /* Build the path to the configuration file from the application's path */
-    GetModuleFileNameW(NULL, ConfigFile, MAX_PATH);
-    Length = wcsrchr(ConfigFile, '\\') - ConfigFile;
-    wcscpy(&ConfigFile[Length], L"\\rosautotest.ini");
-
-    /* Check if it exists */
-    if(GetFileAttributesW(ConfigFile) == INVALID_FILE_ATTRIBUTES)
-    {
-        StringOut("Missing \"rosautotest.ini\" configuration file!\n");
-        goto Cleanup;
-    }
-
-    /* Get the required length of the authentication request string */
-    DataLength = sizeof(UserNameProp) - 1;
-    Length = IntGetINIValueA(L"Login", L"UserName", ConfigFile, &UserName);
-
-    if(!Length)
-    {
-        StringOut("UserName is missing in the configuration file\n");
-        goto Cleanup;
-    }
-
-    /* Some characters might need to be escaped and an escaped character takes 3 bytes */
-    DataLength += 3 * Length;
-
-    DataLength += sizeof(PasswordProp) - 1;
-    Length = IntGetINIValueA(L"Login", L"Password", ConfigFile, &Password);
-
-    if(!Length)
-    {
-        StringOut("Password is missing in the configuration file\n");
-        goto Cleanup;
-    }
-
-    DataLength += 3 * Length;
-
-    /* Build the string */
-    AuthenticationRequestString = HeapAlloc(hProcessHeap, 0, DataLength + 1);
-
-    strcpy(AuthenticationRequestString, UserNameProp);
-    EscapeString(&AuthenticationRequestString[strlen(AuthenticationRequestString)], UserName);
-
-    strcat(AuthenticationRequestString, PasswordProp);
-    EscapeString(&AuthenticationRequestString[strlen(AuthenticationRequestString)], Password);
+    /* Most values are only needed if we're going to submit */
+    if(AppOptions.Submit)
+    {
+        /* Build the path to the configuration file from the application's path */
+        GetModuleFileNameW(NULL, ConfigFile, MAX_PATH);
+        Length = wcsrchr(ConfigFile, '\\') - ConfigFile;
+        wcscpy(&ConfigFile[Length], L"\\rosautotest.ini");
+
+        /* Check if it exists */
+        if(GetFileAttributesW(ConfigFile) == INVALID_FILE_ATTRIBUTES)
+        {
+            StringOut("Missing \"rosautotest.ini\" configuration file!\n");
+            goto Cleanup;
+        }
+
+        /* Get the required length of the authentication request string */
+        DataLength = sizeof(UserNameProp) - 1;
+        Length = IntGetINIValueA(L"Login", L"UserName", ConfigFile, &UserName);
+
+        if(!Length)
+        {
+            StringOut("UserName is missing in the configuration file\n");
+            goto Cleanup;
+        }
+
+        /* Some characters might need to be escaped and an escaped character takes 3 bytes */
+        DataLength += 3 * Length;
+
+        DataLength += sizeof(PasswordProp) - 1;
+        Length = IntGetINIValueA(L"Login", L"Password", ConfigFile, &Password);
+
+        if(!Length)
+        {
+            StringOut("Password is missing in the configuration file\n");
+            goto Cleanup;
+        }
+
+        DataLength += 3 * Length;
+
+        /* Build the string */
+        AuthenticationRequestString = HeapAlloc(hProcessHeap, 0, DataLength + 1);
+
+        strcpy(AuthenticationRequestString, UserNameProp);
+        EscapeString(&AuthenticationRequestString[strlen(AuthenticationRequestString)], UserName);
+
+        strcat(AuthenticationRequestString, PasswordProp);
+        EscapeString(&AuthenticationRequestString[strlen(AuthenticationRequestString)], Password);
+
+        /* If we don't have any Comment string yet, try to find one in the INI file */
+        if(!AppOptions.Comment)
+            IntGetINIValueA(L"Submission", L"Comment", ConfigFile, &AppOptions.Comment);
+    }
 
     ReturnValue = TRUE;
 
@@ -235,10 +236,13 @@
     printf("rosautotest - ReactOS Automatic Testing Utility\n");
     printf("Usage: rosautotest [options] [module] [test]\n");
     printf("  options:\n");
-    printf("    /?  - Shows this help\n");
-    printf("    /s  - Shut down the system after finishing the tests\n");
-    printf("    /w  - Submit the results to the webservice\n");
-    printf("          Requires a \"rosautotest.ini\" with valid login data.\n");
+    printf("    /?           - Shows this help\n");
+    printf("    /c <comment> - Specifies the comment to be submitted to the Web Service.\n");
+    printf("                   Skips the comment set in the configuration file (if any).\n");
+    printf("                   Only has an effect when /w is also used.\n");
+    printf("    /s           - Shut down the system after finishing the tests\n");
+    printf("    /w           - Submit the results to the webservice\n");
+    printf("                   Requires a \"rosautotest.ini\" with valid login data.\n");
     printf("\n");
     printf("  module:\n");
     printf("    The module to be tested (i.e. \"advapi32\")\n");
@@ -256,6 +260,7 @@
 wmain(int argc, wchar_t* argv[])
 {
     int ReturnValue = 0;
+    size_t Length;
     UINT i;
 
     hProcessHeap = GetProcessHeap();
@@ -267,6 +272,16 @@
         {
             switch(argv[i][1])
             {
+                case 'c':
+                    ++i;
+
+                    /* Copy the parameter converted to ASCII */
+                    Length = WideCharToMultiByte(CP_ACP, 0, argv[i], -1, NULL, 0, NULL, NULL);
+                    AppOptions.Comment = HeapAlloc(hProcessHeap, 0, Length);
+                    WideCharToMultiByte(CP_ACP, 0, argv[i], -1, AppOptions.Comment, Length, NULL, NULL);
+
+                    break;
+
                 case 's':
                     AppOptions.Shutdown = TRUE;
                     break;
@@ -286,8 +301,6 @@
         }
         else
         {
-            size_t Length;
-
             /* Which parameter is this? */
             if(!AppOptions.Module)
             {
@@ -322,6 +335,9 @@
     OutputDebugStringA("SYSREG_CHECKPOINT:THIRDBOOT_COMPLETE\n");
 
 Cleanup:
+    if(AppOptions.Comment)
+        HeapFree(hProcessHeap, 0, AppOptions.Comment);
+
     if(AppOptions.Module)
         HeapFree(hProcessHeap, 0, AppOptions.Module);
 

Modified: trunk/rostests/rosautotest/precomp.h
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/precomp.h?rev=39698&r1=39697&r2=39698&view=diff
==============================================================================
--- trunk/rostests/rosautotest/precomp.h [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/precomp.h [iso-8859-1] Sat Feb 21 20:02:39 2009
@@ -26,6 +26,7 @@
 {
     BOOL Shutdown;
     BOOL Submit;
+    PCHAR Comment;
     PWSTR Module;
     PCHAR Test;
 }

Modified: trunk/rostests/rosautotest/webservice.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/webservice.c?rev=39698&r1=39697&r2=39698&view=diff
==============================================================================
--- trunk/rostests/rosautotest/webservice.c [iso-8859-1] (original)
+++ trunk/rostests/rosautotest/webservice.c [iso-8859-1] Sat Feb 21 20:02:39 2009
@@ -142,6 +142,7 @@
 GetTestID(TESTTYPES TestType)
 {
     const CHAR GetTestIDAction[] = "gettestid";
+    const CHAR CommentProp[] = "&comment=";
 
     DWORD DataLength;
     PCHAR Data;
@@ -150,6 +151,10 @@
     /* Build the full request string */
     DataLength  = sizeof(ActionProp) - 1 + sizeof(GetTestIDAction) - 1;
     DataLength += strlen(AuthenticationRequestString) + strlen(SystemInfoRequestString);
+
+    if(AppOptions.Comment)
+        DataLength += sizeof(CommentProp) - 1 + strlen(AppOptions.Comment);
+
     DataLength += sizeof(TestTypeProp) - 1;
 
     switch(TestType)
@@ -164,6 +169,13 @@
     strcat(Data, GetTestIDAction);
     strcat(Data, AuthenticationRequestString);
     strcat(Data, SystemInfoRequestString);
+
+    if(AppOptions.Comment)
+    {
+        strcat(Data, CommentProp);
+        strcat(Data, AppOptions.Comment);
+    }
+
     strcat(Data, TestTypeProp);
 
     switch(TestType)



More information about the Ros-diffs mailing list