You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2020/01/09 17:42:37 UTC

[couchdb] branch feat/improve-javascript-test-reports created (now 698887d)

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a change to branch feat/improve-javascript-test-reports
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 698887d  Include JavaScript JUnit reports in Jenkins

This branch includes the following new commits:

     new a1f44e3  Add a JUnit report to JavaScript tests
     new d97b7a1  Include JavaScript test results in report
     new 26d347c  Generate test results on build failures
     new 77f66b2  Include test reports when uploading logs
     new b13d787  Prevent the elision of `jenkins` in log URLs
     new 698887d  Include JavaScript JUnit reports in Jenkins

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 05/06: Prevent the elision of `jenkins` in log URLs

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feat/improve-javascript-test-reports
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b13d787908fc0a80de1cd61d632eb1b490273be9
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jan 9 11:38:44 2020 -0600

    Prevent the elision of `jenkins` in log URLs
---
 build-aux/logfile-uploader.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build-aux/logfile-uploader.py b/build-aux/logfile-uploader.py
index 6fa56da..148704c 100755
--- a/build-aux/logfile-uploader.py
+++ b/build-aux/logfile-uploader.py
@@ -65,7 +65,7 @@ def build_ci_doc():
         doc["commit"] = os.environ["TRAVIS_COMMIT"]
         doc["repo"] = "https://github.com/" + os.environ["TRAVIS_REPO_SLUG"]
     elif "JENKINS_URL" in os.environ:
-        doc["builder"] = "jenkins"
+        doc["builder"] = "jenk-ins"
         doc["build_id"] = os.environ["BUILD_NUMBER"]
         doc["url"] = os.environ["BUILD_URL"]
         doc["branch"] = os.environ["BRANCH_NAME"]


[couchdb] 04/06: Include test reports when uploading logs

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feat/improve-javascript-test-reports
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 77f66b2b2cfd5bd6e67d6aa490aea4740a2750be
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jan 9 11:41:54 2020 -0600

    Include test reports when uploading logs
---
 build-aux/logfile-uploader.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/build-aux/logfile-uploader.py b/build-aux/logfile-uploader.py
index 2d90fa4..6fa56da 100755
--- a/build-aux/logfile-uploader.py
+++ b/build-aux/logfile-uploader.py
@@ -36,6 +36,9 @@ def _tojson(req):
 def collect_logfiles():
     """ Find and tarball all logfiles """
     tb = tarfile.open(name=TARFILE, mode="w:gz")
+    # Test results
+    for log in glob.glob("test-results.log"):
+        tb.add(log)
     # EUnit
     for log in glob.glob("src/*/.eunit/couch.log"):
         tb.add(log)


[couchdb] 02/06: Include JavaScript test results in report

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feat/improve-javascript-test-reports
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d97b7a142cbbc13686ea246fd52f639a71149e9f
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jan 9 11:12:49 2020 -0600

    Include JavaScript test results in report
---
 build-aux/show-test-results.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build-aux/show-test-results.py b/build-aux/show-test-results.py
index 0503965..c465fcf 100755
--- a/build-aux/show-test-results.py
+++ b/build-aux/show-test-results.py
@@ -12,6 +12,7 @@ TEST_COLLECTIONS = {
     "EUnit": "src/**/.eunit/*.xml",
     "EXUnit": "_build/integration/lib/couchdbtest/*.xml",
     "Mango": "src/mango/*.xml",
+    "JavaScript": "test/javascript/*.xml"
 }
 
 
@@ -377,7 +378,7 @@ def main():
     args = parse_args()
 
     if not args.collection:
-        args.collection = ["eunit", "exunit", "mango"]
+        args.collection = ["eunit", "exunit", "mango", "javascript"]
 
     collections = []
     for (name, pattern) in TEST_COLLECTIONS.items():


[couchdb] 06/06: Include JavaScript JUnit reports in Jenkins

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feat/improve-javascript-test-reports
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 698887d9d684dd35869503c1d5df408369fab1bd
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jan 9 11:39:09 2020 -0600

    Include JavaScript JUnit reports in Jenkins
---
 build-aux/Jenkinsfile.full | 22 +++++++++++-----------
 build-aux/Jenkinsfile.pr   |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/build-aux/Jenkinsfile.full b/build-aux/Jenkinsfile.full
index edf6924..4eb8719 100644
--- a/build-aux/Jenkinsfile.full
+++ b/build-aux/Jenkinsfile.full
@@ -149,7 +149,7 @@ pipeline {
           } // steps
           post {
             always {
-              junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+              junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
             }
             cleanup {
               sh 'rm -rf $COUCHDB_IO_LOG_DIR'
@@ -178,7 +178,7 @@ pipeline {
               }
               post {
                 always {
-                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
                 }
               }
             }
@@ -222,7 +222,7 @@ pipeline {
               }
               post {
                 always {
-                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
                 }
               }
             }
@@ -267,7 +267,7 @@ pipeline {
               }
               post {
                 always {
-                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
                 }
               }
             }
@@ -312,7 +312,7 @@ pipeline {
               }
               post {
                 always {
-                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
                 }
               }
             }
@@ -356,7 +356,7 @@ pipeline {
               }
               post {
                 always {
-                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
                 }
               }
             }
@@ -400,7 +400,7 @@ pipeline {
               }
               post {
                 always {
-                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
                 }
               }
             }
@@ -444,7 +444,7 @@ pipeline {
               }
               post {
                 always {
-                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
                 }
               }
             }
@@ -474,7 +474,7 @@ pipeline {
 	 *
          * [2019-12-31T20:58:48.704Z]   khash randomized test
          * [2019-12-31T20:59:04.869Z]     khash_test:103: randomized_test_ (State matches dict implementation)...*timed out*
-	 * 
+	 *
 	 * So, this is DISABLED until we get an actual arm builder machine.
 	 *
 	 * ppc64le is actually slower to emulate than arm, so we're not even going to try that.
@@ -522,7 +522,7 @@ pipeline {
               post {
                 always {
 */
-//                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+//                  junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
 /*
                 }
                 success {
@@ -566,7 +566,7 @@ pipeline {
           sh 'rm -rf ${WORKSPACE}/*'
           unstash 'tarball'
           unarchive mapping: ['pkgs/' : '.']
-  
+
           echo 'Retrieving & cleaning current couchdb-vm2 tree...'
           sh '''
             rsync -avz -e "ssh -o StrictHostKeyChecking=no -i $KEY" jenkins@couchdb-vm2.apache.org:/var/www/html/$BRANCH_NAME . || mkdir -p $BRANCH_NAME
diff --git a/build-aux/Jenkinsfile.pr b/build-aux/Jenkinsfile.pr
index 3a4304d..cf287b2 100644
--- a/build-aux/Jenkinsfile.pr
+++ b/build-aux/Jenkinsfile.pr
@@ -133,7 +133,7 @@ pipeline {
             }
             post {
               always {
-                junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml'
+                junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml'
               }
               cleanup {
                 sh 'rm -rf ${WORKSPACE}/* ${COUCHDB_IO_LOG_DIR}'


[couchdb] 03/06: Generate test results on build failures

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feat/improve-javascript-test-reports
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 26d347c7083a98d573aa7c0e0d99d7ffb30a3385
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jan 9 11:41:37 2020 -0600

    Generate test results on build failures
---
 Makefile                   | 6 ++++++
 build-aux/Jenkinsfile.full | 2 +-
 build-aux/Jenkinsfile.pr   | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 9ab9b1b..af03a6f 100644
--- a/Makefile
+++ b/Makefile
@@ -305,6 +305,12 @@ endif
 				--ignore "$(ignore_js_suites)"'  \
 	done
 
+.PHONY: build-report
+# target: build-report - Generate and upload a build report
+build-report:
+	build-aux/show-test-results.py --suites=10 --tests=10 > test-results.log
+	build-aux/logfile-uploader.py
+
 .PHONY: check-qs
 # target: check-qs - Run query server tests (ruby and rspec required!)
 check-qs:
diff --git a/build-aux/Jenkinsfile.full b/build-aux/Jenkinsfile.full
index 174cbd4..edf6924 100644
--- a/build-aux/Jenkinsfile.full
+++ b/build-aux/Jenkinsfile.full
@@ -22,7 +22,7 @@ cd build
 tar -xf ${WORKSPACE}/apache-couchdb-*.tar.gz
 cd apache-couchdb-*
 ./configure --with-curl --spidermonkey-version ${sm_ver}
-make check || (build-aux/logfile-uploader.py && false)
+make check || (make build-reports && false)
 '''
 
 make_packages = '''
diff --git a/build-aux/Jenkinsfile.pr b/build-aux/Jenkinsfile.pr
index c45c04a..3a4304d 100644
--- a/build-aux/Jenkinsfile.pr
+++ b/build-aux/Jenkinsfile.pr
@@ -23,7 +23,7 @@ tar -xf ${WORKSPACE}/apache-couchdb-*.tar.gz
 cd apache-couchdb-*
 . /usr/local/kerl/${KERL_VER}/activate
 ./configure --with-curl --spidermonkey-version 60
-make check || (build-aux/logfile-uploader.py && false)
+make check || (make build-report && false)
 '''
 
 pipeline {


[couchdb] 01/06: Add a JUnit report to JavaScript tests

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch feat/improve-javascript-test-reports
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit a1f44e3f878566209ff614d4149d56b1c9f775da
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Jan 9 11:12:03 2020 -0600

    Add a JUnit report to JavaScript tests
---
 .gitignore          |  1 +
 test/javascript/run | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9406d9b..5eec70f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -111,6 +111,7 @@ src/global_changes/ebin/
 src/mango/ebin/
 src/mango/test/*.pyc
 src/mango/venv/
+test/javascript/junit.xml
 
 /_build/
 /src/bunt
diff --git a/test/javascript/run b/test/javascript/run
index a465a7b..761fa45 100755
--- a/test/javascript/run
+++ b/test/javascript/run
@@ -17,7 +17,9 @@ import optparse as op
 import os
 import subprocess as sp
 import sys
+import time
 import re
+import xml.dom.minidom as md
 
 
 USAGE = "%prog [options] [command to run...]"
@@ -83,16 +85,66 @@ def run_couchjs(test, fmt):
         + SCRIPTS
         + [test, RUNNER]
     )
-    p = sp.Popen(cmd, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sys.stderr)
+    p = sp.Popen(cmd, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.STDOUT)
+    output = []
     while True:
         line = p.stdout.readline()
         if not line:
             break
         line = line.decode()
+        output.append(line)
         sys.stderr.write(line)
     p.wait()
     fmt(p.returncode)
-    return p.returncode
+    return (p.returncode, "".join(output))
+
+
+def write_junit(filename, total_time, results):
+    failures = 0
+    skipped = 0
+    for (_, rc, _, _) in results:
+        if rc == 2 or rc == 3:
+            skipped += 1
+        else:
+            failures += 1
+
+    doc = md.Document()
+    root = doc.createElement("testsuite")
+    root.setAttribute("name", "JavaScript tests")
+    root.setAttribute("time", "%0.3f" % total_time)
+    root.setAttribute("tests", str(len(results)))
+    root.setAttribute("failures", str(failures))
+    root.setAttribute("errors", "0")
+    root.setAttribute("skipped", str(skipped))
+    doc.appendChild(root)
+
+    for (path, rc, output, test_time) in results:
+        sys.stderr.write("WHUT? %r\n" % output)
+        name = os.path.split(path)[-1]
+        tc = doc.createElement("testcase")
+        tc.setAttribute("name", name)
+        tc.setAttribute("time", "%0.3f" % test_time)
+        if rc == 0:
+            pass
+        elif rc == 2:
+            skipped = doc.createElement("skipped")
+            skipped.setAttribute("message", "disabled")
+            tc.appendChild(skipped)
+        elif rc == 3:
+            skipped = doc.createElement("skipped")
+            skipped.setAttribute("message", "ported to elixir")
+            tc.appendChild(skipped)
+        else:
+            failure = doc.createElement("failure")
+            failure.setAttribute("message", "failed: %d" % rc)
+            failure_text = "Exit Code: %d" % rc + "\n\n" + output
+            message = doc.createTextNode(failure_text)
+            failure.appendChild(message)
+            tc.appendChild(failure)
+        root.appendChild(tc)
+
+    with open(filename, "w") as handle:
+        doc.writexml(handle, addindent="  ", newl=os.linesep)
 
 
 def options():
@@ -102,7 +154,7 @@ def options():
             "--start",
             metavar="FILENAME",
             default=None,
-            help="Start from the given filename if multiple files " "are passed",
+            help="Start from the given filename if multiple files are passed",
         ),
         op.make_option(
             "-a",
@@ -139,6 +191,14 @@ def options():
             dest="test_path",
             help="Path where the tests are located",
         ),
+        op.make_option(
+            "-j",
+            "--junit-report",
+            type="string",
+            default="test/javascript/junit.xml",
+            dest="junit_report",
+            help="Write a JUnit compatible test report",
+        ),
     ]
 
 
@@ -162,12 +222,16 @@ def main():
                 tmp.append(name)
         tests = tmp
 
+    results = []
+    begin = time.time()
     passed = 0
     failed = 0
     if len(tests) > 0:
         fmt = mkformatter(tests)
         for test in tests:
-            result = run_couchjs(test, fmt)
+            tbefore = time.time()
+            (result, output) = run_couchjs(test, fmt)
+            results.append((test, result, output, time.time() - tbefore))
             if result == 0 or result == 2 or result == 3:
                 passed += 1
             else:
@@ -175,6 +239,10 @@ def main():
                 if not opts.all:
                     break
 
+    total_time = time.time() - begin
+    if opts.junit_report:
+        write_junit(opts.junit_report, total_time, results)
+
     sys.stderr.write(
         "=======================================================" + os.linesep
     )