Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Jan 2017 08:10:41 -0700
From:      Alan Somers <asomers@freebsd.org>
To:        Ngie Cooper <ngie@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r313008 - head/tests/sys/geom/class/gate
Message-ID:  <CAOtMX2h4XvOy05uZ-9c4UEcLTdg5cWN_2mP-gLbNAuW13-TBuA@mail.gmail.com>
In-Reply-To: <201701310612.v0V6CqVL093451@repo.freebsd.org>
References:  <201701310612.v0V6CqVL093451@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
I think wait_for_ggate_device should also be used at line 32, which
calls "ggatec create".
-Alan

On Mon, Jan 30, 2017 at 11:12 PM, Ngie Cooper <ngie@freebsd.org> wrote:
> Author: ngie
> Date: Tue Jan 31 06:12:51 2017
> New Revision: 313008
> URL: https://svnweb.freebsd.org/changeset/base/313008
>
> Log:
>   Wait for /dev/ggate* to appear after calling `ggatel create` in :ggatel_{file,md}
>
>   The test assumed that `ggatel create` created a device on completion, but that's
>   incorrect. This squashes the race by waiting for the device to appear, as
>   `ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not called
>   with `-v`.
>
>   Discussed with:       asomers
>   MFC after:    1 week
>   PR:           204616
>   Sponsored by: Dell EMC Isilon
>
> Modified:
>   head/tests/sys/geom/class/gate/ggate_test.sh
>
> Modified: head/tests/sys/geom/class/gate/ggate_test.sh
> ==============================================================================
> --- head/tests/sys/geom/class/gate/ggate_test.sh        Tue Jan 31 03:40:13 2017        (r313007)
> +++ head/tests/sys/geom/class/gate/ggate_test.sh        Tue Jan 31 06:12:51 2017        (r313008)
> @@ -74,7 +74,11 @@ ggatel_file_body()
>
>         atf_check ggatel create -u $us work
>
> -       dd if=src of=/dev/ggate${us} bs=1m count=1 conv=notrunc
> +       ggate_dev=/dev/ggate${us}
> +
> +       wait_for_ggate_device ${ggate_dev}
> +
> +       dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc
>
>         checksum src work
>  }
> @@ -104,7 +108,11 @@ ggatel_md_body()
>
>         atf_check ggatel create -u $us /dev/$work
>
> -       dd if=/dev/$src of=/dev/ggate${us} bs=1m count=1 conv=notrunc
> +       ggate_dev=/dev/ggate${us}
> +
> +       wait_for_ggate_device ${ggate_dev}
> +
> +       dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc
>
>         checksum /dev/$src /dev/$work
>  }
> @@ -191,3 +199,14 @@ common_cleanup()
>         fi
>         true
>  }
> +
> +# Bug 204616: ggatel(8) creates /dev/ggate* asynchronously if `ggatel create`
> +#             isn't called with `-v`.
> +wait_for_ggate_device()
> +{
> +       ggate_device=$1
> +
> +       while [ ! -c $ggate_device ]; do
> +               sleep 0.5
> +       done
> +}
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2h4XvOy05uZ-9c4UEcLTdg5cWN_2mP-gLbNAuW13-TBuA>