[xen master] automation: introduce a script for build test

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] automation: introduce a script for build test

patchbot
commit acd00a303378ce48bd6bbd8a579f1fe2f1b21a7d
Author:     Wei Liu <[hidden email]>
AuthorDate: Mon Oct 23 16:40:57 2017 +0100
Commit:     Wei Liu <[hidden email]>
CommitDate: Fri Jul 27 09:32:54 2018 +0100

    automation: introduce a script for build test
   
    Signed-off-by: Ian Jackson <[hidden email]>
    Signed-off-by: Wei Liu <[hidden email]>
    Reviewed-by: Doug Goldstein <[hidden email]>
---
 automation/scripts/build-test.sh | 68 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/automation/scripts/build-test.sh b/automation/scripts/build-test.sh
new file mode 100755
index 0000000000..c318b65d5a
--- /dev/null
+++ b/automation/scripts/build-test.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+# Run command on every commit within the range specified. If no command is
+# provided, use the default one to clean and build the whole tree.
+#
+# The default rune is rather simple. To do a cross-build, please put your usual
+# build rune in a shell script and invoke it with this script.
+
+if test $# -lt 2 ; then
+    echo "Usage:"
+    echo " $0 <BASE> <TIP> [CMD]"
+    echo " If [CMD] is not specified, run the default command"
+    echo "     git clean -fdx && ./configure && make -j4"
+    exit 1
+fi
+
+pushd `git rev-parse --show-toplevel`
+
+status=`git status -s`
+if test -n "$status"; then
+    echo "Tree is dirty, aborted"
+    exit 1
+fi
+
+BASE=$1; shift
+TIP=$1; shift
+
+ORIG_BRANCH=`git symbolic-ref -q --short HEAD`
+if test $? -ne 0; then
+    echo "Detached HEAD, aborted"
+    exit 1
+fi
+
+while read num rev; do
+    echo "Testing $num $rev"
+
+    git checkout $rev
+    ret=$?
+    if test $ret -ne 0; then
+        echo "Failed to checkout $num $rev with $ret"
+        break
+    fi
+
+    if test $# -eq 0 ; then
+        git clean -fdx && ./configure && make -j4
+    else
+        "$@"
+    fi
+    ret=$?
+    if test $ret -ne 0; then
+        echo "Failed at $num $rev with $ret"
+        break
+    fi
+    echo
+done < <(git rev-list $BASE..$TIP | nl -ba | tac)
+
+echo "Restoring original HEAD"
+git checkout $ORIG_BRANCH
+gco_ret=$?
+if test $gco_ret -ne 0; then
+    echo "Failed to restore orignal HEAD. Check tree status before doing anything else!"
+    exit $gco_ret
+fi
+
+if test $ret -eq 0; then
+    echo "ok."
+fi
+exit $ret
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog