[Fuego] [PATCH 22/23] links: links can now be specified by the specs

Daniel Sangorrin daniel.sangorrin at toshiba.co.jp
Thu Apr 27 08:26:55 UTC 2017


There are default success and fail links. A spec file can
re-define them by setting the success_links or fail_links
values. Additionally, each spec can add extra links that
depend on the parameter used.

Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
 engine/scripts/ftc | 45 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index 51f90c5..e173d5b 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -783,14 +783,41 @@ def get_includes(include_filename, conf):
 def create_job(board, test):
     flot_link = '<flotile.FlotPublisher plugin="flot at 1.0-SNAPSHOT"/>'
 
-    # prepare links for descriptionsetter. Put a link to testlog.txt by default
+    # prepare links for the descriptionsetter plugin
+    test_spec_path = '/fuego-core/engine/tests/%s/spec' % (test.name)
     template_link = '&lt;a href=&quot;/fuego/userContent/fuego.logs/%s/%s.%s.${BUILD_NUMBER}.${BUILD_ID}/%%s&quot;&gt;%%s&lt;/a&gt;' % (test.name, board, test.spec)
+    with open(test_spec_path, "r") as f:
+        test_specs_json = json.load(f)
+        test_spec_json = test_specs_json['specs'][test.spec]
+
+    success_links = ''
+    if 'success_links' in test_specs_json:
+        for key, value in test_specs_json['success_links'].iteritems():
+            success_links = success_links + ' ' + template_link % (str(value), str(key))
+    else:
+        default_success_links = {"log": "testlog.txt", "plot": "plot.png"}
+        for key, value in default_success_links.iteritems():
+            success_links = success_links + ' ' + template_link % (str(value), str(key))
+
+    if 'extra_success_links' in test_spec_json:
+        for key, value in test_spec_json['extra_success_links'].iteritems():
+            success_links = success_links + ' ' + template_link % (str(value), str(key))
+
+    fail_links = ''
+    if 'fail_links' in test_specs_json:
+        for key, value in test_specs_json['fail_links'].iteritems():
+            fail_links = fail_links + ' ' + template_link % (str(value), str(key))
+    else:
+        if test.test_type == 'Functional':
+            default_fail_links = {"log": "testlog.txt", "plot": "plot.png"}
+        else:
+            default_fail_links = {"log": "testlog.txt"}
+        for key, value in default_fail_links.iteritems():
+            fail_links = fail_links + ' ' + template_link % (str(value), str(key))
 
-    html_links = template_link % ('testlog.txt', 'log')
-    failed_links = html_links
-    if test.extralinks:
-        for key, value in test.extralinks.iteritems():
-            html_links = html_links + ' ' + template_link % (str(value), str(key))
+    if 'extra_fail_links' in test_spec_json:
+        for key, value in test_spec_json['extra_fail_links'].iteritems():
+            fail_links = fail_links + ' ' + template_link % (str(value), str(key))
 
     tmp = "/tmp/fuego_tmp_job"
     fd = open(tmp, "w+")
@@ -828,8 +855,8 @@ timeout --signal=9 {timeout} /bin/bash $FUEGO_CORE/engine/scripts/main.sh
     <hudson.plugins.descriptionsetter.DescriptionSetterPublisher plugin="description-setter at 1.10">
       <regexp></regexp>
       <regexpForFailed></regexpForFailed>
-      <description>{html_links}</description>
-      <descriptionForFailed>{failed_links}</descriptionForFailed>
+      <description>{success_links}</description>
+      <descriptionForFailed>{fail_links}</descriptionForFailed>
       <setForMatrix>false</setForMatrix>
     </hudson.plugins.descriptionsetter.DescriptionSetterPublisher>
     </publishers>
@@ -839,7 +866,7 @@ timeout --signal=9 {timeout} /bin/bash $FUEGO_CORE/engine/scripts/main.sh
         precleanup=test.precleanup, postcleanup=test.postcleanup,
         testdir=test.name, testname=test.base_name,
         testspec=test.spec, timeout=test.timeout,
-        flot_link=flot_link, html_links=html_links, failed_links=failed_links))
+        flot_link=flot_link, success_links=success_links, fail_links=fail_links))
     fd.close()
 
     job_name=board+"."+test.spec+"."+test.name
-- 
2.7.4




More information about the Fuego mailing list