|
From: David S. <op...@sf...> - 2017-08-08 18:44:25
|
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.
> 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
--
kind regards,
David Sommerseth
OpenVPN Technologies, Inc
|