From 58dac9e6bc4dd359f24e17f24438afeef763ff52 Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Tue, 2 Apr 2013 14:21:37 +0200 Subject: [PATCH] liveboot: TestLink build + tests integration Signed-off-by: Thilo Fromm --- liveboot_gw_autotest.sh | 15 ++++- liveboot_testlink_create_build.sh | 92 +++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100755 liveboot_testlink_create_build.sh diff --git a/liveboot_gw_autotest.sh b/liveboot_gw_autotest.sh index a4cbdca..eec743e 100755 --- a/liveboot_gw_autotest.sh +++ b/liveboot_gw_autotest.sh @@ -60,11 +60,24 @@ ssh -t $CORE_ROUTER "sudo rm /opt/autotest -rf ; sudo mkdir -p /opt/autotest ; s ssh -t $CORE_ROUTER "cd /opt ; git clone git://git/ri/autotest.git" ssh -t $CORE_ROUTER "cd /opt/autotest ; git checkout master" +# +# Generate TestLink Build +# +./liveboot_testlink_create_build.sh \ + "liveboot-${LIVEBOOT_BUILD_NUMBER}" \ + "Auto-generated by Jenkins on $(date --rfc-3339=seconds)" + # # run autotests # #ssh -t -A $CORE_ROUTER "cd /opt/autotest ; ./run-compile.sh --config config-jenkins.xml" -ssh -t -A $CORE_ROUTER "cd /opt/autotest ; ./run-compile.sh" + +# call autotest suite w/ testlink connector info +ssh -t -A $CORE_ROUTER "cd /opt/autotest ; \ + ./run-compile.sh \ + --testlink='Profitbricks','R&I Liveboot Approval Autotest','liveboot-${LIVEBOOT_BUILD_NUMBER}'" + +# no testlink support in vcb tests yet ssh -t -A $CORE_ROUTER "cd /opt/autotest ; ./run-compile.sh --vcb=true --tracepjds" # diff --git a/liveboot_testlink_create_build.sh b/liveboot_testlink_create_build.sh new file mode 100755 index 0000000..eaff6b2 --- /dev/null +++ b/liveboot_testlink_create_build.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# +# Create a TestLink build by means of xmlrpc. +# +# This helper script creates a new TestLink build in the "Profitbricks" +# project, test plan "R&I Liveboot Approval Autotest". +# +# Example Usage: +# +# liveboot_testlink_create_build.sh \ +# "liveboot-923" \ +# "auto-generated build at $(date)." +# + +testlink_url='http://testlink/lib/api/xmlrpc.php' + dev_key='6805a288081cf7480d391533b354cb7c' + +test_project="Profitbricks" + test_plan="R&I Liveboot Approval Autotest" + + +# --------------------- + + +xmlrpc() { + local method="tl.$1" ; shift + local params=" + devKey $dev_key $@ + " + + curl -s \ + --header 'content-type: text/xml' \ + --header 'Cache-Control: no-cache' \ + --header 'Pragma: no-cache' \ + --data-binary \ +" + + + $method + + + + $params + + + +" \ + $testlink_url + + echo "" +} +# ---- + +get_testplan_by_name() { + local project="$1" ; shift + local plan="$@" + xmlrpc "getTestPlanByName" " + testprojectname $project + testplanname $plan " \ + | grep 'id' \ + | sed 's:.*\([0-9]*\).*:\1:' +} +# ---- + +createBuild() { + local name="$1" ; shift + local notes="$@" + + local id=`get_testplan_by_name "$test_project" "$test_plan"` + + xmlrpc "createBuild" " + testplanid $id \ + buildname $name \ + buildnotes $notes " +} +# ---- + + +if [ "testlink_create_build.sh" = `basename $0` ]; then + + [ $# -lt 2 ] && { + echo + echo "USAGE: $0 '' ''" + echo + exit + } + + name="$1" ; shift + createBuild "$name" $@ + exit +fi -- 2.39.5