[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [OSSTest] standalone-reset: actually honour '-f' option



On Fri, 2014-02-14 at 18:41 +0000, Ian Jackson wrote:
> Dario Faggioli writes ("Re: [Xen-devel] [OSSTest] standalone-reset: actually 
> honour '-f' option"):
> > On mer, 2014-01-29 at 14:32 +0000, Dario Faggioli wrote:
> > > standalone-reset's usage says:
> > >     
> > >   usage: ./standalone-reset [<options>] [<branch> [<xenbranch> 
> > > [<buildflight>]]]
> > >    branch and xenbranch default, separately, to xen-unstable
> > >   options:
> > >    -f<flight>     generate flight "flight", default is "standalone"
> > >     
> > > but then there is no place where '-f' is processed, and hence
> > > no real way to pass a specific flight name to make-flight.
> > >     
> > > Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
> ...
> > I know it's a busy period for OSSTest, but this should be pretty
> > straightforward, and it only affects standalone mode.
> 
> Right.  I don't use standalone mode much, so sorry about that.  I
> looked for a comment from Ian C but didn't find one.
> 
> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> 
> 
> > Anyway, I can put it on hold and resubmit in a while, if that's
> > considered better.
> 
> No, pinging now is good.
> 
> This patch leads me to an observation: I looked at the code in
> standalone-reset and it appears to me that there is not currently
> anything which sets "$flight".

This patch from Dario does it I think.

> So the "DELETE" statements used if there's an existing db won't have
> any effect.  This doesn't cause any strange effects because
> Osstest/JobDB/Standalone.pm deletes them too.
> 
> I think it would be best to delete that part of standalone-reset.  Do
> you agree ?

FWIW I've been carrying the following with the intention of using it
from my standalone helper script, since as you've just point out
Standalone.pm also does it then it seems like I could drop the
forget-flight bit.

8<-----------------

From 98f57473e4787620c6cad443ee15cc38b330065d Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Wed, 12 Feb 2014 11:19:45 +0000
Subject: [PATCH] standalone: refactor out some useful bits of standalone-reset

I sometimes want just these bits.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 standalone-forget-flight | 39 +++++++++++++++++++++++++++++++++
 standalone-init-db       | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
 standalone-reset         | 30 ++------------------------
 3 files changed, 97 insertions(+), 28 deletions(-)
 create mode 100755 standalone-forget-flight
 create mode 100755 standalone-init-db

diff --git a/standalone-forget-flight b/standalone-forget-flight
new file mode 100755
index 0000000..6dd6a84
--- /dev/null
+++ b/standalone-forget-flight
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2014 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+usage(){
+       cat <<END
+usage: ./standalone-forget-flight [database] [flight]
+END
+}
+
+if [ $# -ne 2 ] ; then
+       usage >&2
+       exit 1
+fi
+
+db="$1"
+flight="$1"
+
+sqlite3 "$db" <<END
+       DELETE FROM runvars WHERE flight='$flight';
+       DELETE FROM jobs    WHERE flight='$flight';
+       DELETE FROM flights WHERE flight='$flight';
+END
diff --git a/standalone-init-db b/standalone-init-db
new file mode 100755
index 0000000..34a47c4
--- /dev/null
+++ b/standalone-init-db
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2014 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+usage(){
+       cat <<END
+usage: ./standalone-init-db [database]
+END
+}
+
+if [ $# -ne 1 ] ; then
+       usage >&2
+       exit 1
+fi
+
+db="$1"
+
+sqlite3 "$db" <<END
+       CREATE TABLE flights (
+               flight TEXT PRIMARY KEY,
+               blessing TEXT,
+               intended TEXT,
+               branch TEXT
+               );
+       CREATE TABLE jobs (
+               flight TEXT NOT NULL,
+               job TEXT NOT NULL,
+               recipe TEXT NOT NULL,
+               status TEXT NOT NULL,
+               PRIMARY KEY(flight,job)
+               );
+       CREATE TABLE runvars (
+               flight TEXT NOT NULL,
+               job TEXT NOT NULL,
+               name TEXT NOT NULL,
+               val TEXT NOT NULL,
+               synth BOOLEAN NOT NULL,
+               PRIMARY KEY(flight,job,name)
+               );
+END
diff --git a/standalone-reset b/standalone-reset
index 83a6606..ea9d027 100755
--- a/standalone-reset
+++ b/standalone-reset
@@ -122,35 +122,9 @@ case $# in
 esac
 
 if test -f standalone.db; then
-       sqlite3 standalone.db <<END
-               DELETE FROM runvars WHERE flight='$flight';
-               DELETE FROM jobs    WHERE flight='$flight';
-               DELETE FROM flights WHERE flight='$flight';
-END
+       ./standalone-forget-flight standalone.db "$flight"
 else
-       sqlite3 standalone.db <<END
-               CREATE TABLE flights (
-                       flight TEXT PRIMARY KEY,
-                       blessing TEXT,
-                       intended TEXT,
-                       branch TEXT
-                       );
-               CREATE TABLE jobs (
-                       flight TEXT NOT NULL,
-                       job TEXT NOT NULL,
-                       recipe TEXT NOT NULL,
-                       status TEXT NOT NULL,
-                       PRIMARY KEY(flight,job)
-                       );
-               CREATE TABLE runvars (
-                       flight TEXT NOT NULL,
-                       job TEXT NOT NULL,
-                       name TEXT NOT NULL,
-                       val TEXT NOT NULL,
-                       synth BOOLEAN NOT NULL,
-                       PRIMARY KEY(flight,job,name)
-                       );
-END
+       ./standalone-db-init standalone.db
 fi
 
 : ${BUILD_LVEXTEND_MAX:=50}
-- 
1.8.5.2




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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.