[libvirt] [PATCH 0/2] tests: Fix virsh-uriprecedence when ran as root

Basically v2 of http://www.redhat.com/archives/libvir-list/2013-September/msg00689.html Martin Kletzander (2): test-lib: Make case skipping possible tests: Don't test user config file if ran as root tests/test-lib.sh | 18 ++++++++++++++++++ tests/virsh-uriprecedence | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) -- 1.8.3.2

Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- tests/test-lib.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 2f79706..e612f8f 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -41,6 +41,24 @@ test_intro() fi } +test_skip_case() +{ + counter=$1 + name=$2 + reason=$3 + if test "$verbose" = "0" ; then + mod=`expr \( $counter + 40 - 1 \) % 40` + if test "$counter" != 1 && test "$mod" = 0 ; then + printf " %-3d\n" `expr $counter - 1` + printf " " + fi + printf "_" + else + printf "%3d) %-60s ... SKIP\n" "$counter" "$name" + printf " case skipped: %s\n" "$reason" + fi +} + test_result() { counter=$1 -- 1.8.3.2

Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- tests/virsh-uriprecedence | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/virsh-uriprecedence b/tests/virsh-uriprecedence index f4d84a4..aa90efe 100755 --- a/tests/virsh-uriprecedence +++ b/tests/virsh-uriprecedence @@ -56,7 +56,11 @@ bad_uri="test:///default?bad_uri" good_uri="test:///default?good_uri" printf "uri_default=\"%s\"\n" "$good_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" -test_uri "User config file" +if uid_is_privileged_; then + test_skip_case "$counter" "User config file" "must be run as root" +else + test_uri "User config file" +fi printf "uri_default=\"%s\"\n" "$bad_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" export LIBVIRT_DEFAULT_URI="$good_uri" -- 1.8.3.2

On Thu, Sep 12, 2013 at 01:28:45PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- tests/virsh-uriprecedence | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/virsh-uriprecedence b/tests/virsh-uriprecedence index f4d84a4..aa90efe 100755 --- a/tests/virsh-uriprecedence +++ b/tests/virsh-uriprecedence @@ -56,7 +56,11 @@ bad_uri="test:///default?bad_uri" good_uri="test:///default?good_uri"
printf "uri_default=\"%s\"\n" "$good_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" -test_uri "User config file" +if uid_is_privileged_; then + test_skip_case "$counter" "User config file" "must be run as root"
Should that say 'must not be run as root' ? ^^^
+else + test_uri "User config file" +fi
printf "uri_default=\"%s\"\n" "$bad_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" export LIBVIRT_DEFAULT_URI="$good_uri"
ACK if you can answer the question either way. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 09/12/2013 01:35 PM, Daniel P. Berrange wrote:
On Thu, Sep 12, 2013 at 01:28:45PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- tests/virsh-uriprecedence | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/virsh-uriprecedence b/tests/virsh-uriprecedence index f4d84a4..aa90efe 100755 --- a/tests/virsh-uriprecedence +++ b/tests/virsh-uriprecedence @@ -56,7 +56,11 @@ bad_uri="test:///default?bad_uri" good_uri="test:///default?good_uri"
printf "uri_default=\"%s\"\n" "$good_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" -test_uri "User config file" +if uid_is_privileged_; then + test_skip_case "$counter" "User config file" "must be run as root"
Should that say 'must not be run as root' ? ^^^
Yes, should, fixed.
+else + test_uri "User config file" +fi
printf "uri_default=\"%s\"\n" "$bad_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" export LIBVIRT_DEFAULT_URI="$good_uri"
ACK if you can answer the question either way.
Thanks, should I wait for ACK on 1/2 before pushing or have you seen that in the archives? Martin

On Thu, Sep 12, 2013 at 01:48:31PM +0200, Martin Kletzander wrote:
On 09/12/2013 01:35 PM, Daniel P. Berrange wrote:
On Thu, Sep 12, 2013 at 01:28:45PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- tests/virsh-uriprecedence | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/virsh-uriprecedence b/tests/virsh-uriprecedence index f4d84a4..aa90efe 100755 --- a/tests/virsh-uriprecedence +++ b/tests/virsh-uriprecedence @@ -56,7 +56,11 @@ bad_uri="test:///default?bad_uri" good_uri="test:///default?good_uri"
printf "uri_default=\"%s\"\n" "$good_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" -test_uri "User config file" +if uid_is_privileged_; then + test_skip_case "$counter" "User config file" "must be run as root"
Should that say 'must not be run as root' ? ^^^
Yes, should, fixed.
+else + test_uri "User config file" +fi
printf "uri_default=\"%s\"\n" "$bad_uri" >"$XDG_CONFIG_HOME/libvirt/libvirt.conf" export LIBVIRT_DEFAULT_URI="$good_uri"
ACK if you can answer the question either way.
Thanks, should I wait for ACK on 1/2 before pushing or have you seen that in the archives?
Odd, I've not see any cover letter or 1/2 patch arrive. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 09/12/2013 06:47 AM, Daniel P. Berrange wrote:
ACK if you can answer the question either way.
Thanks, should I wait for ACK on 1/2 before pushing or have you seen that in the archives?
Odd, I've not see any cover letter or 1/2 patch arrive.
My inbox is also having dreadfully slow delivery today, where I had to look at the archives to see 1/2. But it looks okay, so ACK from me on both. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 09/12/2013 05:02 PM, Eric Blake wrote:
On 09/12/2013 06:47 AM, Daniel P. Berrange wrote:
ACK if you can answer the question either way.
Thanks, should I wait for ACK on 1/2 before pushing or have you seen that in the archives?
Odd, I've not see any cover letter or 1/2 patch arrive.
My inbox is also having dreadfully slow delivery today, where I had to look at the archives to see 1/2. But it looks okay, so ACK from me on both.
Thank you for having a look at that, it's pushed now. Martin

On 09/12/2013 11:02 AM, Eric Blake wrote:
On 09/12/2013 06:47 AM, Daniel P. Berrange wrote:
ACK if you can answer the question either way.
Thanks, should I wait for ACK on 1/2 before pushing or have you seen that in the archives? Odd, I've not see any cover letter or 1/2 patch arrive. My inbox is also having dreadfully slow delivery today, where I had to look at the archives to see 1/2. But it looks okay, so ACK from me on both.
I *still* haven't received 0/2 or 1/2 of this thread. It may be more than slow delivery...
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Laine Stump
-
Martin Kletzander