crt: Add testcases for lfs functions
This will check that of those functions can be compiled, linked and at
runtime can be resolved from CRT DLL library.
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index ea9133b..7e7fde5 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -4401,6 +4401,7 @@
testcases/t_fstat \
testcases/t_intrinc \
testcases/t_imagebase \
+ testcases/t_lfs \
testcases/t_matherr \
testcases/t_nullptrexception \
testcases/t_readdir \
diff --git a/mingw-w64-crt/testcases/t_lfs.c b/mingw-w64-crt/testcases/t_lfs.c
new file mode 100644
index 0000000..9079e83
--- /dev/null
+++ b/mingw-w64-crt/testcases/t_lfs.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+int main(int argc, char *argv[]) {
+ int fd;
+ FILE *file;
+ fpos_t pos;
+ ftello64(stdin);
+ _ftelli64(stdin);
+ fgetpos64(stdin, &pos);
+ fseeko64(stdin, 0, SEEK_CUR);
+ _fseeki64(stdin, 0, SEEK_CUR);
+ pos = 0;
+ fsetpos64(stdin, &pos);
+ lseek64(STDIN_FILENO, 0, SEEK_CUR);
+ _lseeki64(STDIN_FILENO, 0, SEEK_CUR);
+ file = fopen64(argc >= 2 ? argv[1] : argv[0], "r");
+ if (file) {
+ freopen64(argc >= 2 ? argv[1] : argv[0], "r", file);
+ fclose(file);
+ }
+ file = tmpfile64();
+ if (file) fclose(file);
+ fd = open64(argc >= 2 ? argv[1] : argv[0], O_RDONLY);
+ if (fd >= 0) close(fd);
+ return 0;
+}