[Libguestfs] [libnbd PATCH 17/20] ci: Add support for test skipping

Richard W.M. Jones rjones at redhat.com
Tue Jun 8 16:22:06 UTC 2021


On Tue, Jun 08, 2021 at 03:14:21PM +0200, Martin Kletzander wrote:
> On Tue, Jun 08, 2021 at 08:03:57AM -0500, Eric Blake wrote:
> >On Tue, Jun 08, 2021 at 09:53:58AM +0200, Martin Kletzander wrote:
> >>Some tests cannot be ran successfully and/or cannot properly probe for all their
> >>dependency configurations.  This allows for skipping of individual test cases
> >>based on the OS and its version.
> >>
> >>Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> >>---
> >> ci/build_script.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++-
> >> 1 file changed, 59 insertions(+), 1 deletion(-)
> >>
> >>diff --git a/ci/build_script.sh b/ci/build_script.sh
> >>index cecbbba0bbc0..36bd51eb8522 100755
> >>--- a/ci/build_script.sh
> >>+++ b/ci/build_script.sh
> >>@@ -32,7 +32,65 @@ main() {
> >>         return 0
> >>     fi
> >>
> >>-    $MAKE check
> >>+    # Add a way to run all the tests, even the skipped ones, with an environment
> >>+    # variable, so that it can be set fora branch or fork in GitLab.
> >
> >for a
> >
> >>+    if test "$SKIPPED_TESTS" != "force"
> >>+    then
> >>+        # Skip tests from ci/skipped_tests if this is the right OS version
> >>+        # The file
> >>+        local os_id
> >
> >ci/build_script.sh is currently listed as #!/bin/sh, but local is a bashism.
> >
> 
> Oh, and it's not as easy as that either as I see:
> 
>   https://stackoverflow.com/questions/18597697/posix-compliant-way-to-scope-variables-to-a-function-in-a-shell-script
> 
> Anyway, I'll just remove the `local`.  I did not go through all the
> obstacles of making it POSIX-compatible to just throw it away for some
> variable scoping =)
> 
> I see I made the same mistake in one previous patch as well, so I'll
> clean that too.

We're allowed to assume /bin/bash exists in general libnbd tests,
although I don't know if that applies here since I'm not totally clear
if these CI scripts run in the environment that has all the deps
installed or not.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list