From 55021a78202f4960f5294c55668b400854c7ba65 Mon Sep 17 00:00:00 2001
From: David Schleef <ds@schleef.org>
Date: Fri, 25 May 2001 23:04:51 +0000
Subject: Test to check for proper stat mangling.

---
 test/stat/Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 test/stat/stat.c   | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 test/stat/Makefile
 create mode 100644 test/stat/stat.c

(limited to 'test')

diff --git a/test/stat/Makefile b/test/stat/Makefile
new file mode 100644
index 000000000..4a1cf405f
--- /dev/null
+++ b/test/stat/Makefile
@@ -0,0 +1,47 @@
+TESTDIR=../
+include $(TESTDIR)/Rules.mak
+
+
+
+TARGETS=stat stat_glibc
+
+all: $(TARGETS)
+
+stat_source:
+	-@ rm -f $(TARGETS)
+	-@ echo "-------"
+	-@ echo "stat.c source: "
+	-@ echo " "
+	-@ cat stat.c
+	-@ echo " "
+
+stat: stat.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(TESTCC)
+	-@ echo "-------"
+	-@ echo " "
+	-@ echo "Compiling vs uClibc: "
+	-@ echo " "
+	$(TESTCC) $(CFLAGS) -c $< -o $@.o
+	$(TESTCC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
+	$(STRIPTOOL) -x -R .note -R .comment $@
+	-ldd $@
+	ls $(LSFLAGS) $@
+	-./$@
+	-@ echo " "
+
+stat_glibc: stat.c Makefile
+	-@ echo "-------"
+	-@ echo " "
+	-@ echo "Compiling vs GNU libc: "
+	-@ echo " "
+	$(CC) $(CFLAGS) -c $< -o $@.o
+	$(CC) $(LDFLAGS) $@.o -o $@
+	$(STRIPTOOL) -x -R .note -R .comment $@
+	-ldd $@
+	ls $(LSFLAGS) $@
+	-./$@
+	-@ echo " "
+
+clean:
+	rm -f *.[oa] *~ core $(TARGETS)
+
+
diff --git a/test/stat/stat.c b/test/stat/stat.c
new file mode 100644
index 000000000..eb99dbc64
--- /dev/null
+++ b/test/stat/stat.c
@@ -0,0 +1,35 @@
+
+#include <sys/stat.h>
+#include <stdio.h>
+
+
+int main(int argc,char *argv[])
+{
+	struct stat s;
+	int ret;
+
+	ret = stat("/",&s);
+
+	if(ret<0){
+		perror("stat");
+		exit(1);
+	}
+
+	/* The casts are because glibc thinks it's cool */
+	printf("device    : 0x%x\n",(unsigned int)s.st_dev);
+	printf("inode     : %d\n",(int)s.st_ino);
+	printf("mode      : 0x%x\n",s.st_mode);
+	printf("nlink     : %d\n",s.st_nlink);
+	printf("uid       : %d\n",s.st_uid);
+	printf("gid       : %d\n",s.st_gid);
+	printf("rdev      : 0x%x\n",(unsigned int)s.st_rdev);
+	printf("size      : %ld\n",s.st_size);
+	printf("blksize   : %ld\n",s.st_blksize);
+	printf("blocks    : %ld\n",s.st_blocks);
+	printf("atime     : %ld\n",s.st_atime);
+	printf("mtime     : %ld\n",s.st_mtime);
+	printf("ctime     : %ld\n",s.st_ctime);
+
+	exit(0);
+}
+
-- 
cgit v1.2.3