[PATCH 32/35] tests: Re-implement '(virsh|virt-admin)-self-test' directly in meson

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

 



The self-test command for both virsh and virt-admin is self contained
and directly reports success, thus we don't actually need to run a shell
wrapper around it.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/meson.build          | 16 +++++++++++--
 tests/virsh-self-test      | 48 --------------------------------------
 tests/virt-admin-self-test |  1 -
 tools/meson.build          |  4 ++--
 4 files changed, 16 insertions(+), 53 deletions(-)
 delete mode 100755 tests/virsh-self-test
 delete mode 120000 tests/virt-admin-self-test

diff --git a/tests/meson.build b/tests/meson.build
index 68f7635df9..8ccc63b3a6 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -619,6 +619,20 @@ test(
   suite: 'script',
 )

+# vsh based client self-test, which can be run directly from meson
+test('virsh self-test',
+  virsh_prog,
+  args: [ '-q', '-c', 'test:///default', 'self-test' ],
+  suite: 'bin',
+)
+
+if conf.has('WITH_REMOTE')
+  test('virt-admin self-test',
+    virt_admin_prog,
+    args: [ '-q', 'self-test' ],
+    suite: 'bin',
+  )
+endif

 # helpers:
 #   each entry is a dictionary with following items:
@@ -690,9 +704,7 @@ if conf.has('WITH_LIBVIRTD')
   test_scripts += [
     'libvirtd-fail',
     'virsh-auth',
-    'virsh-self-test',
     'virsh-uriprecedence',
-    'virt-admin-self-test',
   ]

   if conf.has('WITH_SECDRIVER_APPARMOR')
diff --git a/tests/virsh-self-test b/tests/virsh-self-test
deleted file mode 100755
index 22396bceee..0000000000
--- a/tests/virsh-self-test
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-# run virsh self-test to make sure command option structures are valid
-
-# Copyright (C) 2016 Red Hat, Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 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 General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see
-# <http://www.gnu.org/licenses/>.
-
-. "$(dirname $0)/test-lib.sh"
-
-fail=0
-
-basename=$(basename $0)
-
-if test "x$basename" = "xvirsh-self-test" ; then
-    binary=virsh
-    extra_args="-c test:///default"
-elif test "x$basename" = "xvirt-admin-self-test" ; then
-    binary=virt-admin
-    extra_args=""
-else
-    echo "Unknown binary: $basename";
-    exit 1
-fi
-
-test_intro "$0"
-$abs_top_builddir/tools/${binary} ${extra_args} self-test > /dev/null
-status=$?
-test_result 1 "$0" ${status}
-
-if test "${status}" != "0" ; then
-   fail=1
-fi
-
-test_final $counter $fail
-
-(exit $fail); exit $fail
diff --git a/tests/virt-admin-self-test b/tests/virt-admin-self-test
deleted file mode 120000
index d4ad624a04..0000000000
--- a/tests/virt-admin-self-test
+++ /dev/null
@@ -1 +0,0 @@
-./virsh-self-test
\ No newline at end of file
diff --git a/tools/meson.build b/tools/meson.build
index c72f760a1d..15be557dfe 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -155,7 +155,7 @@ else
   virsh_icon_res = []
 endif

-executable(
+virsh_prog = executable(
   'virsh',
   [
     'virsh.c',
@@ -209,7 +209,7 @@ executable(
 )

 if conf.has('WITH_REMOTE')
-  executable(
+  virt_admin_prog = executable(
     'virt-admin',
     [
       'virt-admin.c',
-- 
2.44.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux