summaryrefslogtreecommitdiff
path: root/test/misc/seek.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-28 20:29:21 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-10-28 20:31:55 +0200
commit99ef2719fb3d703fe38c4113cd7f5adec516dd3a (patch)
tree2c1f77cb41b60ccbf8faa77a3640491a3546b546 /test/misc/seek.c
parent543308f6c46cf2edf8a524bc9c631e472570fe72 (diff)
test: remove test suite
The test suite is now a developed in a separate git repository. See here: http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng-test.git The test suite should be just like every other software compiled with the cross-toolchain. In the past strange problems where found when the test suite got build in the toolchain creation step.
Diffstat (limited to 'test/misc/seek.c')
-rw-r--r--test/misc/seek.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/test/misc/seek.c b/test/misc/seek.c
deleted file mode 100644
index c5edb94c9..000000000
--- a/test/misc/seek.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-
-#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*arr))
-
-int main(void)
-{
- struct {
- off_t offset;
- int whence;
- } tests[] = {
- { 0x00, SEEK_SET },
- { 0x01, SEEK_SET },
- { 0xFF, SEEK_SET }
- };
- char buf[2000];
- off_t ret;
- int i, fd;
- FILE *fp;
- int tmp;
-
- fd = open("lseek.out", O_RDWR|O_CREAT, 0600);
- if (fd == -1) {
- perror("open(lseek.out) failed");
- return 1;
- }
- unlink("lseek.out");
- fp = fdopen(fd, "rw");
- if (fp == NULL) {
- perror("fopen(lseek.out) failed");
- return 1;
- }
-
- memset(buf, 0xAB, sizeof(buf));
- ret = write(fd, buf, sizeof(buf));
- if (ret != sizeof(buf)) {
- fprintf(stderr, "write() failed to write %zi bytes (wrote %li): ", sizeof(buf), (long)ret);
- perror("");
- return 1;
- }
-
- tmp = fseeko(fp, 1024, SEEK_SET);
- assert(tmp == 0);
- tmp = fseeko(fp, (off_t)-16, SEEK_CUR);
- assert(tmp == 0);
- ret = ftell(fp);
- if (ret != (1024-16)) {
- fprintf(stderr, "ftell() failed, we wanted pos %i but got %li: ", (1024-16), (long)ret);
- perror("");
- return 1;
- }
-
- for (i = 0; i < ARRAY_SIZE(tests); ++i) {
- ret = lseek(fd, tests[i].offset, tests[i].whence);
- if (ret != tests[i].offset) {
- fprintf(stderr, "lseek(%li,%i) failed (wanted %li, got %li): ", (long)tests[i].offset,
- tests[i].whence, (long)tests[i].offset, (long)ret);
- perror("");
- return 1;
- }
- ret = fseek(fp, tests[i].offset, tests[i].whence);
- if (ret != 0) {
- fprintf(stderr, "fseek(%li,%i) failed (wanted 0, got %li): ", (long)tests[i].offset,
- tests[i].whence, (long)ret);
- perror("");
- return 1;
- }
- }
-
- fclose(fp);
- close(fd);
-
- printf("Success!\n");
-
- return 0;
-}