Skip to content

test1521: test *all* curl_easy_setopt options - #1543

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/test-all-setopts
Closed

test1521: test *all* curl_easy_setopt options#1543
bagder wants to merge 1 commit into
masterfrom
bagder/test-all-setopts

Conversation

@bagder

@bagder bagder commented Jun 5, 2017

Copy link
Copy Markdown
Member

mk-lib1521.pl generates a test program (lib1521.c) that calls
curl_easy_setopt() for every known option with a few typical values to
make sure they work (ignoring the return codes).

Some small changes was necessary to avoid asserts and NULL accesses when
doing this.

The perl script is not automatically run but needs to be manually rerun
when we add new options.

mk-lib1521.pl generates a test program (lib1521.c) that calls
curl_easy_setopt() for every known option with a few typical values to
make sure they work (ignoring the return codes).

Some small changes was necessary to avoid asserts and NULL accesses when
doing this.

The perl script is not automatically run but needs to be manually rerun
when we add new options.
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.0%) to 73.233% when pulling 89d920e on bagder/test-all-setopts into b95a07e on master.

@bagder bagder closed this in cccac4f Jun 5, 2017
@bagder
bagder deleted the bagder/test-all-setopts branch June 5, 2017 13:12
@dfandrich

Copy link
Copy Markdown
Contributor

I don't quite see the point of this test. Yes, it increases code coverage, but does it really test anything useful? It doesn't test that the values are passed in properly, or translated properly, or used properly. It doesn't even check that the return code is as expected. If at least the return code was checked, then I could see some marginal utility.

@MarcelRaad

Copy link
Copy Markdown
Member

@dfandrich When built with GCC 4.3+ and optimization on, this tests the curl_easy_setopt macro in typecheck-gcc.h.

@bagder

bagder commented Jun 5, 2017

Copy link
Copy Markdown
Member Author

Exactly, and with #1544 the typecheck-gcc.h rules will be verfied by travis CI for all commits and PRs.

I had to fix several code issues (including one typecheck fix) to get test 1521 to run ok, so I think it has already proven itself worth the effort. I wanted to make sure that all numerical options can handle extreme values and for pointers that they can get set to NULL just fine etc.

I certainly agree that there's still room for improvement of this test to also check the return codes, but due to different build combinations and setups which causes different return codes it is much harder to do this.

@lock lock Bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants