[Openvpn-devel] test usage() ?

2017-06-23 Thread Илья Шипицин
Hello,

following to
https://github.com/OpenVPN/openvpn/commit/49629380a7bdba25c24c9d410b79946fe29249f0

I spent some days on trying to get cmocka to test usage(), I gave up :-)
now, I think, we should just add "src/openvpn/openvpn --help" to .travis.yml

the question is - can we rely on exit status "1"  here ?


$ src/openvpn/openvpn --help >/dev/null
$ echo $?
1
$


why does "1" mean "ok" here ?


Cheers,
Ilya Shipitsin
--
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


Re: [Openvpn-devel] test usage() ?

2017-06-23 Thread David Sommerseth
On 23/06/17 11:59, Илья Шипицин wrote:
> Hello,
> 
> following to
> https://github.com/OpenVPN/openvpn/commit/49629380a7bdba25c24c9d410b79946fe29249f0
> 
> I spent some days on trying to get cmocka to test usage(), I gave up :-)
> now, I think, we should just add "src/openvpn/openvpn --help" to .travis.yml
> 
> the question is - can we rely on exit status "1"  here ?

Yes.

> $ src/openvpn/openvpn --help >/dev/null
> $ echo $?
> 1
> $
> 
> 
> why does "1" mean "ok" here ?
At the end of the usage() function, it calls
openvpn_exit(OPENVPN_EXIT_STATUS_USAGE).  OPENVPN_EXIT_STATUS_USAGE is
defined to be 1 in error.h.  And the argument given to openvpn_exit() is
an integer which is used as the exit code when OpenVPN stops running.

It is not uncommon that usage() returns a non-0.  But that varies from
project to project.  In OpenVPN context 1 usually can be interpreted as
"no tunnel was started".


-- 
kind regards,

David Sommerseth
OpenVPN Technologies, Inc




signature.asc
Description: OpenPGP digital signature
--
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