All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 for-4.10] scripts: introduce a script for build test
@ 2017-10-25 16:00 Wei Liu
  2017-10-30 14:14 ` Wei Liu
  2017-10-30 15:14 ` Ian Jackson
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Liu @ 2017-10-25 16:00 UTC (permalink / raw)
  To: Xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Anthony PERARD

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>

v3:
1. Use git-clean in default rune.
2. Print more friendly message.
3. Restore HEAD automatically.
---
 scripts/build-test.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100755 scripts/build-test.sh

diff --git a/scripts/build-test.sh b/scripts/build-test.sh
new file mode 100755
index 0000000000..f55ec5d4fa
--- /dev/null
+++ b/scripts/build-test.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# 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 -f xen/common/kernel.c; then
+    echo "Please run this script from top-level directory"
+    exit 1
+fi
+
+if test $# -lt 2 ; then
+    echo "Usage: $0 <BASE> <TIP> [CMD]"
+    exit 1
+fi
+
+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
+
+trap "echo Restoring original HEAD ; git checkout $ORIG_BRANCH" EXIT
+
+git rev-list $BASE..$TIP | nl -ba | tac | \
+while read num rev; do
+    echo "Testing $num $rev"
+    git checkout $rev
+    if test $# -eq 0 ; then
+        git clean -fdx && ./configure && make -j4
+    else
+        "$@"
+    fi
+    if test $? -ne 0; then
+        echo "Failed at $num $rev"
+        exit 1
+    fi
+    echo
+done
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 for-4.10] scripts: introduce a script for build test
  2017-10-25 16:00 [PATCH v3 for-4.10] scripts: introduce a script for build test Wei Liu
@ 2017-10-30 14:14 ` Wei Liu
  2017-10-30 15:14 ` Ian Jackson
  1 sibling, 0 replies; 4+ messages in thread
From: Wei Liu @ 2017-10-30 14:14 UTC (permalink / raw)
  To: Xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Anthony PERARD

On Wed, Oct 25, 2017 at 05:00:21PM +0100, Wei Liu wrote:
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: George Dunlap <George.Dunlap@eu.citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Tim Deegan <tim@xen.org>
> Cc: Wei Liu <wei.liu2@citrix.com>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: Anthony PERARD <anthony.perard@citrix.com>
> 
> v3:
> 1. Use git-clean in default rune.
> 2. Print more friendly message.
> 3. Restore HEAD automatically.

Ping?

> ---
>  scripts/build-test.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
>  create mode 100755 scripts/build-test.sh
> 
> diff --git a/scripts/build-test.sh b/scripts/build-test.sh
> new file mode 100755
> index 0000000000..f55ec5d4fa
> --- /dev/null
> +++ b/scripts/build-test.sh
> @@ -0,0 +1,50 @@
> +#!/bin/sh
> +
> +# 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 -f xen/common/kernel.c; then
> +    echo "Please run this script from top-level directory"
> +    exit 1
> +fi
> +
> +if test $# -lt 2 ; then
> +    echo "Usage: $0 <BASE> <TIP> [CMD]"
> +    exit 1
> +fi
> +
> +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
> +
> +trap "echo Restoring original HEAD ; git checkout $ORIG_BRANCH" EXIT
> +
> +git rev-list $BASE..$TIP | nl -ba | tac | \
> +while read num rev; do
> +    echo "Testing $num $rev"
> +    git checkout $rev
> +    if test $# -eq 0 ; then
> +        git clean -fdx && ./configure && make -j4
> +    else
> +        "$@"
> +    fi
> +    if test $? -ne 0; then
> +        echo "Failed at $num $rev"
> +        exit 1
> +    fi
> +    echo
> +done
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 for-4.10] scripts: introduce a script for build test
  2017-10-25 16:00 [PATCH v3 for-4.10] scripts: introduce a script for build test Wei Liu
  2017-10-30 14:14 ` Wei Liu
@ 2017-10-30 15:14 ` Ian Jackson
  2017-10-30 15:57   ` Wei Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Ian Jackson @ 2017-10-30 15:14 UTC (permalink / raw)
  To: Wei Liu
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, George Dunlap,
	Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall,
	Jan Beulich, Anthony PERARD, Xen-devel

Wei Liu writes ("[PATCH v3 for-4.10] scripts: introduce a script for build test"):
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
...
...
> +trap "echo Restoring original HEAD ; git checkout $ORIG_BRANCH" EXIT

This will smash the whole script's exit status.  I think you need to
save/restore $?.  Be careful with your quoting.  Normally it is better
for the argument to trap to be ''-quoted rather than "", to avoid it
being expanded twice (and, the first time, too soon).

Also, if this fails, it leaves the failure message buried in a scrool
of make -j4 output, where the user probably won't see it.  And it
prints exactly the same message on success and failure.  On failure
you should print the failing commitid, and exit nonzero.

On success you should print some reassuring `ok' message.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 for-4.10] scripts: introduce a script for build test
  2017-10-30 15:14 ` Ian Jackson
@ 2017-10-30 15:57   ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2017-10-30 15:57 UTC (permalink / raw)
  To: Ian Jackson
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Tim Deegan, Julien Grall,
	Jan Beulich, Anthony PERARD, Xen-devel

On Mon, Oct 30, 2017 at 03:14:04PM +0000, Ian Jackson wrote:
> Wei Liu writes ("[PATCH v3 for-4.10] scripts: introduce a script for build test"):
> > Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ...
> ...
> > +trap "echo Restoring original HEAD ; git checkout $ORIG_BRANCH" EXIT
> 
> This will smash the whole script's exit status.  I think you need to
> save/restore $?.  Be careful with your quoting.  Normally it is better
> for the argument to trap to be ''-quoted rather than "", to avoid it
> being expanded twice (and, the first time, too soon).
> 
> Also, if this fails, it leaves the failure message buried in a scrool
> of make -j4 output, where the user probably won't see it.  And it
> prints exactly the same message on success and failure.  On failure
> you should print the failing commitid, and exit nonzero.
> 
> On success you should print some reassuring `ok' message.
> 

Right. I've addressed your comments and will send out a new version
soon.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-30 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-25 16:00 [PATCH v3 for-4.10] scripts: introduce a script for build test Wei Liu
2017-10-30 14:14 ` Wei Liu
2017-10-30 15:14 ` Ian Jackson
2017-10-30 15:57   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.