Add autotest for fsendfile()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2015-08-22 22:49:48 +02:00
parent 36da3aa35e
commit b59249714b
3 changed files with 10 additions and 4 deletions
+1
View File
@@ -68,6 +68,7 @@ test:
$(MAKE) -f chomp.mk
$(MAKE) -f copyfile.mk
$(MAKE) -f dir.mk
$(MAKE) -f fsendfile.mk
$(MAKE) -f pidfilefn.mk
$(MAKE) -f rsync.mk
+5 -4
View File
@@ -77,6 +77,7 @@ size_t fsendfile(FILE *src, FILE *dst, size_t len)
}
#ifdef UNITTEST
#include <err.h>
#include <unistd.h>
int main(void)
@@ -93,12 +94,12 @@ int main(void)
while (files[i]) {
src = fopen(files[i], "r");
dst = fopen(files[i + 1], "w");
fprintf(stderr, "fsendfile(%s, %s, 512)\t", files[i], files[i + 1]);
printf("fsendfile(%s, %s, 512)\t", files[i], files[i + 1]);
if (-1 == fsendfile(src, dst, 512))
perror("Failed");
err(1, "Failed fsendfile(%s, %s)", files[i], files[i + 1]);
if (!access(files[i + 1], F_OK))
fprintf(stderr, "OK => %s\n", files[i + 1]);
printf("OK => %s\n", files[i + 1]);
remove(files[i + 1]);
i += 2;
@@ -110,7 +111,7 @@ int main(void)
/**
* Local Variables:
* compile-command: "gcc -g -o sendy -DUNITTEST fsendfile.c && ./sendy"
* compile-command: "make V=1 -f fsendfile.mk"
* version-control: t
* indent-tabs-mode: t
* c-file-style: "linux"
+4
View File
@@ -0,0 +1,4 @@
OBJS =
TARGET = fsendfile.test clean
include rules.mk