2017-08-08 23:44 GMT+05:00 David Sommerseth <
open...@sf.lists.topphemmelig.net>:

> On 07/08/17 20:25, Илья Шипицин wrote:
> [...]
> >     > +"${top_builddir}/src/openvpn/openvpn" --help >/dev/null
> >     > +
> >     > +if [ $? -ne 1 ]
> >     > +then
> >     > +   exit_code=1
> >     > +fi
> >
> >     This check is odd.  Where the --help option is parsed, it calls
> usage(),
> >     usage_small().  And those functions will always call:
> >
> > Sometimes it segfaults.
>
> That's no real argument, see below.
>


the one and only thing I wish to check here is whether functions reaches
"exit 1" or crashes before.


>
> >        openvpn_exit(OPENVPN_EXIT_STATUS_USAGE);
> >
> >     And OPENVPN_EXIT_STATUS_USAGE is defined as:
> >
> >     error.h:#define OPENVPN_EXIT_STATUS_USAGE                   1
> >
> >     I would rather recommend you to grep for some information you expect
> to
> >     be listed in --help and check if that was found instead.
> >
> >
> > I tried to implement it with cmocka. However, I gave up
>
> I didn't say this should be implemented in C and CMocka ... hence the
> example below.  And that check below would implicitly account for SEGV
> scenarios as well.
>

> >     For example:
> >
> >     $ ./openvpn --help | grep -- ^-- | wc -l
> >     238
>
> But to do the spoon feeding:
>
> optcount="$(${top_builddir}/src/openvpn/openvpn --help | grep -E -- ^-- |
> wc -l)"
> if [ $outcount -lt 220 ];
> then
>         exit_code=1
> fi
>
>
if you suggest "that's a better check", please describe your idea.
it is not clear for me why your approach is better


>
> --
> kind regards,
>
> David Sommerseth
> OpenVPN Technologies, Inc
>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to