]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Add reporting to CI test script
authorWillem Toorop <willem@nlnetlabs.nl>
Fri, 14 Jun 2013 18:34:43 +0000 (20:34 +0200)
committerWillem Toorop <willem@nlnetlabs.nl>
Fri, 14 Jun 2013 18:34:43 +0000 (20:34 +0200)
test/test_ci.sh

index 0d41cd32e4c2612f799b7287eb980fd157108d44..8fd6bcc008c084071ae0a00d59cb10c52e07a99c 100755 (executable)
@@ -35,5 +35,59 @@ do
        fi
        tpkg -b $BUILD_DIR/test -a $BUILD_DIR exe $TESTFN
 done
-# END
 
+# -----------------------------------------------------------------------------
+# ----  Testing part
+#
+( cd test; tpkg -q -n `ls result.*|wc -l` report >/dev/null )
+
+# -----------------------------------------------------------------------------
+# ----  Reusable reporting part
+#
+if test "$?" -eq "0"; then STATUS="PASS"; else STATUS="FAIL"; fi
+CI_ID=2
+
+REPOS=$(basename $(pwd))
+REPOS=${REPOS%.git}
+CI_URI="https://gitlab-ci.nlnetlabs.nl/projects/$CI_ID/builds/%H"
+while [ $# -ge 1 ]
+do
+       (
+               git log -1 --format="From %H %ad%nFrom: %an <%ae>"
+               BRANCH=$(
+                       for W in $( git log -1 --format=%d | tr "()," "   " )
+                       do echo $W
+                       done | grep -v HEAD | head -1
+                       )
+               BRANCH="${BRANCH#origin/}"
+               echo "X-Git-Refname: $BRANCH"
+               if [ -z "$BRANCH" -o "$BRANCH" = "master" ]
+               then
+                       BRANCH=""
+               else
+                       BRANCH="/$BRANCH"
+               fi
+               git log -1 --format="Subject: [git: $REPOS$BRANCH][$STATUS] %s"
+               echo "To: $1"
+               echo "Date: `LC_ALL=C date '+%a, %e %b %Y %T %z (%Z)'`"
+               echo "X-Git-Repository: $REPOS"
+               git log -2 --format="X-Git-Oldrev: %H"
+               git log -1 --format="X-Git-Newrev: %H"
+               echo
+               uname -a
+               echo
+               git log -1 --format="$CI_URI"
+               echo
+
+               # -------------------------------------------------------------
+               # ----  Repository specific reporting part
+               # ----
+                       ( cd test; tpkg report )
+               # ----
+               # -------------------------------------------------------------
+
+
+       ) | sendmail $1
+       shift
+done
+test "$STATUS" = "PASS"