All of lore.kernel.org
 help / color / mirror / Atom feed
* [OSSTest] standalone-reset: actually honour '-f' option
@ 2014-01-29 14:32 Dario Faggioli
  2014-02-14 18:11 ` Dario Faggioli
  0 siblings, 1 reply; 5+ messages in thread
From: Dario Faggioli @ 2014-01-29 14:32 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell, Ian Jackson


[-- Attachment #1.1: Type: text/plain, Size: 1138 bytes --]

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@citrix.com>

diff --git a/standalone-reset b/standalone-reset
index 8be7e86..846561d 100755
--- a/standalone-reset
+++ b/standalone-reset
@@ -27,6 +27,15 @@ options:
 END
 }
 
+flight="standalone"
+while getopts "f:" opt; do
+    case "$opt" in
+        f) flight=${OPTARG};;
+        *) usage; exit 1;;
+    esac
+done
+shift $((OPTIND-1))
+
 if [ -f standalone.config ] ; then
     . standalone.config
 fi

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [OSSTest] standalone-reset: actually honour '-f' option
  2014-01-29 14:32 [OSSTest] standalone-reset: actually honour '-f' option Dario Faggioli
@ 2014-02-14 18:11 ` Dario Faggioli
  2014-02-14 18:41   ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Dario Faggioli @ 2014-02-14 18:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell, Ian Jackson


[-- Attachment #1.1: Type: text/plain, Size: 1052 bytes --]

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@citrix.com>
> 
Ping?

I know it's a busy period for OSSTest, but this should be pretty
straightforward, and it only affects standalone mode.

Anyway, I can put it on hold and resubmit in a while, if that's
considered better.

Thanks and Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OSSTest] standalone-reset: actually honour '-f' option
  2014-02-14 18:11 ` Dario Faggioli
@ 2014-02-14 18:41   ` Ian Jackson
  2014-02-18 10:11     ` Ian Campbell
  2014-02-18 11:36     ` Dario Faggioli
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Jackson @ 2014-02-14 18:41 UTC (permalink / raw)
  To: raistlin; +Cc: Ian Campbell, xen-devel

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@citrix.com>
...
> 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@eu.citrix.com>


> 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".

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 ?

In the meantime I have added your patch to my queue branch.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OSSTest] standalone-reset: actually honour '-f' option
  2014-02-14 18:41   ` Ian Jackson
@ 2014-02-18 10:11     ` Ian Campbell
  2014-02-18 11:36     ` Dario Faggioli
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2014-02-18 10:11 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, raistlin

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@citrix.com>
> ...
> > 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@eu.citrix.com>
> 
> 
> > 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@citrix.com>
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@citrix.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [OSSTest] standalone-reset: actually honour '-f' option
  2014-02-14 18:41   ` Ian Jackson
  2014-02-18 10:11     ` Ian Campbell
@ 2014-02-18 11:36     ` Dario Faggioli
  1 sibling, 0 replies; 5+ messages in thread
From: Dario Faggioli @ 2014-02-18 11:36 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Ian Campbell, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1871 bytes --]

On ven, 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@citrix.com>
>
> Right.  I don't use standalone mode much, so sorry about that.
>
I know... That's fine. :-)

> 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".
> 
Indeed, that's what this does.

> 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 ?
> 
Well, if it's either never invoked (right now, without this patch) or
duplicate (with this patch), I certainly think it can be removed.

I'll send a patch to that effect.

> In the meantime I have added your patch to my queue branch.
> 
Ok, thanks.

Regards,
Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-18 11:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29 14:32 [OSSTest] standalone-reset: actually honour '-f' option Dario Faggioli
2014-02-14 18:11 ` Dario Faggioli
2014-02-14 18:41   ` Ian Jackson
2014-02-18 10:11     ` Ian Campbell
2014-02-18 11:36     ` Dario Faggioli

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.