git-commit-vandalism/t/helper
Jeff King d65930c5a9 test-delta: read input into a heap buffer
We currently read the input to test-delta by mmap()-ing it.
However, memory-checking tools like valgrind and ASan are
less able to detect reads/writes past the end of an mmap'd
buffer, because the OS is likely to give us extra bytes to
pad out the final page size. So instead, let's read into a
heap buffer.

As a bonus, this also makes it possible to write tests with
empty bases, as mmap() will complain about a zero-length
map.

This is based on a patch by Jann Horn <jannh@google.com>
which actually aligned the data at the end of a page, and
followed it with another page marked with mprotect(). That
would detect problems even without a tool like ASan, but it
was significantly more complex and may have introduced
portability problems. By comparison, this approach pushes
the complexity onto existing memory-checking tools.

Note that this could be done even more simply by using
strbuf_read_file(), but that would defeat the purpose:
strbufs generally overallocate (and at the very least
include a trailing NUL which we do not care about), which
would defeat most memory checkers.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-08-30 10:30:21 -07:00
..
.gitignore Merge branch 'sb/test-helper-excludes' 2017-12-27 11:16:29 -08:00
test-chmtime.c Merge branch 'ps/test-chmtime-get' 2018-04-25 13:29:00 +09:00
test-config.c t/helper: merge test-config into test-tool 2018-03-27 08:45:47 -07:00
test-ctype.c t/helper: merge test-ctype into test-tool 2018-03-27 08:45:47 -07:00
test-date.c t/helper: merge test-date into test-tool 2018-03-27 08:45:47 -07:00
test-delta.c test-delta: read input into a heap buffer 2018-08-30 10:30:21 -07:00
test-drop-caches.c handle lower case drive letters on Windows 2018-07-12 12:11:05 -07:00
test-dump-cache-tree.c t/helper: merge test-dump-cache-tree into test-tool 2018-03-27 08:45:47 -07:00
test-dump-fsmonitor.c fsmonitor: add a test tool to dump the index extension 2017-10-01 17:23:05 +09:00
test-dump-split-index.c Update struct index_state to use struct object_id 2018-05-02 13:59:50 +09:00
test-dump-untracked-cache.c dir: convert struct untracked_cache_dir to object_id 2018-05-02 13:59:51 +09:00
test-example-decorate.c Replace all die("BUG: ...") calls by BUG() ones 2018-05-06 19:06:13 +09:00
test-fake-ssh.c
test-genrandom.c t/helper: merge test-genrandom into test-tool 2018-03-27 08:45:47 -07:00
test-hashmap.c t/helper: merge test-hashmap into test-tool 2018-03-27 08:45:47 -07:00
test-index-version.c t/helper: merge test-index-version into test-tool 2018-03-27 08:45:47 -07:00
test-json-writer.c json_writer: new routines to create JSON data 2018-07-16 13:55:39 -07:00
test-lazy-init-name-hash.c t/helper: merge test-lazy-init-name-hash into test-tool 2018-03-27 08:45:47 -07:00
test-line-buffer.c test-line-buffer: simplify command parsing 2017-09-22 12:49:53 +09:00
test-match-trees.c t/helper: merge (unused) test-match-trees into test-tool 2018-03-27 08:45:47 -07:00
test-mergesort.c t/helper: merge (unused) test-mergesort into test-tool 2018-03-27 08:45:47 -07:00
test-mktemp.c t/helper: merge test-mktemp into test-tool 2018-03-27 08:45:47 -07:00
test-online-cpus.c t/helper: merge test-online-cpus into test-tool 2018-03-27 08:45:47 -07:00
test-parse-options.c t0040,t1502: Demonstrate parse_options bugs 2017-09-25 14:35:50 +09:00
test-path-utils.c Sync with Git 2.17.1 2018-05-29 17:10:05 +09:00
test-pkt-line.c test-pkt-line: add unpack-sideband subcommand 2018-06-21 13:57:11 -07:00
test-prio-queue.c t/helper: merge test-prio-queue into test-tool 2018-03-27 08:45:47 -07:00
test-read-cache.c t/helper: merge test-read-cache into test-tool 2018-03-27 08:45:47 -07:00
test-ref-store.c refs: add repository argument to get_main_ref_store 2018-04-12 11:38:56 +09:00
test-regex.c t/helper: merge test-regex into test-tool 2018-03-27 08:45:47 -07:00
test-repository.c commit-graph: add repo arg to graph readers 2018-07-17 15:47:48 -07:00
test-revision-walking.c t/helper: merge test-revision-walking into test-tool 2018-03-27 08:45:47 -07:00
test-run-command.c t/helper: merge test-run-command into test-tool 2018-03-27 08:45:47 -07:00
test-scrap-cache-tree.c Merge branch 'ma/lockfile-cleanup' 2018-05-30 14:04:05 +09:00
test-sha1-array.c t/helper: merge test-sha1-array into test-tool 2018-03-27 08:45:47 -07:00
test-sha1.c t/helper: merge test-sha1 into test-tool 2018-03-27 08:45:47 -07:00
test-sha1.sh t/helper: merge test-sha1 into test-tool 2018-03-27 08:45:47 -07:00
test-sigchain.c t/helper: merge test-sigchain into test-tool 2018-03-27 08:45:47 -07:00
test-strcmp-offset.c t/helper: merge test-strcmp-offset into test-tool 2018-03-27 08:45:47 -07:00
test-string-list.c t/helper: merge test-string-list into test-tool 2018-03-27 08:45:47 -07:00
test-submodule-config.c Merge branch 'sb/submodule-move-nested' 2018-05-08 15:59:17 +09:00
test-subprocess.c t/helper: merge test-subprocess into test-tool 2018-03-27 08:45:47 -07:00
test-svn-fe.c
test-tool.c Merge branch 'jh/json-writer' 2018-08-15 15:08:22 -07:00
test-tool.h Merge branch 'jk/use-compat-util-in-test-tool' 2018-08-27 14:33:43 -07:00
test-urlmatch-normalization.c t/helper: merge test-urlmatch-normalization into test-tool 2018-03-27 08:45:47 -07:00
test-wildmatch.c t/helper: merge test-wildmatch into test-tool 2018-03-27 08:45:47 -07:00
test-write-cache.c Merge branch 'ma/lockfile-cleanup' 2018-05-30 14:04:05 +09:00