[tools 1/2] testbot/reporttest: Fix the test stubs.

Francois Gouget fgouget at codeweavers.com
Mon Feb 8 20:14:22 CST 2021


Fix the generated source file path and automatically select the dlls or
programs root directory.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

This just fixes the source file path which normally does not matter much 
in these tests. Still this patch makes stubs perfect so there is no 
reason to avoid or suspect them anymore.

 testbot/src/reporttest/report.template |  1 +
 testbot/src/reporttest/reporttest.c    | 19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/testbot/src/reporttest/report.template b/testbot/src/reporttest/report.template
index 8da3d82a6..0a8f08720 100644
--- a/testbot/src/reporttest/report.template
+++ b/testbot/src/reporttest/report.template
@@ -210,6 +210,7 @@ Dll info:
 Test output:
 stub advapi32:cred
 ----- WTBS Simple test patch
+----- Stubs automatically generate a successful dlls or programs test.
 ----- Expected assessement: Success
 
 advapi32:crypt start dlls/advapi32/tests/crypt.c -
diff --git a/testbot/src/reporttest/reporttest.c b/testbot/src/reporttest/reporttest.c
index d2364c94e..67dca248b 100644
--- a/testbot/src/reporttest/reporttest.c
+++ b/testbot/src/reporttest/reporttest.c
@@ -240,6 +240,9 @@ int main(int argc, char** argv)
         }
         else if (strncmp(line, "stub ", 5) == 0)
         {
+            char* root;
+            char* module = line + 5;
+            int dirlen;
             char* unit = strchr(line, ':');
             if (!unit)
             {
@@ -249,12 +252,22 @@ int main(int argc, char** argv)
             }
             *unit = '\0';
             unit++;
-            unit[strlen(unit)-1] = '\0';
-            fprintf(logfile, "%s:%s start fake/%s/%s.c -\n", line+5, unit, line+5, unit);
+            unit[strlen(unit)-1] = '\0'; /* strip the \r */
+
+            dirlen = strlen(module);
+            if (strstr(module, ".exe"))
+            {
+                dirlen -= 4;
+                root = "programs";
+            }
+            else
+                root = strstr(module, ".com") ? "programs" : "dlls";
+
+            fprintf(logfile, "%s:%s start %s/%.*s/tests/%s.c -\n", module, unit, root, dirlen, module, unit);
             fprintf(logfile, "----- A standard successful test unit\n");
             fprintf(logfile, "----- Expected assessment: Success\n");
             fprintf(logfile, "1234:%s: 2 tests executed (0 marked as todo, 0 failures), 0 skipped.\n", unit);
-            fprintf(logfile, "%s:%s:1234 done (0) in 0s\n", line+5, unit);
+            fprintf(logfile, "%s:%s:1234 done (0) in 0s\n", module, unit);
         }
         else
         {
-- 
2.20.1




More information about the wine-devel mailing list