FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve clar messages by ethomson · Pull Request #4130 · libgit2/libgit2 · GitHub

Repository navigation

Improve clar messages - #4130

Merged
ethomson merged 3 commits into
masterfrom
ethomson/clar_messages
Feb 17, 2017
Merged

ethomson merged 3 commits into
masterfrom
ethomson/clar_messages

Conversation

Copy link
Copy Markdown
Member

Provide more detailed messages when conditions pass or fail unexpectedly. In particular, this provides the error messages when a test fails with a different error code than was expected.

cl_git_pass failures look unchanged:

  1) Failure:
apply::fromfile::test_name [tests/apply/fromfile.c:42]
  Function call failed: (git_patch_from_buffer(&patch, "", 0, ((void *)0)))
  error -3 - no patch found

cl_git_fail messages now:

  1) Failure:
apply::fromfile::test_name [tests/apply/fromfile.c:42]
  Function call succeeded: git_patch_from_buffer(&patch, patchfile, strlen(patchfile), NULL)
  no error, expected non-zero return

cl_git_fail_with messages now:

  1) Failure:
apply::fromfile::test_name [tests/apply/fromfile.c:42]
  Function call failed: (git_patch_from_buffer(&patch, "", 0, ((void *)0)))
  error -3 (expected -99) - no patch found

/cc @pks-t

`snprintf` requires a _format_ but does not require _arguments_ to the
format.  eg: `snprintf(buf, 42, "hi")` is perfectly legal.  Expand the
macro to match.

Without this, `p_sprintf(buf, 42, "hi")` errors with:

```
error: expected expression
                p_snprintf(msg, 42, "hi");
                ^
src/unix/posix.h:53:34: note: expanded from macro 'p_snprintf'
                                 ^
/usr/include/secure/_stdio.h:57:73: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str),
__VA_ARGS__)
```

Copy link
Copy Markdown
Member Author

The goal here is to see more information about why some tests fail in appveyor. We expect certificate failures, but are getting a generic -1 failure. Shoddy networking, but it would be interesting to see a bit more details.

pks-t commented Feb 17, 2017

Copy link
Copy Markdown
Member

Very nice.

You forgot to modfiy all existing callsites of cl_git_report_failure ;)

What do you think about using cl_git_expect instead of cl_git_exec as the macro's name?

Edward Thomson added 2 commits February 17, 2017 12:58
Provide more detailed messages when conditions pass or fail
unexpectedly.  In particular, this provides the error messages when a
test fails with a different error code than was expected.
ethomson force-pushed the ethomson/clar_messages branch from fb2ef7b to c52480f Compare February 17, 2017 13:02

Copy link
Copy Markdown
Member Author

I did forget win32! Oops!

I had this as cl_git_expect or something similar to begin with, so I was rather on the fence. It sounds like you prefer that, so I've changed cl_git_exec -> cl_git_expect.

pks-t commented Feb 17, 2017

Copy link
Copy Markdown
Member

cl_git_exec did not really sound as if it would check anything but only execute a function. So I think cl_git_expect makes the function a bit more obvious in its behavior.

Thanks, looks good to me.

ethomson merged commit b13f0da into master Feb 17, 2017
ethomson deleted the ethomson/clar_messages branch January 9, 2019 10:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL