scripts: add a script for build testing
PATCH 1/1 scripts: add a script for build testing
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Julien Grall <[email protected]>
The risk for this is zero, hence the for-4.10 tag.
--- scripts/build-test.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/build-test.sh
scripts/build-test.sh new file +40 -0
@@ -0,0 +1,40 @@ +#!/bin/sh + +# WARNING: Always backup the branch by creating another reference to it if +# you're not familiar with git-rebase(1). +# +# Use `git rebase` to run command or script on every commit within the range +# specified. If no command or script is provided, use the default one to clean +# and build the whole tree. +# +# If something goes wrong, the script will stop at the commit that fails. Fix +# the failure and run `git rebase --continue`. +# +# If for any reason the tree is screwed, use `git rebase --abort` to restore to +# original state. + +if ! test -f xen/Kconfig; then + echo "Please run this script from top-level directory" + exit 1 +fi + +if test $# -lt 2 ; then + echo "Usage: $0 <BASE> <TIP> [CMD|SCRIPT]" + exit 1 +fi + +BASE=$1 +TIP=$2 +CMD=${3:-git clean -fdx && ./configure && make -j4} + +echo "Running command \"$CMD\" on every commit from $BASE to $TIP" +echo -n "Starting in " + +for i in `seq 5 -1 1`; do + echo -n "$i ... " + sleep 1 +done + +echo + +git rebase $BASE $TIP -x "$CMD"
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 20.10.17 at 19:32, <[email protected]> wrote:
scripts/build-test.sh new file +7
-0@@ -0,0 +1,40 @@ +#!/bin/sh + +# WARNING: Always backup the branch by creating another reference to it if +# you're not familiar with git-rebase(1). +# +# Use `git rebase` to run command or script on every commit within the range +# specified. If no command or script is provided, use the default one to clean
scripts/build-test.sh line 17
Quoted 10 lines
scripts/build-test.sh new file +10
-0+# and build the whole tree. +# +# If something goes wrong, the script will stop at the commit that fails. Fix +# the failure and run `git rebase --continue`. +# +# If for any reason the tree is screwed, use `git rebase --abort` to restore to +# original state. + +if ! test -f xen/Kconfig; then + echo "Please run this script from top-level directory"
Wouldn't running this in one of the top-level sub-trees also be useful? E.g. why would one want a hypervisor only series not touching the public interface to have the tools tree rebuilt all the time?
scripts/build-test.sh line 22
Quoted 5 lines
scripts/build-test.sh new file +5
-0+ exit 1 +fi + +if test $# -lt 2 ; then + echo "Usage: $0 <BASE> <TIP> [CMD|SCRIPT]"
Perhaps
echo "Usage: $0 <BASE> <TIP> [<CMD>|<SCRIPT>]"
? Also I'm not clear why you make the distinction between command and script.
Quoted 4 lines
scripts/build-test.sh new file +4
-0+ exit 1 +fi + +BASE=$1
scripts/build-test.sh line 36
Quoted 10 lines
scripts/build-test.sh new file +10
-0+TIP=$2 +CMD=${3:-git clean -fdx && ./configure && make -j4} + +echo "Running command \"$CMD\" on every commit from $BASE to $TIP" +echo -n "Starting in " + +for i in `seq 5 -1 1`; do + echo -n "$i ... " + sleep 1 +done
What is this startup delay intended for?
scripts/build-test.sh line 40
Quoted 3 lines
scripts/build-test.sh new file +3
-0+echo + +git rebase $BASE $TIP -x "$CMD"
Is this quoting on $CMD really going to work right no matter what the variable actually expands to? I.e. don't you either want to use "eval" or adjust script arguments such that you can use "$@" with its special quoting rules?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 20.10.17 at 19:32, <[email protected]> wrote:
scripts/build-test.sh new file +13
-0@@ -0,0 +1,40 @@ +#!/bin/sh + +# WARNING: Always backup the branch by creating another reference to it if +# you're not familiar with git-rebase(1). +# +# Use `git rebase` to run command or script on every commit within the range +# specified. If no command or script is provided, use the default one to clean +# and build the whole tree. +# +# If something goes wrong, the script will stop at the commit that fails. Fix +# the failure and run `git rebase --continue`. +# +# If for any reason the tree is screwed, use `git rebase --abort` to restore to
Quoted 9 lines
scripts/build-test.sh line 17
Quoted 4 lines
scripts/build-test.sh new file +4
-0+# original state. + +if ! test -f xen/Kconfig; then + echo "Please run this script from top-level directory"Wouldn't running this in one of the top-level sub-trees also be useful? E.g. why would one want a hypervisor only series not touching the public interface to have the tools tree rebuilt all the time?
You can do that by supplying your custom command.
The script really aims to be an easy to use thing to point contributors to hence the checks, warning and restrictions, while at the same time allows some flexibility.
For example, if you want to build hypervisor only:
$ ./scripts/build-test.sh $BASE $TIP "make -C xen clean && make -C xen"
Quoted 8 lines
scripts/build-test.sh line 22
Quoted 5 lines
scripts/build-test.sh new file +5
-0+ exit 1 +fi + +if test $# -lt 2 ; then + echo "Usage: $0 <BASE> <TIP> [CMD|SCRIPT]"Perhaps
Quoted 5 lines
echo "Usage: $0 <BASE> <TIP> [<CMD>|<SCRIPT>]"? Also I'm not clear why you make the distinction between command and script.
I will just use CMD here.
Quoted 8 lines
Quoted 8 lines
scripts/build-test.sh new file +8
-0+ exit 1 +fi + +BASE=$1 +TIP=$2 +CMD=${3:-git clean -fdx && ./configure && make -j4} + +echo "Running command \"$CMD\" on every commit from $BASE to $TIP"
Quoted 9 lines
scripts/build-test.sh line 36
Quoted 6 lines
scripts/build-test.sh new file +6
-0+echo -n "Starting in " + +for i in `seq 5 -1 1`; do + echo -n "$i ... " + sleep 1 +doneWhat is this startup delay intended for?
To give user a chance to check the command -- git-rebase can be destructive after all.
Quoted 8 lines
scripts/build-test.sh line 40
Quoted 3 lines
scripts/build-test.sh new file +3
-0+echo + +git rebase $BASE $TIP -x "$CMD"Is this quoting on $CMD really going to work right no matter what the variable actually expands to? I.e. don't you either want to use "eval" or adjust script arguments such that you can use "$@" with its special quoting rules?
What sort of use cases you have in mind that involve complex quoting and expansion?
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu writes ("Re: [PATCH for-4.10] scripts: add a script for build testing"):
Quoted 5 lines · Jan Beulich
Quoted 1 line
What is this startup delay intended for?
To give user a chance to check the command -- git-rebase can be destructive after all.
I can't resist this bikeshed. This kind of thing is quite annoying. If your command might be destructive, why not fix it so that it's not destructive.
In particular, if you:
* check that the tree is not dirty
* detach HEAD
* reattach HEAD afterwards at least on success
then the risk of lossage is low and you can safely just go ahead.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines · Ian Jackson
Wei Liu writes ("Re: [PATCH for-4.10] scripts: add a script for build testing"):
Quoted 5 lines · Jan Beulich
Quoted 1 line
What is this startup delay intended for?
To give user a chance to check the command -- git-rebase can be destructive after all.
Quoted 7 lines
I can't resist this bikeshed. This kind of thing is quite annoying. If your command might be destructive, why not fix it so that it's not destructive.
In particular, if you:
* check that the tree is not dirty
* detach HEAD
I think these two checks are good.
Quoted 1 line
* reattach HEAD afterwards at least on success
This is already the case for git-rebase on success.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu writes ("Re: [PATCH for-4.10] scripts: add a script for build testing"):
Quoted 10 lines · Ian Jackson
Quoted 3 lines
In particular, if you:
* check that the tree is not dirty
* detach HEADI think these two checks are good.
Quoted 1 line
* reattach HEAD afterwards at least on success
This is already the case for git-rebase on success.
No. git-rebase _rewrites_ HEAD.
Your script should just check out the intermediate commits. You probably don't in fact want git-rebase. In particular, you don't want to risk merge conflicts.
I have a script I use for dgit testing that looks like this:
#!/bin/bash
#
# run git fetch main # and then this
set -e
set -o pipefail
revspec=main/${STTM_TESTED-tested}..main/pretestecho "testing $revspec ..."
git-rev-list $revspec | nl -ba | tac | \
while read num rev; do
echo >&2 ""
echo >&2 "testing $num $rev"
git checkout $rev
${0%/*}/sometest-to-tested
doneFAOD,
for inclusion of parts of this in the Xen build system.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 6 lines · Ian Jackson
Wei Liu writes ("Re: [PATCH for-4.10] scripts: add a script for build testing"):
Quoted 5 lines · Ian Jackson
Quoted 3 lines
In particular, if you:
* check that the tree is not dirty
* detach HEAD
Quoted 8 lines
Quoted 5 lines
I think these two checks are good.
Quoted 1 line
* reattach HEAD afterwards at least on success
This is already the case for git-rebase on success.
No. git-rebase _rewrites_ HEAD.
I see. I will steal bits from your snippet where appropriate.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 23.10.17 at 13:41, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 20.10.17 at 19:32, <[email protected]> wrote:
scripts/build-test.sh new file +13
-0@@ -0,0 +1,40 @@ +#!/bin/sh + +# WARNING: Always backup the branch by creating another reference to it if +# you're not familiar with git-rebase(1). +# +# Use `git rebase` to run command or script on every commit within the range +# specified. If no command or script is provided, use the default one to clean +# and build the whole tree. +# +# If something goes wrong, the script will stop at the commit that fails. Fix +# the failure and run `git rebase --continue`. +# +# If for any reason the tree is screwed, use `git rebase --abort` to restore toQuoted 9 lines
scripts/build-test.sh line 17
Quoted 4 lines
scripts/build-test.sh new file +4
-0+# original state. + +if ! test -f xen/Kconfig; then + echo "Please run this script from top-level directory"Wouldn't running this in one of the top-level sub-trees also be useful? E.g. why would one want a hypervisor only series not touching the public interface to have the tools tree rebuilt all the time?
Quoted 1 line
You can do that by supplying your custom command.
Oh, of course - silly me.
Quoted 11 lines
Quoted 8 lines
scripts/build-test.sh line 40
Quoted 3 lines
scripts/build-test.sh new file +3
-0+echo + +git rebase $BASE $TIP -x "$CMD"Is this quoting on $CMD really going to work right no matter what the variable actually expands to? I.e. don't you either want to use "eval" or adjust script arguments such that you can use "$@" with its special quoting rules?
What sort of use cases you have in mind that involve complex quoting and expansion?
A typical cross build command line of mine looks like
make -sC build/xen/$v {XEN_TARGET_ARCH,t}=x86_64 CC=gccx LD=ldx OBJCOPY=objcopyx NM=nmx -j32 xen
which you can see leverages the fact that make allows variable settings on the command line. For other utilities this would require e.g. "CC=gccx my-script", and I'm not sure whether quoting you apply would work right (largely depends on what git does with the argument).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu writes ("Re: [PATCH for-4.10] scripts: add a script for build testing"):
Quoted 8 lines · Jan Beulich
Quoted 7 lines · On 20.10.17 at 19:32, <[email protected]> wrote:
Quoted 1 line
+git rebase $BASE $TIP -x "$CMD"
Is this quoting on $CMD really going to work right no matter what the variable actually expands to? I.e. don't you either want to use "eval" or adjust script arguments such that you can use "$@" with its special quoting rules?
Yes. Jan is completely right.
Quoted 2 lines
What sort of use cases you have in mind that involve complex quoting and expansion?
There is really no excuse at all, in a script like this, for not using `shift' to eat the main positional parameters, and then executing "$@", faithfully reproducing the incoming parameters.
Of course there is a problem with getting this through git-rebase but as I have just pointed out, git-rev-list and git-checkout are much more suitable building blocks than git-rebase (which does a lot of undesirable stuff that has to be suppressed, etc.)
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Wei,
Quoted 12 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Julien Grall <[email protected]>
Quoted 1 line
The risk for this is zero, hence the for-4.10 tag.
Agree.
Quoted 29 lines
--- scripts/build-test.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100755
scripts/build-test.shscripts/build-test.sh new file +18
-0@@ -0,0 +1,40 @@ +#!/bin/sh + +# WARNING: Always backup the branch by creating another reference to it if +# you're not familiar with git-rebase(1). +# +# Use `git rebase` to run command or script on every commit within the range +# specified. If no command or script is provided, use the default one to clean +# and build the whole tree. +# +# If something goes wrong, the script will stop at the commit that fails. Fix +# the failure and run `git rebase --continue`. +# +# If for any reason the tree is screwed, use `git rebase --abort` to restore to +# original state. + +if ! test -f xen/Kconfig; then + echo "Please run this script from top-level directory" + exit 1
scripts/build-test.sh line 28
Quoted 10 lines
scripts/build-test.sh new file +10
-0+fi + +if test $# -lt 2 ; then + echo "Usage: $0 <BASE> <TIP> [CMD|SCRIPT]" + exit 1 +fi + +BASE=$1 +TIP=$2 +CMD=${3:-git clean -fdx && ./configure && make -j4}
Can you document somewhere that there are no cross-compilation supported?
scripts/build-test.sh line 40
Quoted 13 lines
scripts/build-test.sh new file +12
-0+ +echo "Running command \"$CMD\" on every commit from $BASE to $TIP" +echo -n "Starting in " + +for i in `seq 5 -1 1`; do + echo -n "$i ... " + sleep 1 +done + +echo + +git rebase $BASE $TIP -x "$CMD"
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
scripts/build-test.sh line 37
Quoted 10 lines · Wei Liu
scripts/build-test.sh new file +10
-0+CMD=${3:-git clean -fdx && ./configure && make -j4} + +echo "Running command \"$CMD\" on every commit from $BASE to $TIP" +echo -n "Starting in " + +for i in `seq 5 -1 1`; do + echo -n "$i ... " + sleep 1 +done +
Instead of the count down, I would do:
echo -n 'Continue ? (^C to quit) '
read
OR something like:
echo -n 'Continue ? [Yn] '
read answer
[[ "$answer" =~ ^(|Y|y|yes)$ ]] || exit
I don't like to wait.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 17 lines · Anthony PERARD
scripts/build-test.sh line 37
Quoted 10 lines · Wei Liu
scripts/build-test.sh new file +10
-0+CMD=${3:-git clean -fdx && ./configure && make -j4} + +echo "Running command \"$CMD\" on every commit from $BASE to $TIP" +echo -n "Starting in " + +for i in `seq 5 -1 1`; do + echo -n "$i ... " + sleep 1 +done +Instead of the count down, I would do:
echo -n 'Continue ? (^C to quit) '
read
Quoted 7 lines
OR something like:
echo -n 'Continue ? [Yn] '
read answer
[[ "$answer" =~ ^(|Y|y|yes)$ ]] || exitI don't like to wait.
And I don't like the presure to have to decide if I want to ^C within a limited time. I would probably kill the script if I did not know what it was going to do as soon as I see the count down.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 17 lines · Anthony PERARD
scripts/build-test.sh line 37
Quoted 10 lines · Wei Liu
scripts/build-test.sh new file +10
-0+CMD=${3:-git clean -fdx && ./configure && make -j4} + +echo "Running command \"$CMD\" on every commit from $BASE to $TIP" +echo -n "Starting in " + +for i in `seq 5 -1 1`; do + echo -n "$i ... " + sleep 1 +done +Instead of the count down, I would do:
echo -n 'Continue ? (^C to quit) '
read
Quoted 5 lines
OR something like:
echo -n 'Continue ? [Yn] '
read answer
[[ "$answer" =~ ^(|Y|y|yes)$ ]] || exit
No objection from me. The latter is better.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 12 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Julien Grall <[email protected]>
Quoted 1 line
The risk for this is zero, hence the for-4.10 tag.
I'm not necessarily arguing against this, but in my estimation this isn't zero risk. It's a new feature (even if one only for developers). It's not *intended* to destroy anything, but a bug in it well could destroy data.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 13 lines · George Dunlap
Quoted 12 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Julien Grall <[email protected]>
Quoted 6 lines
Quoted 1 line
The risk for this is zero, hence the for-4.10 tag.
I'm not necessarily arguing against this, but in my estimation this isn't zero risk. It's a new feature (even if one only for developers). It's not *intended* to destroy anything, but a bug in it well could destroy data.
There is a git clean -dxf in the script, this is destructif! I'm sure it's going to take some people by surprise.
FIY, I do like to put script and other files in my checkouts, the git clean will remove them.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 21 lines · Anthony PERARD
Quoted 13 lines · George Dunlap
Quoted 12 lines · Wei Liu
Signed-off-by Wei Liu <[email protected]>---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Julien Grall <[email protected]>Quoted 6 lines
Quoted 1 line
The risk for this is zero, hence the for-4.10 tag.
I'm not necessarily arguing against this, but in my estimation this isn't zero risk. It's a new feature (even if one only for developers). It's not *intended* to destroy anything, but a bug in it well could destroy data.
Quoted 5 lines
There is a
git clean -dxfin the script, this is destructif! I'm sure it's going to take some people by surprise.FIY, I do like to put script and other files in my checkouts, the git clean will remove them.
I changed that to make distclean this morning.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu writes ("Re: [Xen-devel] [PATCH for-4.10] scripts: add a script for build testing"):
Quoted 5 lines · Anthony PERARD
Quoted 2 lines
FIY, I do like to put script and other files in my checkouts, the git clean will remove them.
I changed that to make distclean this morning.
Urgh. This script depends on git, so please continue to use git to check if the tree is clean.
The right answer would be to *check that the tree is clean* before starting.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 5 lines · Ian Jackson
Wei Liu writes ("Re: [Xen-devel] [PATCH for-4.10] scripts: add a script for build testing"):
Quoted 4 lines · Anthony PERARD
Quoted 2 lines
FIY, I do like to put script and other files in my checkouts, the git clean will remove them.
Quoted 7 lines
Quoted 1 line
I changed that to make distclean this morning.
Urgh. This script depends on git, so please continue to use git to check if the tree is clean.
The right answer would be to *check that the tree is clean* before starting.
Sure, that's also something I just did.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel