* [PATCH v6] automation: introduce a script for build test
@ 2018-07-25 9:24 Wei Liu
2018-07-25 10:27 ` George Dunlap
2018-07-25 13:54 ` Doug Goldstein
0 siblings, 2 replies; 7+ messages in thread
From: Wei Liu @ 2018-07-25 9:24 UTC (permalink / raw)
To: Xen-devel
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Ian Jackson,
Doug Goldstein, Tim Deegan, Julien Grall, Jan Beulich,
Andrew Cooper, Anthony PERARD
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
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@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>
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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v6] automation: introduce a script for build test
2018-07-25 9:24 [PATCH v6] automation: introduce a script for build test Wei Liu
@ 2018-07-25 10:27 ` George Dunlap
2018-07-25 13:29 ` Wei Liu
2018-07-25 13:54 ` Doug Goldstein
1 sibling, 1 reply; 7+ messages in thread
From: George Dunlap @ 2018-07-25 10:27 UTC (permalink / raw)
To: Wei Liu
Cc: Stefano Stabellini, Doug Goldstein, Ian Jackson, Tim Deegan,
Julien Grall, Jan Beulich, Andrew Cooper, Anthony PERARD,
Xen-devel
On Wed, Jul 25, 2018 at 10:24 AM, Wei Liu <wei.liu2@citrix.com> wrote:
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> 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 ?
Except that you also build just the whole series if the base and tip
aren't specified.
Since it's about building a series (either all at once or one commit
at a time), what about built-series? Or series-build-test?
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6] automation: introduce a script for build test
2018-07-25 10:27 ` George Dunlap
@ 2018-07-25 13:29 ` Wei Liu
2018-07-25 13:40 ` George Dunlap
0 siblings, 1 reply; 7+ messages in thread
From: Wei Liu @ 2018-07-25 13:29 UTC (permalink / raw)
To: George Dunlap
Cc: Stefano Stabellini, Wei Liu, Doug Goldstein, Ian Jackson,
Tim Deegan, Julien Grall, Jan Beulich, Andrew Cooper,
Anthony PERARD, Xen-devel
On Wed, Jul 25, 2018 at 11:27:16AM +0100, George Dunlap wrote:
> On Wed, Jul 25, 2018 at 10:24 AM, Wei Liu <wei.liu2@citrix.com> wrote:
> > Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> > 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 ?
>
> Except that you also build just the whole series if the base and tip
> aren't specified.
>
What do you mean by this? Base and tip are required.
> Since it's about building a series (either all at once or one commit
> at a time), what about built-series? Or series-build-test?
>
Not sure. My point was it could do more things than just building. You
can supply your own script or commands to do stuff with each commit.
Wei.
> -George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6] automation: introduce a script for build test
2018-07-25 13:29 ` Wei Liu
@ 2018-07-25 13:40 ` George Dunlap
2018-07-25 15:05 ` Wei Liu
0 siblings, 1 reply; 7+ messages in thread
From: George Dunlap @ 2018-07-25 13:40 UTC (permalink / raw)
To: Wei Liu, George Dunlap
Cc: Stefano Stabellini, Doug Goldstein, Ian Jackson, Tim Deegan,
Julien Grall, Jan Beulich, Andrew Cooper, Anthony PERARD,
Xen-devel
On 07/25/2018 02:29 PM, Wei Liu wrote:
> On Wed, Jul 25, 2018 at 11:27:16AM +0100, George Dunlap wrote:
>> On Wed, Jul 25, 2018 at 10:24 AM, Wei Liu <wei.liu2@citrix.com> wrote:
>>> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
>>> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
>>> ---
>>> 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 ?
>>
>> Except that you also build just the whole series if the base and tip
>> aren't specified.
>>
>
> What do you mean by this? Base and tip are required.
Oh, so it does. Sorry, for some reason when I skimmed it the first time
I thought I saw that it had two different modes.
>> Since it's about building a series (either all at once or one commit
>> at a time), what about built-series? Or series-build-test?
>>
>
> Not sure. My point was it could do more things than just building. You
> can supply your own script or commands to do stuff with each commit.
Yes, in that case, something like for-each-commit would be sensible.
Although I might consider not including the 'default build' command in
the script in that case, on the grounds that it would violate the
principle of least surprise for a script named "for-each-commit" to
start building things on its own.
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6] automation: introduce a script for build test
2018-07-25 9:24 [PATCH v6] automation: introduce a script for build test Wei Liu
2018-07-25 10:27 ` George Dunlap
@ 2018-07-25 13:54 ` Doug Goldstein
2018-07-25 15:08 ` Wei Liu
1 sibling, 1 reply; 7+ messages in thread
From: Doug Goldstein @ 2018-07-25 13:54 UTC (permalink / raw)
To: Wei Liu
Cc: Stefano Stabellini, George Dunlap, Andrew Cooper, Ian Jackson,
Tim Deegan, Julien Grall, Jan Beulich, Anthony PERARD, Xen-devel
On Wed, Jul 25, 2018 at 10:24:24AM +0100, Wei Liu wrote:
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> 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 ?
So if we do that can we make it clear that there's a default action
that's going to be run? Mentally I'd expect a script called like that
would require a command that it would execute but you do have a default.
> +
> +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
maybe some comment in the code like "hey someone reading me this is the
default command"
Overall I think this is a good addition to the tree. If people feel
different than I do about the default command then feel free to commit
with my:
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
--
Doug
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6] automation: introduce a script for build test
2018-07-25 13:40 ` George Dunlap
@ 2018-07-25 15:05 ` Wei Liu
0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2018-07-25 15:05 UTC (permalink / raw)
To: George Dunlap
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Doug Goldstein,
Ian Jackson, Tim Deegan, Julien Grall, Jan Beulich,
Andrew Cooper, Anthony PERARD, Xen-devel
On Wed, Jul 25, 2018 at 02:40:13PM +0100, George Dunlap wrote:
> On 07/25/2018 02:29 PM, Wei Liu wrote:
> > On Wed, Jul 25, 2018 at 11:27:16AM +0100, George Dunlap wrote:
> >> On Wed, Jul 25, 2018 at 10:24 AM, Wei Liu <wei.liu2@citrix.com> wrote:
> >>> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> >>> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> >>> ---
> >>> 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 ?
> >>
> >> Except that you also build just the whole series if the base and tip
> >> aren't specified.
> >>
> >
> > What do you mean by this? Base and tip are required.
>
> Oh, so it does. Sorry, for some reason when I skimmed it the first time
> I thought I saw that it had two different modes.
>
> >> Since it's about building a series (either all at once or one commit
> >> at a time), what about built-series? Or series-build-test?
> >>
> >
> > Not sure. My point was it could do more things than just building. You
> > can supply your own script or commands to do stuff with each commit.
>
> Yes, in that case, something like for-each-commit would be sensible.
> Although I might consider not including the 'default build' command in
> the script in that case, on the grounds that it would violate the
> principle of least surprise for a script named "for-each-commit" to
> start building things on its own.
Thinking about it the main purpose of this script is help build test. It
can be (ab)used to some other things is secondary. I think I will keep
build-test.sh for now.
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v6] automation: introduce a script for build test
2018-07-25 13:54 ` Doug Goldstein
@ 2018-07-25 15:08 ` Wei Liu
0 siblings, 0 replies; 7+ messages in thread
From: Wei Liu @ 2018-07-25 15:08 UTC (permalink / raw)
To: Doug Goldstein
Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
Ian Jackson, Tim Deegan, Julien Grall, Jan Beulich,
Anthony PERARD, Xen-devel
On Wed, Jul 25, 2018 at 08:54:32AM -0500, Doug Goldstein wrote:
> On Wed, Jul 25, 2018 at 10:24:24AM +0100, Wei Liu wrote:
> > Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> > 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 ?
>
> So if we do that can we make it clear that there's a default action
> that's going to be run? Mentally I'd expect a script called like that
> would require a command that it would execute but you do have a default.
>
I think I will keep the old name for now. See my reply to George.
> > +
> > +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
>
> maybe some comment in the code like "hey someone reading me this is the
> default command"
>
I would add the following to the script usage output at the beginning.
echo "If [CMD] is not specified, run the default command `git clean -fdx && ./configure && make -j4`"
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-25 15:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 9:24 [PATCH v6] automation: introduce a script for build test Wei Liu
2018-07-25 10:27 ` George Dunlap
2018-07-25 13:29 ` Wei Liu
2018-07-25 13:40 ` George Dunlap
2018-07-25 15:05 ` Wei Liu
2018-07-25 13:54 ` Doug Goldstein
2018-07-25 15:08 ` 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.