summaryrefslogtreecommitdiff
path: root/tests/buf
Commit message (Collapse)AuthorAgeFilesLines
* buf::oom tests: use custom allocator for oom failuresethomson/buf_oom_testEdward Thomson2018-10-211-37/+39
| | | | | | | | | | | | | | | | Create a custom allocator for the `buf::oom` tests that will fail with out-of-memory errors in predictable ways. We were previously trying to guess the way that various allocators on various platforms would fail in a way such that `malloc`/`realloc` would return `NULL` (instead of aborting the application, or appearing suspicious to various instrumentation or static code analysis tools like valgrind.) Introduce a fake `malloc` and `realloc` that will return `NULL` on allocations requesting more than 100 bytes. Otherwise, we proxy to the default allocator. (It's important to use the _default_ allocator, not just call `malloc`, since the default allocator on Windows CI builds may be the debugging C runtime allocators which would not be compatible with a standard `malloc`.)
* tests: don't run buf::oom on 32-bit systemsEdward Thomson2018-10-211-5/+9
| | | | | | On a 32-bit Linux systems, the value large enough to make malloc guarantee a failure is also large enough that valgrind considers it "fishy". Skip this test on those systems entirely.
* buf tests: allocate a smaller size for the oomEdward Thomson2018-07-261-3/+15
| | | | | | | | | | | On Linux (where we run valgrind) allocate a smaller buffer, but still an insanely large size. This will cause malloc to fail but will not cause valgrind to report a likely error with a negative-sized malloc. Keep the original buffer size on non-Linux platforms: this is well-tested on them and changing it may be problematic. On macOS, for example, using the new size causes `malloc` to print a warning to stderr.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-105-10/+10
|
* buf: add tests for percent decodingethomson/ssh-unescapeEdward Thomson2018-03-191-0/+49
|
* git_buf_quote/unquote: handle > \177Edward Thomson2016-05-261-0/+5
| | | | | | Parse values up to and including `\377` (`0xff`) when unquoting. Print octal values as an unsigned char when quoting, lest `printf` think we're talking about negatives.
* git_buf_quote: quote ugly charactersEdward Thomson2016-05-261-26/+52
|
* Patch parsing from patch filesEdward Thomson2016-05-261-0/+57
|
* buf test: cleanup memory leakEdward Thomson2015-02-131-0/+2
|
* git_buf_grow_by: increase buf asize incrementallyEdward Thomson2015-02-122-0/+30
| | | | | Introduce `git_buf_grow_by` to incrementally increase the size of a `git_buf`, performing an overflow calculation on the growth.
* Fix crash in free() when git_buf_grow() fails.Jeff Hostetler2015-01-091-0/+31
|
* Rename tests-clar to testsBen Straub2013-11-142-0/+122