summaryrefslogtreecommitdiff
path: root/test/stat
diff options
context:
space:
mode:
Diffstat (limited to 'test/stat')
-rw-r--r--test/stat/Makefile8
-rw-r--r--test/stat/Makefile.in13
-rw-r--r--test/stat/memcmp-stat.c107
-rw-r--r--test/stat/stat-loop256.c32
-rw-r--r--test/stat/stat.c71
-rw-r--r--test/stat/stat64.c1
6 files changed, 0 insertions, 232 deletions
diff --git a/test/stat/Makefile b/test/stat/Makefile
deleted file mode 100644
index 03fdb960a..000000000
--- a/test/stat/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# uClibc stat tests
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-
-top_builddir=../../
-top_srcdir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
diff --git a/test/stat/Makefile.in b/test/stat/Makefile.in
deleted file mode 100644
index 9c06dedb3..000000000
--- a/test/stat/Makefile.in
+++ /dev/null
@@ -1,13 +0,0 @@
-# uClibc stat tests
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-
-ifeq ($(UCLIBC_HAS_LFS),)
-TESTS_DISABLED := stat64
-endif
-CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-
-DODIFF_stat := 1
-DODIFF_stat64 := 1
-
-OPTS_stat := Makefile
-OPTS_stat64 := Makefile
diff --git a/test/stat/memcmp-stat.c b/test/stat/memcmp-stat.c
deleted file mode 100644
index 254c754c4..000000000
--- a/test/stat/memcmp-stat.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Distilled from issue found with tar and symlinks.
- * Make sure that the whole stat struct between runs
- * is agreeable.
- */
-
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-#include <time.h>
-
-static void show_stat(struct stat *st)
-{
- printf(
- "------------------\n"
- "st_dev = %li\n"
- "st_ino = %li\n"
- "st_mode = %li\n"
- "st_nlink = %li\n"
- "st_uid = %li\n"
- "st_gid = %li\n"
- "st_rdev = %li\n"
- "st_size = %li\n"
- "st_blksize = %li\n"
- "st_blocks = %li\n"
- "st_atime = %li\n"
- "st_ansec = %li\n"
- "st_mtime = %li\n"
- "st_mnsec = %li\n"
- "st_ctime = %li\n"
- "st_cnsec = %li\n",
- (long int)st->st_dev,
- (long int)st->st_ino,
- (long int)st->st_mode,
- (long int)st->st_nlink,
- (long int)st->st_uid,
- (long int)st->st_gid,
- (long int)st->st_rdev,
- (long int)st->st_size,
- (long int)st->st_blksize,
- (long int)st->st_blocks,
-#if !defined(__UCLIBC__) || defined(__USE_MISC)
- (long int)st->st_atime,
- (long int)st->st_atim.tv_nsec,
- (long int)st->st_mtime,
- (long int)st->st_mtim.tv_nsec,
- (long int)st->st_ctime,
- (long int)st->st_ctim.tv_nsec
-#else
- (long int)st->st_atime,
- (long int)st->st_atimensec,
- (long int)st->st_mtime,
- (long int)st->st_mtimensec,
- (long int)st->st_ctime,
- (long int)st->st_ctimensec
-#endif
- );
-}
-
-int main(void)
-{
- int ret;
- int fd;
- struct stat fst, st;
-
- memset(&fst, 0xAA, sizeof(fst));
- memset(&st, 0x55, sizeof(st));
-
- unlink(".testfile");
- fd = open(".testfile", O_WRONLY | O_CREAT | O_EXCL, 0);
- if (fd < 0) {
- perror("open(.testfile) failed");
- return 1;
- }
- ret = fstat(fd, &fst);
- if (ret != 0) {
- perror("fstat(.testfile) failed");
- return 1;
- }
- close(fd);
-
- ret = stat(".testfile", &st);
- if (ret != 0) {
- perror("stat(.testfile) failed");
- return 1;
- }
-
- ret = memcmp(&fst, &st, sizeof(fst));
- if (ret != 0) {
- printf("FAILED: memcmp() = %i\n", ret);
- show_stat(&fst);
- show_stat(&st);
- }
-
- unlink(".testfile");
-
- return ret;
-}
diff --git a/test/stat/stat-loop256.c b/test/stat/stat-loop256.c
deleted file mode 100644
index 14284c184..000000000
--- a/test/stat/stat-loop256.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-int main()
-{
- struct stat statbuf;
- int ret = 0;
- char* loop255 = "/dev/loop255";
- char* loop256 = "/dev/loop256";
- mode_t mode = 0660;
- mknod(loop255, mode, 0x7ff);
- mknod(loop256, mode, 0x100700);
- ret = stat(loop255, &statbuf);
- if(ret < 0) {
- printf("stat: Cant stat %s\n",loop255);
- unlink(loop255);
- exit(1);
- }
- ret = stat(loop256, &statbuf);
- if(ret < 0) {
- printf("stat: Cant stat %s\n",loop256);
- unlink(loop255);
- unlink(loop256);
- exit(1);
- }
-
- unlink(loop255);
- unlink(loop256);
- exit(0);
-}
-
diff --git a/test/stat/stat.c b/test/stat/stat.c
deleted file mode 100644
index 4980cdd78..000000000
--- a/test/stat/stat.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-static void print_struct_stat(char *msg, struct stat *s)
-{
- printf("%s\n", msg);
- /* The casts are because glibc thinks it's cool */
- printf("device : 0x%llx\n",(long long)s->st_dev);
- printf("inode : %lld\n", (long long)s->st_ino);
- printf("mode : 0x%llx\n",(long long)s->st_mode);
- printf("nlink : %lld\n", (long long)s->st_nlink);
- printf("uid : %lld\n", (long long)s->st_uid);
- printf("gid : %lld\n", (long long)s->st_gid);
- printf("rdev : 0x%llx\n",(long long)s->st_rdev);
- printf("size : %lld\n", (long long)s->st_size);
- printf("blksize : %lld\n", (long long)s->st_blksize);
- printf("blocks : %lld\n", (long long)s->st_blocks);
- printf("atime : %lld\n", (long long)s->st_atime);
- printf("mtime : %lld\n", (long long)s->st_mtime);
- printf("ctime : %lld\n", (long long)s->st_ctime);
-}
-
-int main(int argc,char **argv)
-{
- int fd, ret;
- char *file;
- struct stat s;
-
- if (argc < 2) {
- fprintf(stderr, "Usage: stat FILE\n");
- exit(1);
- }
- file = argv[1];
-
- memset(&s, 0, sizeof(struct stat));
- ret = stat(file, &s);
- if(ret<0){
- perror("stat");
- exit(1);
- }
- print_struct_stat("\nTesting stat:", &s);
-
- memset(&s, 0, sizeof(struct stat));
- ret = lstat(file, &s);
- if(ret<0){
- perror("lstat");
- exit(1);
- }
- print_struct_stat("\nTesting lstat:", &s);
-
-
- fd = open(file, O_RDONLY);
- if(fd<0){
- perror("open");
- exit(1);
- }
- memset(&s, 0, sizeof(struct stat));
- ret = fstat(fd,&s);
- if(ret<0){
- perror("fstat");
- exit(1);
- }
- print_struct_stat("\nTesting fstat:", &s);
-
- exit(0);
-}
-
diff --git a/test/stat/stat64.c b/test/stat/stat64.c
deleted file mode 100644
index a07425192..000000000
--- a/test/stat/stat64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "stat.c"