[Libreoffice-commits] dev-tools.git: 2 commits - test-bugzilla-files/commands_asan.sh test-bugzilla-files/execute_asan.sh test-bugzilla-files/new-control.py test-bugzilla-files/test-bugzilla-files.py

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Dec 22 17:31:39 PST 2014


 test-bugzilla-files/commands_asan.sh       |   16 +++++++
 test-bugzilla-files/execute_asan.sh        |    5 ++
 test-bugzilla-files/new-control.py         |   21 ++++++++--
 test-bugzilla-files/test-bugzilla-files.py |   59 ++++++++++++++++++++++++-----
 4 files changed, 88 insertions(+), 13 deletions(-)

New commits:
commit a580b54fd1ed217eb93840d414cde5075c5103e7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Dec 23 02:26:44 2014 +0100

    also add the control script for asan

diff --git a/test-bugzilla-files/commands_asan.sh b/test-bugzilla-files/commands_asan.sh
new file mode 100755
index 0000000..bc3dc8a
--- /dev/null
+++ b/test-bugzilla-files/commands_asan.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+cd /srv/crashtestdata/
+source config.cfg
+rm tmpdir/* -r
+rm current/* -r
+rm control/* -r
+rm console_*
+cd ~/source/libo-core/
+SHA=`git rev-parse HEAD`
+echo $SHA
+mkdir -p /srv/crashtestdata/logs_asan/$SHA
+
+cd ~/source/dev-tools/test-bugzilla-files/
+python3 new-control.py --asan /srv/crashtestdata/files/ 
+
+cd /srv/crashtestdata/
commit 63a4c91dc798b27a6c8fc5c31cda7ce8c4367f88
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Dec 23 02:26:08 2014 +0100

    add scripts for running asan

diff --git a/test-bugzilla-files/execute_asan.sh b/test-bugzilla-files/execute_asan.sh
new file mode 100755
index 0000000..5e70e29
--- /dev/null
+++ b/test-bugzilla-files/execute_asan.sh
@@ -0,0 +1,5 @@
+dir_name=$(basename $1)
+mkdir /srv/crashtestdata/control/$dir_name
+cd /srv/crashtestdata/control/$dir_name
+TMPDIR=/srv/crashtestdata/tmpdir /srv/crashtestdata/build/instdir/program/python /home/buildslave/source/dev-tools/test-bugzilla-files/test-bugzilla-files.py --asan --soffice=path:/srv/crashtestdata/build/instdir/program/soffice --userdir=file:///home/buildslave/.config/libreoffice_$dir_name/4 $1 2>&1 | tee /srv/crashtestdata/console_$dir_name.log
+rm core*
diff --git a/test-bugzilla-files/new-control.py b/test-bugzilla-files/new-control.py
index a195d39..69dd9c4 100644
--- a/test-bugzilla-files/new-control.py
+++ b/test-bugzilla-files/new-control.py
@@ -44,8 +44,12 @@ def get_tasks(directory, files_per_task):
     print("number of tasks: " + str(len(task_files)))
     return task_files
 
-def execute_task(task_file):
-    subprocess.call("./execute.sh " + task_file, shell=True)
+def execute_task(task_file, asan):
+    print(asan)
+    if asan == 1:
+        subprocess.call("./execute_asan.sh " + task_file + " --asan", shell=True)
+    elif asan == 0:
+        subprocess.call("./execute.sh " + task_file, shell=True)
     time.sleep(1)
 
 def usage():
@@ -56,13 +60,22 @@ def usage():
     print(message.format(program = os.path.basename(sys.argv[0])))
 
 if __name__ == "__main__":
-    opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "directory="])
+    opts, args = getopt.getopt(sys.argv[1:], "hd:a", ["help", "directory=", "asan"])
     print(args)
     print(opts)
     if "-h" in opts or "--help" in opts:
         usage()
         sys.exit()
 
+    asan = 0
+    print(opts[0])
+    print("--asan" in opts[0])
+    if "--asan" in opts[0]:
+        print("yeah")
+        asan = 1
+
+    print(asan)
+
     if len(args) == 0:
         usage()
         sys.exit(1)
@@ -76,7 +89,7 @@ if __name__ == "__main__":
 
     task_size = 100
     with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
-        future_to_task = {executor.submit(execute_task, task_file): task_file for task_file in get_tasks(directory, task_size)}
+        future_to_task = {executor.submit(execute_task, task_file, asan): task_file for task_file in get_tasks(directory, task_size)}
         for future in concurrent.futures.as_completed(future_to_task):
             task = future_to_task[future]
             try:
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index eaee71d..e5245de 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -332,7 +332,7 @@ def writeExportCrash(fileName):
     exportCrash.write(fileName + '\n')
     exportCrash.close()
 
-def exportDoc(xDoc, filterName, validationCommand, filename, connection):
+def exportDoc(xDoc, filterName, validationCommand, filename, connection, timer):
     props = [ ("FilterName", filterName) ]
     saveProps = tuple([mkPropertyValue(name, value) for (name, value) in props])
     extensions = { "calc8": ".ods",
@@ -355,7 +355,7 @@ def exportDoc(xDoc, filterName, validationCommand, filename, connection):
     t = None
     try:
         args = [connection]
-        t = threading.Timer(180, alarm_handler, args)
+        t = threading.Timer(timer.getExportTime(), alarm_handler, args)
         t.start()      
         xDoc.storeToURL(fileURL, saveProps)
     except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
@@ -393,9 +393,12 @@ def exportDoc(xDoc, filterName, validationCommand, filename, connection):
             
 
 class ExportFileTest:
-    def __init__(self, xDoc, filename):
+    def __init__(self, xDoc, filename, enable_validation, timer):
         self.xDoc = xDoc
         self.filename = filename
+        self.enable_validation = enable_validation
+        self.timer = timer
+
     def run(self, connection):
         formats = self.getExportFormats()
         print(formats)
@@ -405,7 +408,7 @@ class ExportFileTest:
             print(format)
             print(filterName)
             if filterName:
-                xExportedDoc = exportDoc(self.xDoc, filterName, validation, self.filename, connection)
+                xExportedDoc = exportDoc(self.xDoc, filterName, validation, self.filename, connection, self.timer)
                 if xExportedDoc:
                     xExportedDoc.close(True)
 
@@ -423,6 +426,9 @@ class ExportFileTest:
         return formats[component]
 
     def getValidationCommand(self, filterName):
+        if self.enable_validation == False:
+            return None
+
         validationCommand = { "calc8" : "java -Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl -Dorg.iso_relax.verifier.VerifierFactoryLoader=com.sun.msv.verifier.jarv.FactoryLoaderImpl -jar /home/buildslave/source/bin/odfvalidator.jar -e",
                             "writer8" : "java -Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl -Dorg.iso_relax.verifier.VerifierFactoryLoader=com.sun.msv.verifier.jarv.FactoryLoaderImpl -jar /home/buildslave/source/bin/odfvalidator.jar -e",
                             "impress8" : "java -Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl -Dorg.iso_relax.verifier.VerifierFactoryLoader=com.sun.msv.verifier.jarv.FactoryLoaderImpl -jar /home/buildslave/source/bin/odfvalidator.jar -e",
@@ -455,8 +461,11 @@ class ExportFileTest:
         return filterNames[format]
 
 class LoadFileTest:
-    def __init__(self, file):
+    def __init__(self, file, enable_validation, timer):
         self.file = file
+        self.enable_validation = enable_validation
+        self.timer = timer
+
     def run(self, xContext, connection):
         print("Loading document: " + self.file)
         t = None
@@ -468,13 +477,13 @@ class LoadFileTest:
             file.close()
             xDoc = None
             args = [connection]
-            t = threading.Timer(60, alarm_handler, args)
+            t = threading.Timer(self.timer.getImportTime(), alarm_handler, args)
             t.start()      
             xDoc = loadFromURL(xContext, url, t)
             print("doc loaded")
             t.cancel()
             if xDoc:
-                exportTest = ExportFileTest(xDoc, self.file)
+                exportTest = ExportFileTest(xDoc, self.file, self.enable_validation, self.timer)
                 exportTest.run(connection)
         except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
             print("caught UnknownPropertyException " + self.file)
@@ -521,6 +530,29 @@ class LoadFileTest:
             print("...done with: " + self.file)
             subprocess.call("rm core*", shell=True)
 
+class NormalTimer:
+    def __init__(self):
+        pass
+
+    def getImportTime(self):
+        return 60
+
+
+    def getExportTime(self):
+        return 180
+
+
+class AsanTimer:
+    def __init__(self):
+        pass
+
+    def getImportTime(self):
+        return 300
+
+    def getExportTime(self):
+        return 900
+
+
 def runLoadFileTests(opts, file_list_name):
     startTime = datetime.datetime.now()
     connection = PersistentConnection(opts)
@@ -530,14 +562,22 @@ def runLoadFileTests(opts, file_list_name):
         files = []
         files.extend(getFiles(file_list_name[0]))
         files.sort()
-        tests.extend( (LoadFileTest(file) for file in files) )
+        asan = "--asan" in opts
+        print(asan)
+        timer = None
+        if asan is True:
+            timer = AsanTimer()
+        else:
+            timer = NormalTimer()
+
+        tests.extend( (LoadFileTest(file, not asan, timer) for file in files) )
         runConnectionTests(connection, simpleInvoke, tests)
     finally:
         connection.kill()
 
 def parseArgs(argv):
     (optlist,args) = getopt.getopt(argv[1:], "hr",
-            ["help", "soffice=", "userdir=", "valgrind"])
+            ["help", "soffice=", "userdir=", "valgrind", "asan"])
 #    print optlist
     return (dict(optlist), args)
 
@@ -549,6 +589,7 @@ def usage():
                    supported methods: 'path', 'connect'
  --userdir=URL     specify user installation directory for 'path' method
  --valgrind        pass --valgrind to soffice for 'path' method
+ --asan            run under asan, don't run export tests
 
  'location' is a pathname, not a URL. 'userdir' is a URL. the 'task_file' parameters should be
   full absolute pathnames, not URLs."""


More information about the Libreoffice-commits mailing list