wsd/LOOLWSD.cpp |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

New commits:
commit eb8a9f9b832b45b1a2800b54e94070ac5e739892
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Mar 23 21:08:00 2020 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Tue Mar 24 11:13:46 2020 +0100

    Use random sub-jail paths when unit testing.
    
    Potentially cleaning up jails used by other WSD's breaks parallel
    unit testing quite badly.
    
    Change-Id: I159b87cc36648beb40eea0e363f924eefdf6ebca
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90942
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index aa6b9766b..9c040a8fd 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -3391,8 +3391,18 @@ int LOOLWSD::innerMain()
         LOG_FTL("Missing --childroot option");
         throw MissingOptionException("childroot");
     }
-    else if (ChildRoot[ChildRoot.size() - 1] != '/')
-        ChildRoot += '/';
+    else
+    {
+        if (ChildRoot[ChildRoot.size() - 1] != '/')
+            ChildRoot += '/';
+
+        // create a custom sub-path for parallelized unit tests.
+        if (UnitBase::isUnitTesting())
+        {
+            ChildRoot += Util::rng::getHardRandomHexString(8) + "/";
+            LOG_TRC("Creating sub-childroot: of " + ChildRoot);
+        }
+    }
 
     FileUtil::registerFileSystemForDiskSpaceChecks(ChildRoot);
 
@@ -3602,6 +3612,11 @@ int LOOLWSD::innerMain()
         LOG_INF("Removing jail [" << path << "].");
         FileUtil::removeFile(path, true);
     }
+    if (UnitBase::isUnitTesting())
+    {
+        LOG_TRC("Removing sub-childroot: of " + ChildRoot);
+        FileUtil::removeFile(ChildRoot, true);
+    }
 #endif // !MOBILEAPP
 
     return EX_OK;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to