diff options
author | Junio C Hamano <junkio@cox.net> | 2005-12-12 12:28:34 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-12-12 12:57:25 -0800 |
commit | e726715a52e25d8035c89d4ea09398599610737e (patch) | |
tree | 7951b21bec4120db31c693f8491e62e3908e690c /test-delta.c | |
parent | d28c8af623b0d15740c2af0106d8e2bf54a3ac52 (diff) | |
download | git-e726715a52e25d8035c89d4ea09398599610737e.tar.gz git-e726715a52e25d8035c89d4ea09398599610737e.tar.xz |
Add deltifier test.
This test kicks in only if you built test-delta executable, and
makes sure that the basic delta routine is working properly even
on empty files.
This commit is to make sure we have a test to catch the
breakage. The delitifier code is still broken, which will be
fixed with the next commit.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'test-delta.c')
-rw-r--r-- | test-delta.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test-delta.c b/test-delta.c index 1be8ee0c7..cc05794ec 100644 --- a/test-delta.c +++ b/test-delta.c @@ -38,7 +38,10 @@ int main(int argc, char *argv[]) return 1; } from_size = st.st_size; - from_buf = mmap(NULL, from_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (from_size) + from_buf = mmap(NULL, from_size, PROT_READ, MAP_PRIVATE, fd, 0); + else + from_buf = ""; if (from_buf == MAP_FAILED) { perror(argv[2]); close(fd); @@ -52,7 +55,11 @@ int main(int argc, char *argv[]) return 1; } data_size = st.st_size; - data_buf = mmap(NULL, data_size, PROT_READ, MAP_PRIVATE, fd, 0); + + if (data_size) + data_buf = mmap(NULL, data_size, PROT_READ, MAP_PRIVATE, fd, 0); + else + data_buf = ""; if (data_buf == MAP_FAILED) { perror(argv[3]); close(fd); |