summaryrefslogtreecommitdiff
path: root/source4/lib/replace
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-09-13 06:11:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:30 -0500
commit764f74c565e4d5472c68ac9d820b6d1b1dbd598a (patch)
tree493e0176d96021ea208a45e1b579be0b307dc99b /source4/lib/replace
parent918db36213fdd2faea7dc200de43595259b397f4 (diff)
downloadsamba-764f74c565e4d5472c68ac9d820b6d1b1dbd598a.tar.gz
samba-764f74c565e4d5472c68ac9d820b6d1b1dbd598a.tar.bz2
samba-764f74c565e4d5472c68ac9d820b6d1b1dbd598a.zip
r18442: run the os2_delete test in the testsuite too
that shows that Tru64 is broken... It doesn't have getdirent() and the the replacement code doesn't work there. tridge: do you have any idea how to fix this? metze (This used to be commit a5ebfd0ab71f4f4288697f6fd3183a440ce7506b)
Diffstat (limited to 'source4/lib/replace')
-rw-r--r--source4/lib/replace/Makefile.in2
-rw-r--r--source4/lib/replace/repdir/config.m416
-rw-r--r--source4/lib/replace/test/os2_delete.c10
-rw-r--r--source4/lib/replace/test/testsuite.c9
4 files changed, 25 insertions, 12 deletions
diff --git a/source4/lib/replace/Makefile.in b/source4/lib/replace/Makefile.in
index adaf0cd956..6940673a78 100644
--- a/source4/lib/replace/Makefile.in
+++ b/source4/lib/replace/Makefile.in
@@ -36,7 +36,7 @@ test: testsuite
installcheck: install test
-TEST_OBJS = test/testsuite.o
+TEST_OBJS = test/testsuite.o test/os2_delete.o
testsuite: libreplace.a $(TEST_OBJS)
$(CC) -o testsuite $(TEST_OBJS) -L. -lreplace
diff --git a/source4/lib/replace/repdir/config.m4 b/source4/lib/replace/repdir/config.m4
index b2a20ccee6..cc91f2a97a 100644
--- a/source4/lib/replace/repdir/config.m4
+++ b/source4/lib/replace/repdir/config.m4
@@ -1,15 +1,21 @@
AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
- AC_TRY_RUN([#include "$libreplacedir/test/os2_delete.c"],
- [samba_cv_HAVE_BROKEN_READDIR=no],
- [samba_cv_HAVE_BROKEN_READDIR=yes],
- [samba_cv_HAVE_BROKEN_READDIR="assuming not"])])
+ AC_TRY_RUN([
+#define test_readdir_os2_delete main
+#include "$libreplacedir/test/os2_delete.c"],
+ [samba_cv_HAVE_BROKEN_READDIR=no],
+ [samba_cv_HAVE_BROKEN_READDIR=yes],
+ [samba_cv_HAVE_BROKEN_READDIR="assuming not"])
+])
if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then
AC_CACHE_CHECK([for replacing readdir],samba_cv_REPLACE_READDIR,[
AC_TRY_RUN([
#include "$libreplacedir/repdir/repdir.c"
+#define test_readdir_os2_delete main
#include "$libreplacedir/test/os2_delete.c"],
- samba_cv_REPLACE_READDIR=yes,samba_cv_REPLACE_READDIR=no)])
+ [samba_cv_REPLACE_READDIR=yes],
+ [samba_cv_REPLACE_READDIR=no])
+])
fi
SMB_ENABLE(REPLACE_READDIR, NO)
diff --git a/source4/lib/replace/test/os2_delete.c b/source4/lib/replace/test/os2_delete.c
index 288e4a5d8f..c73b7e54cd 100644
--- a/source4/lib/replace/test/os2_delete.c
+++ b/source4/lib/replace/test/os2_delete.c
@@ -12,9 +12,6 @@
#include <errno.h>
#include <string.h>
#include <fcntl.h>
-#ifdef REPLACE_READDIR
-#include "lib/replace/repdir/repdir.h"
-#endif
#define NUM_FILES 700
#define READDIR_SIZE 100
@@ -22,7 +19,10 @@
#define TESTDIR "test.dir"
-#define FAILED(d) (fprintf(stderr, "Failed for %s - %s\n", d, strerror(errno)), exit(1), 1)
+static int test_readdir_os2_delete_ret;
+
+#define FAILED(d) (fprintf(stderr, "Failed for %s - %s\n", d, strerror(errno)), test_readdir_os2_delete_ret = 1, 1)
+#define CHECK do { if (test_readdir_os2_delete_ret != 0) return test_readdir_os2_delete_ret; } while (0)
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
@@ -78,7 +78,7 @@ static int os2_delete(DIR *d)
return j;
}
-int main(void)
+int test_readdir_os2_delete(void)
{
int total_deleted = 0;
DIR *d;
diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c
index 89d2ae6a88..6644fce6bd 100644
--- a/source4/lib/replace/test/testsuite.c
+++ b/source4/lib/replace/test/testsuite.c
@@ -229,8 +229,15 @@ static int test_opendir(void)
return true;
}
-static int test_readdir(void)
+extern int test_readdir_os2_delete(void);
+
+static bool test_readdir(void)
{
+ printf("testing readdir\n");
+ if (test_readdir_os2_delete() != 0) {
+ return false;
+ }
+
/* FIXME */
return true;
}