diff mbox

[v2,6/9] ts-xen-build: Build the livepatch test-cases

Message ID 20170518064925.GA28013@osstest.dumpdata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk May 18, 2017, 6:49 a.m. UTC
> or something ?

I ended up doing two patches - one to create an enable_livepatch
(in mfi-common) to seed the jobs.

And then another to piggyback on that.

I am attaching them here (as attachment), and I think it makes
it simpler?

Comments

Ian Jackson May 18, 2017, 4:47 p.m. UTC | #1
Konrad Rzeszutek Wilk writes ("Re: [PATCH v2 6/9] ts-xen-build: Build the livepatch test-cases"):
> > or something ?
> 
> I ended up doing two patches - one to create an enable_livepatch
> (in mfi-common) to seed the jobs.
> 
> And then another to piggyback on that.
> 
> I am attaching them here (as attachment), and I think it makes
> it simpler?

Why wouldn't you simply always build the live patch if it is
available ?

I don't think this runvar-based system, where the xen version is
tested, is a very good idea.

> @@ -95,6 +96,12 @@ sub checkout () {
>         echo >>.config LIBLEAFDIR_x86_64=lib
>         echo >>.config KERNELS=''
>  END
> +               (${enable_livepatch} ? <<END : '').
> +       if test -f xen/Kconfig; then
> +               echo >>xen/.config CONFIG_LIVEPATCH=y
> +               echo >>xen/.config CONFIG_FAST_SYMBOL_LOOKUP=y
> +    fi
> +END

I see you copied this from the xsm build, but I think there is no
reason for osstest to ever build without livepatching support ?  So
this could be unconditional.  You could put it nexst to CONFIG_EXPERT
and _FEP and _VERBOSE_DEBUG.

> +    if ($enable_livepatch) {
> +        buildcmd_stamped_logged(600, 'xen', 'xenlpt', <<END,<<END,'')
> +            export XEN_ROOT=$builddir/xen
> +            export DESTDIR=$builddir/xen/dist/xenlpt
> +            export BASEDIR=$builddir/xen/xen
> +            mkdir -p \${DESTDIR}/usr/lib/debug
> +END
> +            $make_prefix make -C xen/test -f $builddir/xen/xen/Rules.mk install

So here this would need to be conditional.  But it should be
conditional on whether the build can produce it, so use
target_file_exists.

Ian.
Konrad Rzeszutek Wilk May 18, 2017, 7:57 p.m. UTC | #2
On Thu, May 18, 2017 at 05:47:08PM +0100, Ian Jackson wrote:
> Konrad Rzeszutek Wilk writes ("Re: [PATCH v2 6/9] ts-xen-build: Build the livepatch test-cases"):
> > > or something ?
> > 
> > I ended up doing two patches - one to create an enable_livepatch
> > (in mfi-common) to seed the jobs.
> > 
> > And then another to piggyback on that.
> > 
> > I am attaching them here (as attachment), and I think it makes
> > it simpler?
> 
> Why wouldn't you simply always build the live patch if it is
> available ?
> 
> I don't think this runvar-based system, where the xen version is
> tested, is a very good idea.

Oh. See below please why I choose that route.
> 
> > @@ -95,6 +96,12 @@ sub checkout () {
> >         echo >>.config LIBLEAFDIR_x86_64=lib
> >         echo >>.config KERNELS=''
> >  END
> > +               (${enable_livepatch} ? <<END : '').
> > +       if test -f xen/Kconfig; then
> > +               echo >>xen/.config CONFIG_LIVEPATCH=y
> > +               echo >>xen/.config CONFIG_FAST_SYMBOL_LOOKUP=y
> > +    fi
> > +END
> 
> I see you copied this from the xsm build, but I think there is no
> reason for osstest to ever build without livepatching support ?  So
> this could be unconditional.  You could put it nexst to CONFIG_EXPERT
> and _FEP and _VERBOSE_DEBUG.

OK.
> 
> > +    if ($enable_livepatch) {
> > +        buildcmd_stamped_logged(600, 'xen', 'xenlpt', <<END,<<END,'')
> > +            export XEN_ROOT=$builddir/xen
> > +            export DESTDIR=$builddir/xen/dist/xenlpt
> > +            export BASEDIR=$builddir/xen/xen
> > +            mkdir -p \${DESTDIR}/usr/lib/debug
> > +END
> > +            $make_prefix make -C xen/test -f $builddir/xen/xen/Rules.mk install
> 
> So here this would need to be conditional.  But it should be
> conditional on whether the build can produce it, so use
> target_file_exists.

OK. Now here comes the more difficult problem. The patch to make 'make
-C xen/test install' work is not yet in Xen 4.9. So earlier versions
would fail :-(

I could do a check in xen/test/Makefile for an install stanze or just
have an check for a version of Xen?

Or do what I had done in the previous patch (which you didn't like)
which was to just a combination of 'find' and copy them by hand.

Thoughts:
 a) Depend on Xen version (and my patch to add install stanze in
    xen/test/Makefile making it in Xen 4.9).
 b) USe the old approach of 'find' and 'cp' the *.livepatch files
    (works with Xen 4.8, 4.9).
 c) Base it on Xen version and only allow Xen 4.9 and later to be
    tested.

?
> 
> Ian.
diff mbox

Patch

From e7d697d4812ea22171fc738435c640adb5df1363 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Mon, 21 Nov 2016 17:11:13 -0500
Subject: [PATCH v3 4/7] ts-xen-build: Build livepatches test-cases

Livepatch compiles and works on x86/ARM{32|64} so we can
enable it. It only gets built and put in xentlpdist.tar.gz
if enable_livepatch is set to true.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
v1: New posting
v2: Put the livepatch test-cases in xentlpdist.tar.gz file
v3: Use enable_livepatch to gate the build and tarring the test-cases.
---
 ts-xen-build | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ts-xen-build b/ts-xen-build
index 31acb9d..92f467b 100755
--- a/ts-xen-build
+++ b/ts-xen-build
@@ -51,6 +51,7 @@  $dashdashdash //= -1;
 builddirsprops();
 
 my $enable_xsm = ($r{enable_xsm}//'false') =~ m/true/ ? 1 : 0;
+my $enable_livepatch = ($r{enable_livepatch}//'false') =~ m/true/ ? 1 : 0;
 
 $buildcmd_global_prefix= <<END;
     export XEN_CONFIG_EXPERT=y
@@ -95,6 +96,12 @@  sub checkout () {
 	echo >>.config LIBLEAFDIR_x86_64=lib
 	echo >>.config KERNELS=''
 END
+               (${enable_livepatch} ? <<END : '').
+	if test -f xen/Kconfig; then
+		echo >>xen/.config CONFIG_LIVEPATCH=y
+		echo >>xen/.config CONFIG_FAST_SYMBOL_LOOKUP=y
+    fi
+END
                (nonempty($r{enable_xsm}) ? <<END : '').
 	if test -f xen/Kconfig; then
 		echo >>xen/.config CONFIG_XSM='${build_xsm}'
@@ -164,6 +171,18 @@  END
 END
 	store_runvar("flaskpolicy", "xenpolicy-" . $xen_version);
     }
+
+    if ($enable_livepatch) {
+        buildcmd_stamped_logged(600, 'xen', 'xenlpt', <<END,<<END,'')
+            export XEN_ROOT=$builddir/xen
+            export DESTDIR=$builddir/xen/dist/xenlpt
+            export BASEDIR=$builddir/xen/xen
+            mkdir -p \${DESTDIR}/usr/lib/debug
+END
+            $make_prefix make -C xen/test -f $builddir/xen/xen/Rules.mk install
+END
+
+    }
 }
 
 sub divide () {
@@ -209,6 +228,7 @@  sub stash () {
                     "xen/dist/${part}install",
                     "${part}dist");
     }
+    built_stash($ho, $builddir, "xen/dist/xenlpt", "xenlptdist") if $enable_livepatch;
     built_stash_file($ho, $builddir, "xen-syms", "xen/xen/xen-syms", 1);
     built_stash_file($ho, $builddir, "xen-config", "xen/.config", 1);
     built_stash_file($ho, $builddir, "xen-hv-config", "xen/xen/.config", 1);
-- 
2.1.4