Skip to contentSkip to conversation

OSSTEST: introduce a raisin build test

PATCH Superseded Stefano Stabellini 3 participants 6 messages May 12, 2015 – Jun 17, 2015

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 OSSTEST: introduce a raisin build test

---

Changes in v5:
- remove setting DEFAULT_REVISION_RAISIN to master
- disable raisin when branch is not xen*
- do not overwrite raisin default variables unless both revision_* and tree_* are set of a given component

Changes in v4:
- introduce enable_raisin in mfi-common: only build raisin when building xen-unstable
- start off from the default raisin config, then append osstest config options to it
- do not write variable to the raisin config if the conrresponding runvar is not set
- remove TREE_OVMF and TREE_SEABIOS

Changes in v3:
- use $raisindir throughout ts-raisin-build
- do not specify ENABLED_COMPONENTS so that empty REVISION variables can be used to disable building a raisin component

Changes in v2:
- set revision_* variables in mfi-common;
- in ts-raisin-build set the *_REVISION config options based on the revision_* variables;
- in ts-raisin-build, call store_revision appropriately;
- divide the output in an hypervisor and a tools tarball.

---
 ap-common       |    2 +
 mfi-common      |   41 +++++++++++++
 sg-run-job      |    5 ++
 ts-raisin-build |  173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 221 insertions(+)
 create mode 100755 ts-raisin-build
ap-common +2 -0
index 64749e3..60eaf66 100644
@@ -47,6 +47,8 @@
 # rumpsrc-related runvars needed only for old rumpuser-xen
 # (ie ones which need $bodges=1 in ts-rumpuserxen-build)
 
+: ${TREE_RAISIN:=git://xenbits.xen.org/people/sstabellini/raisin.git}
+
 : ${TREE_SEABIOS_UPSTREAM:=git://git.seabios.org/seabios.git}
 : ${PUSH_TREE_SEABIOS:=$XENBITS:/home/xen/git/osstest/seabios.git}
 : ${BASE_TREE_SEABIOS:=git://xenbits.xen.org/osstest/seabios.git}
mfi-common +41 -0

53 lines not on this page · raw message

sg-run-job +5 -0
index eae159d..449118d 100755
@@ -346,6 +346,7 @@ proc need-hosts/build {} { return BUILD }
 proc need-hosts/build-kern {} { return BUILD }
 proc need-hosts/build-libvirt {} { return BUILD }
 proc need-hosts/build-rumpuserxen {} { return BUILD }
+proc need-hosts/build-raisin {} { return BUILD }
 
 proc run-job/build {} {
     run-ts . = ts-xen-build
@@ -364,6 +365,10 @@ proc run-job/build-rumpuserxen {} {
     run-ts . = ts-xen-build + host tools
 }
 
+proc run-job/build-raisin {} {
+    run-ts . = ts-raisin-build
+}
+
 proc prepare-build-host {} {
     global jobinfo
     run-ts broken = ts-hosts-allocate + host
ts-raisin-build new file +173 -0

173 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw

Stefano Stabellini writes ("[PATCH v5] OSSTEST: introduce a raisin build test"):

Quoted 1 line

...

ts-raisin-build line 49

Quoted 2 lines
ts-raisin-build new file +2 -0
+    echo >>config XEN_URL=\\"$r{tree_xen}\\"
+    echo >>config XEN_REVISION=\\"$r{revision_xen}\\"

This is very repetitive. In ts-xen-build, the names of the variables are irregular, but here they are regular. I think you should refactor this accordingly.

I don't understand what the \\ are doing here. Perhaps you should use '' like in ts-xen-build ?

Quoted 15 lines
ts-raisin-build new file +15 -0
+sub divide () {
+    # Only move hv to xeninstall, so that we can have
+    # xenpolicy in tools tarball.
+    #
+    # The files inside boot/ after `make dist' are
+    # xen-$XEN_VERSION: Xen binary
+    # xen.gz/xen: symlink to xen-$XEN_VERSION
+    # xen-$MAJOR: symlink to xen-$XEN_VERSION
+    # xen-$MAJOR.$MINOR: symlink to xen-$XEN_VERSION
+    # xen-sym-$XEN_VERSION: Xen symbol
+    # xenpolicy-$XEN_VERSION: flask policy binary if xsm is enabled
+    #
+    # So the following snippet will leave xenpolicy* in
+    # install/boot and get packaged to tools tarball.
+    target_cmd_build($ho, 100, $builddir, <<END);

ts-raisin-build line 136

Quoted 10 lines
ts-raisin-build new file +10 -0
+        cd raisin
+        mkdir xendist
+        for f in *dist; do
+            mkdir -p \$f/lib
+        done
+        if test -d dist/boot; then
+            if test -f dist/boot/xen.gz || test -f dist/boot/xen; then
+                mkdir xendist/boot
+                mvfiles=`find dist/boot -name 'xen[a-z]*' -prune -o -name 'xen*' -print`
+                mv \$mvfiles xendist/boot/.

This, and much of stash(), is a clone-and-hack of ts-xen-build.

ts-raisin-build line 162

Quoted 7 lines
ts-raisin-build new file +7 -0
+our @probs;
+
+sub trapping ($) {
+    my ($sub) = @_;
+    my $tok= eval { $sub->(); 1; };
+    if (!$tok) { push @probs, $@; print STDERR "failure (trapped): $@\n"; }
+}

Again, this is copied from ts-xen-build.

Ian.

#2 lore raw
Quoted 9 lines · Ian Jackson

Stefano Stabellini writes ("[PATCH v5] OSSTEST: introduce a raisin build test"):

Quoted 1 line

...

ts-raisin-build line 49

Quoted 2 lines
ts-raisin-build new file +2 -0
+    echo >>config XEN_URL=\\"$r{tree_xen}\\"
+    echo >>config XEN_REVISION=\\"$r{revision_xen}\\"

This is very repetitive. In ts-xen-build, the names of the variables are irregular, but here they are regular. I think you should refactor this accordingly.

I think that the cure here would be worse than the disease. In bash would be fragile and difficult to read, but you probably would do it in perl, right? In that case I don't know how it would look like; in fact I wouldn't know how to write it. However if you are keen on it, feel free to provide a snippet of code and I'll try to include it in the patch.

Quoted 2 lines

I don't understand what the \\ are doing here. Perhaps you should use '' like in ts-xen-build ?

I need to retain the " in the output

Quoted 28 lines
Quoted 15 lines
ts-raisin-build new file +15 -0
+sub divide () {
+    # Only move hv to xeninstall, so that we can have
+    # xenpolicy in tools tarball.
+    #
+    # The files inside boot/ after `make dist' are
+    # xen-$XEN_VERSION: Xen binary
+    # xen.gz/xen: symlink to xen-$XEN_VERSION
+    # xen-$MAJOR: symlink to xen-$XEN_VERSION
+    # xen-$MAJOR.$MINOR: symlink to xen-$XEN_VERSION
+    # xen-sym-$XEN_VERSION: Xen symbol
+    # xenpolicy-$XEN_VERSION: flask policy binary if xsm is enabled
+    #
+    # So the following snippet will leave xenpolicy* in
+    # install/boot and get packaged to tools tarball.
+    target_cmd_build($ho, 100, $builddir, <<END);

ts-raisin-build line 136

Quoted 10 lines
ts-raisin-build new file +10 -0
+        cd raisin
+        mkdir xendist
+        for f in *dist; do
+            mkdir -p \$f/lib
+        done
+        if test -d dist/boot; then
+            if test -f dist/boot/xen.gz || test -f dist/boot/xen; then
+                mkdir xendist/boot
+                mvfiles=`find dist/boot -name 'xen[a-z]*' -prune -o -name 'xen*' -print`
+                mv \$mvfiles xendist/boot/.

This, and much of stash(), is a clone-and-hack of ts-xen-build.

Quoted 9 lines

ts-raisin-build line 162

Quoted 7 lines
ts-raisin-build new file +7 -0
+our @probs;
+
+sub trapping ($) {
+    my ($sub) = @_;
+    my $tok= eval { $sub->(); 1; };
+    if (!$tok) { push @probs, $@; print STDERR "failure (trapped): $@\n"; }
+}

Again, this is copied from ts-xen-build.

Yes, it is. If this is not a descriptive comment, what would you have me do? I could move trapping somewhere else common, but I don't think that generalizing divide and stash is a good idea.

#3 lore raw
Quoted 11 lines · Stefano Stabellini
Quoted 9 lines · Ian Jackson

Stefano Stabellini writes ("[PATCH v5] OSSTEST: introduce a raisin build test"):

Quoted 1 line

...

ts-raisin-build line 49

Quoted 2 lines
ts-raisin-build new file +2 -0
+    echo >>config XEN_URL=\\"$r{tree_xen}\\"
+    echo >>config XEN_REVISION=\\"$r{revision_xen}\\"

This is very repetitive. In ts-xen-build, the names of the variables are irregular, but here they are regular. I think you should refactor this accordingly.

Quoted 5 lines

I think that the cure here would be worse than the disease. In bash would be fragile and difficult to read, but you probably would do it in perl, right? In that case I don't know how it would look like; in fact I wouldn't know how to write it. However if you are keen on it, feel free to provide a snippet of code and I'll try to include it in the patch.

Something like:

foreach (qw(xen foo bar)) {
       (nonempty($r{tree_$_}) && nonempty($r{revision_$_}) ? <<END : '').
    echo >>config ".uc($_)."_URL=\\"$r{tree_$_}\\"
    echo >>config ".uc($_)."_REVISION=\\"$r{revision_$_}\\"

+END
}
I think.

Quoted 6 lines
Quoted 4 lines

I don't understand what the \\ are doing here. Perhaps you should use '' like in ts-xen-build ?

I need to retain the " in the output

If you use ' as your quote character then you do not need to escape uses of ". However I think that would stop $r{tree_$_} being evaluated too, so you would need to do like I did with uc above and use . to paste strings together, which may not be an overall improvement.

Quoted 38 lines
Quoted 28 lines
Quoted 15 lines
ts-raisin-build new file +15 -0
+sub divide () {
+    # Only move hv to xeninstall, so that we can have
+    # xenpolicy in tools tarball.
+    #
+    # The files inside boot/ after `make dist' are
+    # xen-$XEN_VERSION: Xen binary
+    # xen.gz/xen: symlink to xen-$XEN_VERSION
+    # xen-$MAJOR: symlink to xen-$XEN_VERSION
+    # xen-$MAJOR.$MINOR: symlink to xen-$XEN_VERSION
+    # xen-sym-$XEN_VERSION: Xen symbol
+    # xenpolicy-$XEN_VERSION: flask policy binary if xsm is enabled
+    #
+    # So the following snippet will leave xenpolicy* in
+    # install/boot and get packaged to tools tarball.
+    target_cmd_build($ho, 100, $builddir, <<END);

ts-raisin-build line 136

Quoted 10 lines
ts-raisin-build new file +10 -0
+        cd raisin
+        mkdir xendist
+        for f in *dist; do
+            mkdir -p \$f/lib
+        done
+        if test -d dist/boot; then
+            if test -f dist/boot/xen.gz || test -f dist/boot/xen; then
+                mkdir xendist/boot
+                mvfiles=`find dist/boot -name 'xen[a-z]*' -prune -o -name 'xen*' -print`
+                mv \$mvfiles xendist/boot/.

This, and much of stash(), is a clone-and-hack of ts-xen-build.

Quoted 9 lines

ts-raisin-build line 162

Quoted 7 lines
ts-raisin-build new file +7 -0
+our @probs;
+
+sub trapping ($) {
+    my ($sub) = @_;
+    my $tok= eval { $sub->(); 1; };
+    if (!$tok) { push @probs, $@; print STDERR "failure (trapped): $@\n"; }
+}

Again, this is copied from ts-xen-build.

Quoted 3 lines

Yes, it is. If this is not a descriptive comment, what would you have me do? I could move trapping somewhere else common, but I don't think that generalizing divide and stash is a good idea.

Osstest/Testsupport.pm is a suitable home for any random shared code I think, even if only shared between two ts-*. Or Osstest/Buildsupport.pm might be a better choice in this case.

Thinking back to the issue about dividing the raisin build into per components though, perhaps use_raisin should become a runvar which is used in ts-*-build to either do the existing thing vs the new raisin thing? Then stash+divide etc would only be used in the one place, just consuming a potentially different dist dir output from the build phase.

Ian.

#4 lore raw
In reply to Stefano Stabellini

Stefano Stabellini writes ("Re: [PATCH v5] OSSTEST: introduce a raisin build test"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

I don't understand what the \\ are doing here. Perhaps you should use '' like in ts-xen-build ?

I need to retain the " in the output

raisin doesn't cope with '' in the config file ?

Quoted 9 lines
Quoted 3 lines

This is very repetitive. In ts-xen-build, the names of the variables are irregular, but here they are regular. I think you should refactor this accordingly.

I think that the cure here would be worse than the disease. In bash would be fragile and difficult to read, but you probably would do it in perl, right? In that case I don't know how it would look like; in fact I wouldn't know how to write it. However if you are keen on it, feel free to provide a snippet of code and I'll try to include it in the patch.

Yes, it should be done in perl. Something like:

    foreach my $treename (qw(xen seabios blah blah)) {
        $buildcmd .= <<END;
            echo >>config \U$treename\E_URL='$r{"tree_$treename"}'
            echo >>config \U$treename\E_REVISION='$r{"revision_$treename"}'
END
    }

(Untested; adjust to taste.)

Quoted 5 lines
Quoted 1 line

Again, this is copied from ts-xen-build.

Yes, it is. If this is not a descriptive comment, what would you have me do? I could move trapping somewhere else common, but I don't think that generalizing divide and stash is a good idea.

divide should be moved into BuildSupport, probably. There, it would need a slightly longer name, and perhaps to take some more of its variables as parameters.

It doesn't need to be "generalised", since you want it basically as-is.

Ian.

#5 lore raw
Quoted 19 lines · Ian Jackson

Stefano Stabellini writes ("Re: [PATCH v5] OSSTEST: introduce a raisin build test"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

I don't understand what the \\ are doing here. Perhaps you should use '' like in ts-xen-build ?

I need to retain the " in the output

raisin doesn't cope with '' in the config file ?

Quoted 9 lines
Quoted 3 lines

This is very repetitive. In ts-xen-build, the names of the variables are irregular, but here they are regular. I think you should refactor this accordingly.

I think that the cure here would be worse than the disease. In bash would be fragile and difficult to read, but you probably would do it in perl, right? In that case I don't know how it would look like; in fact I wouldn't know how to write it. However if you are keen on it, feel free to provide a snippet of code and I'll try to include it in the patch.

Quoted 9 lines

Yes, it should be done in perl. Something like:

    foreach my $treename (qw(xen seabios blah blah)) {
        $buildcmd .= <<END;
            echo >>config \U$treename\E_URL='$r{"tree_$treename"}'
            echo >>config \U$treename\E_REVISION='$r{"revision_$treename"}'
END
    }

I see what you mean now, but the variable names are not that regular; this wouldn't work. In particular we have:

QEMU_URL, QEMU_REVISION and tree_qemuu, revision_qemuu QEMU_TRADITIONAL_URL, QEMU_TRADITIONAL_REVISION and tree_qemu, revision_qemu

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Again, this is copied from ts-xen-build.

Yes, it is. If this is not a descriptive comment, what would you have me do? I could move trapping somewhere else common, but I don't think that generalizing divide and stash is a good idea.

Quoted 6 lines

divide should be moved into BuildSupport, probably. There, it would need a slightly longer name, and perhaps to take some more of its variables as parameters.

It doesn't need to be "generalised", since you want it basically as-is.

OK, I should be able to do that.