[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v6] automation: introduce a script for build test
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- This is a script I wrote previously for build test. Given it basically runs a set of commands on every commit, maybe it should be named for-each-commit.sh ? Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> Cc: Tim Deegan <tim@xxxxxxx> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Julien Grall <julien.grall@xxxxxxx> Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx> v6: Use pushd to switch to toplevel directory automatically. v5: 1. Use bash so that while do ... done < () works. 2. Move script to automation directory. v4: 1. Check, save/restore $?. 2. Don't use trap, check exit code directly. 3. More error messages. v3: 1. Use git-clean in default rune. 2. Print more friendly message. 3. Restore HEAD automatically. --- automation/scripts/build-test.sh | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 automation/scripts/build-test.sh diff --git a/automation/scripts/build-test.sh b/automation/scripts/build-test.sh new file mode 100755 index 0000000000..43ab71751c --- /dev/null +++ b/automation/scripts/build-test.sh @@ -0,0 +1,65 @@ +#!/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: $0 <BASE> <TIP> [CMD]" + 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 -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |