Skip to contentSkip to conversation

standalone-reset: actually honour '-f' option

OSSTest Dario Faggioli 4 participants 5 messages Jan 29, 2014 – Feb 18, 2014

lore
Share & tools
lore
#0 lore raw

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.

standalone-reset +9 -0
index 8be7e86..846561d 100755
@@ -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
Signature · 4 lines
<<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)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 7 lines · Dario Faggioli

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"

Quoted 5 lines

but then there is no place where '-f' is processed, and hence no real way to pass a specific flight name to make-flight.

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

Signature · 4 lines
<<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)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by
#2 lore raw

Dario Faggioli writes ("Re: [Xen-devel] [OSSTest] standalone-reset: actually honour '-f' option"):

Quoted 12 lines · Dario Faggioli
Quoted 11 lines

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.

...

Quoted 2 lines

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.

Quoted 2 lines

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.

#3 lore raw
Quoted 23 lines · Ian Jackson

Dario Faggioli writes ("Re: [Xen-devel] [OSSTest] standalone-reset: actually honour '-f' option"):

Quoted 12 lines · Dario Faggioli
Quoted 11 lines

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.

...

Quoted 2 lines

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.

Quoted 8 lines
Quoted 2 lines

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.

Quoted 6 lines

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

Quoted 1 line

From 98f57473e4787620c6cad443ee15cc38b330065d Mon Sep 17 00:00:00 2001

From: Ian Campbell <[email protected]>
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.

---
 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
standalone-forget-flight new file +39 -0
new file mode 100755
index 0000000..6dd6a84
@@ -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
standalone-init-db new file +56 -0

56 lines not on this page · raw message

standalone-reset +2 -28
index 83a6606..ea9d027 100755
@@ -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}
Signature · 1 line
1.8.5.2
#4 lore raw
In reply to Ian Jackson
Quoted 9 lines · Ian Jackson

Dario Faggioli writes ("Re: [Xen-devel] [OSSTest] standalone-reset: actually honour '-f' option"):

Quoted 8 lines · Dario Faggioli
Quoted 7 lines

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"

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

but then there is no place where '-f' is processed, and hence no real way to pass a specific flight name to make-flight.

Right. I don't use standalone mode much, so sorry about that.

I know... That's fine. :-)

Quoted 4 lines

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.

Quoted 7 lines

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.

Quoted 2 lines

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

Ok, thanks.

Regards,
Dario

Signature · 4 lines
<<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)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel