Build: Add CDATA block to avoid invalid xml

Closes #133


Project: http://git-wip-us.apache.org/repos/asf/incubator-madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-madlib/commit/ec60b83d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-madlib/tree/ec60b83d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-madlib/diff/ec60b83d

Branch: refs/heads/master
Commit: ec60b83d28569b08c5e1d10be3659b6f91a42f16
Parents: de71bd7
Author: Rahul Iyer <ri...@apache.org>
Authored: Wed May 10 17:22:12 2017 -0700
Committer: Rahul Iyer <ri...@apache.org>
Committed: Tue May 16 15:39:29 2017 -0700

----------------------------------------------------------------------
 tool/jenkins/jenkins_build.sh | 19 +++++++++++++------
 tool/jenkins/junit_export.py  | 19 +++++++++++--------
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/ec60b83d/tool/jenkins/jenkins_build.sh
----------------------------------------------------------------------
diff --git a/tool/jenkins/jenkins_build.sh b/tool/jenkins/jenkins_build.sh
index d0f5510..1174473 100644
--- a/tool/jenkins/jenkins_build.sh
+++ b/tool/jenkins/jenkins_build.sh
@@ -40,6 +40,7 @@ docker rm madlib
 
 echo "Creating docker container"
 # Pull down the base docker images
+echo "docker pull madlib/postgres_9.6:jenkins"
 docker pull madlib/postgres_9.6:jenkins
 # Launch docker container with volume mounted from workdir
 echo "-------------------------------"
@@ -63,17 +64,23 @@ docker exec madlib bash -c 'rm -rf /build; mkdir /build; cd 
/build; cmake ../inc
 echo "---------- Installing and running install-check --------------------"
 # Install MADlib and run install check
 cat <<EOF
-docker exec madlib /build/src/bin/madpack -p postgres -c 
postgres/postgres@localhost:5432/postgres install | tee 
$workdir/logs/madlib_install.log
+docker exec madlib bash -c '/build/src/bin/madpack -p postgres -c 
postgres/postgres@localhost:5432/postgres install' | tee 
$workdir/logs/madlib_install.log
+EOF
+docker exec madlib bash -c '/build/src/bin/madpack -p postgres -c 
postgres/postgres@localhost:5432/postgres install' | tee 
$workdir/logs/madlib_install.log
 
-mkdir -p $workdir/tmp
-docker exec madlib /build/src/bin/madpack -p postgres  -c 
postgres/postgres@localhost:5432/postgres -d $workdir/tmp install-check | tee 
$workdir/logs/madlib_install_check.log
+cat <<EOF
+docker exec madlib bash -c 'mkdir /tmp'
+docker exec madlib bash -c '/build/src/bin/madpack -p postgres  -c 
postgres/postgres@localhost:5432/postgres -d /tmp install-check' | tee 
$workdir/logs/madlib_install_check.log
 EOF
-docker exec madlib /build/src/bin/madpack -p postgres -c 
postgres/postgres@localhost:5432/postgres install | tee 
$workdir/logs/madlib_install.log
-docker exec madlib /build/src/bin/madpack -p postgres  -c 
postgres/postgres@localhost:5432/postgres install-check | tee 
$workdir/logs/madlib_install_check.log
+
+docker exec madlib bash -c 'mkdir /tmp'
+docker exec madlib bash -c '/build/src/bin/madpack -p postgres  -c 
postgres/postgres@localhost:5432/postgres -d /tmp install-check' | tee 
$workdir/logs/madlib_install_check.log
 
 echo "--------- Copying packages -----------------"
 echo "docker cp madlib:build $workdir"
 docker cp madlib:build $workdir
+echo "docker cp madlib:tmp $workdir"
+docker cp madlib:tmp $workdir
 
 echo "-------------------------------"
 echo "ls -la"
@@ -87,4 +94,4 @@ echo "-------------------------------"
 cat <<EOF
 python incubator-madlib/tool/jenkins/junit_export.py 
$workdir/logs/madlib_install_check.log $workdir/logs/madlib_install_check.xml
 EOF
-python incubator-madlib/tool/jenkins/junit_export.py 
$workdir/logs/madlib_install_check.log $workdir/logs/madlib_install_check.xml
+python incubator-madlib/tool/jenkins/junit_export.py $workdir 
$workdir/logs/madlib_install_check.log $workdir/logs/madlib_install_check.xml

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/ec60b83d/tool/jenkins/junit_export.py
----------------------------------------------------------------------
diff --git a/tool/jenkins/junit_export.py b/tool/jenkins/junit_export.py
index 1836ea4..c7fbd4e 100644
--- a/tool/jenkins/junit_export.py
+++ b/tool/jenkins/junit_export.py
@@ -40,7 +40,7 @@ Example of JUnit output:
 TestResult = namedtuple("TestResult", 'name suite status duration message')
 
 
-def _test_result_factory(install_check_log):
+def _test_result_factory(workdir, install_check_log):
     """
     Args:
         @param install_check_log: File name containing results from 
install-check
@@ -64,7 +64,7 @@ def _test_result_factory(install_check_log):
                     if failure_m:
                         log_file = failure_m.group(1)
                         try:
-                            message = subprocess.check_output(['tail', '-n 
100', log_file],
+                            message = subprocess.check_output(['tail', '-n 
100', workdir + log_file],
                                                               
stderr=subprocess.STDOUT)
                         except subprocess.CalledProcessError as e:
                             message = e.output
@@ -97,15 +97,17 @@ def _add_test_case(out_log, test_results):
                   'status="{t.status}" time="{d}">'.
                   format(t=t, d=duration)]
         if t.status == "FAIL":
-            output.append('<failure>{0}</failure>'.format(t.message))
+            output.append("""<failure><![CDATA[
+                          {0}
+                          ]]></failure>""".format(t.message))
         output.append('</testcase>')
         out_log.write('\n'.join(output))
 
 
-def main(install_check_log, test_output_log):
+def main(workdir, install_check_log, test_output_log):
 
     # need number of test results - so have to create the iterable
-    all_test_results = [i for i in _test_result_factory(install_check_log)]
+    all_test_results = [i for i in _test_result_factory(workdir, 
install_check_log)]
 
     with open(test_output_log, 'w') as out_log:
         _add_header(out_log, len(all_test_results))
@@ -114,6 +116,7 @@ def main(install_check_log, test_output_log):
 
 
 if __name__ == "__main__":
-    # argv[1] = install check log
-    # argv[2] = output file to store xml
-    main(sys.argv[1], sys.argv[2])
+    # argv[1] = working director
+    # argv[2] = install check log
+    # argv[3] = output file to store xml
+    main(sys.argv[1], sys.argv[2], sys.argv[3])

Reply via email to