Author: jelmer
Date: 2006-10-17 14:54:47 +0000 (Tue, 17 Oct 2006)
New Revision: 19373

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19373

Log:
Merge changes from subunit branch: Convert libreplace testsuite to a 
standalone program that speaks subunit.

Added:
   branches/SAMBA_4_0/source/lib/replace/config.mk
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/basic.mk
   branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c
   branches/SAMBA_4_0/source/lib/replace/test/testsuite.c
   branches/SAMBA_4_0/source/torture/local/config.mk
   branches/SAMBA_4_0/source/torture/local/local.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:merge
   - [EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

   + [EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]


Modified: branches/SAMBA_4_0/source/lib/basic.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/basic.mk      2006-10-17 13:19:55 UTC (rev 
19372)
+++ branches/SAMBA_4_0/source/lib/basic.mk      2006-10-17 14:54:47 UTC (rev 
19373)
@@ -4,6 +4,7 @@
 include charset/config.mk
 include ldb/config.mk
 include talloc/config.mk
+include replace/config.mk
 include tdb/config.mk
 include tls/config.mk
 include registry/config.mk

Added: branches/SAMBA_4_0/source/lib/replace/config.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/config.mk     2006-10-17 13:19:55 UTC 
(rev 19372)
+++ branches/SAMBA_4_0/source/lib/replace/config.mk     2006-10-17 14:54:47 UTC 
(rev 19373)
@@ -0,0 +1,4 @@
+[BINARY::REPLACE]
+OBJ_FILES = test/testsuite.o test/os2_delete.o
+PRIVATE_DEPENDENCIES = LIBREPLACE
+INSTALLDIR = TORTUREDIR/LOCAL

Modified: branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c     2006-10-17 
13:19:55 UTC (rev 19372)
+++ branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c     2006-10-17 
14:54:47 UTC (rev 19373)
@@ -21,7 +21,7 @@
 
 static int test_readdir_os2_delete_ret;
 
-#define FAILED(d) (fprintf(stderr, "Failed for %s - %d = %s\n", d, errno, 
strerror(errno)), test_readdir_os2_delete_ret = 1, 1)
+#define FAILED(d) (printf("failure: readdir [\nFailed for %s - %d = %s\n]\n", 
d, errno, strerror(errno)), test_readdir_os2_delete_ret = 1, 1)
 
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))
@@ -107,7 +107,7 @@
        }
        closedir(d);
 
-       printf("Deleted %d files of %d\n", total_deleted, NUM_FILES);
+       fprintf(stderr, "Deleted %d files of %d\n", total_deleted, NUM_FILES);
 
        rmdir(TESTDIR) == 0 || FAILED("rmdir");
 

Modified: branches/SAMBA_4_0/source/lib/replace/test/testsuite.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/test/testsuite.c      2006-10-17 
13:19:55 UTC (rev 19372)
+++ branches/SAMBA_4_0/source/lib/replace/test/testsuite.c      2006-10-17 
14:54:47 UTC (rev 19373)
@@ -57,26 +57,28 @@
        struct stat st;
        int fd;
        const int size = 1234;
-       printf("testing ftruncate\n");
+       printf("test: ftruncate\n");
        unlink(TESTFILE);
        fd = open(TESTFILE, O_RDWR|O_CREAT, 0600);
        if (fd == -1) {
-               printf("creating '%s' failed - %s\n", TESTFILE, 
strerror(errno));
+               printf("failure: ftruncate [\n"
+                          "creating '%s' failed - %s\n]\n", TESTFILE, 
strerror(errno));
                return false;
        }
        if (ftruncate(fd, size) != 0) {
-               printf("ftruncate failed - %s\n", strerror(errno));
+               printf("failure: ftruncate [\n%s\n]\n", strerror(errno));
                return false;
        }
        if (fstat(fd, &st) != 0) {
-               printf("fstat failed - %s\n", strerror(errno));
+               printf("failure: ftruncate [\nfstat failed - %s\n]\n", 
strerror(errno));
                return false;
        }
        if (st.st_size != size) {
-               printf("ftruncate gave wrong size %d - expected %d\n",
+               printf("failure: ftruncate [\ngave wrong size %d - expected 
%d\n]\n",
                       (int)st.st_size, size);
                return false;
        }
+       printf("success: ftruncate\n");
        return true;
 }
 
@@ -98,13 +100,14 @@
                { NULL, 0 }
        };
        int i;
-       printf("testing strlcpy\n");
+       printf("test: strlcpy\n");
        for (i=0;tests[i].src;i++) {
                if (strlcpy(buf, tests[i].src, sizeof(buf)) != tests[i].result) 
{
-                       printf("strlcpy test %d failed\n", i);
+                       printf("failure: strlcpy [\ntest %d failed\n]\n", i);
                        return false;
                }
        }
+       printf("success: strlcpy\n");
        return true;
 }
 
@@ -146,8 +149,9 @@
 
 static int test_setlinebuf(void)
 {
-       printf("testing setlinebuf\n");
+       printf("test: setlinebuf\n");
        setlinebuf(stdout);
+       printf("success: setlinebuf\n");
        return true;
 }
 
@@ -233,10 +237,11 @@
 
 static int test_readdir(void)
 {
-       printf("testing readdir\n");
+       printf("test: readdir\n");
        if (test_readdir_os2_delete() != 0) {
                return false;
        }
+       printf("success: readdir\n");
        return true;
 }
 
@@ -373,7 +378,7 @@
 
 struct torture_context;
 
-bool torture_local_replace(struct torture_context *torture)
+int main()
 {
        bool ret = true;
        ret &= test_ftruncate();
@@ -420,16 +425,7 @@
        ret &= test_MIN();
        ret &= test_MAX();
 
-       return ret;
+       if (ret) 
+               return 0;
+       return -1;
 }
-
-#if _SAMBA_BUILD_<4
-int main(void)
-{
-       if (!torture_local_replace(NULL)) {
-               printf("ERROR: TESTSUITE FAILED\n");
-               return -1;
-       }
-       return 0;
-}
-#endif

Modified: branches/SAMBA_4_0/source/torture/local/config.mk
===================================================================
--- branches/SAMBA_4_0/source/torture/local/config.mk   2006-10-17 13:19:55 UTC 
(rev 19372)
+++ branches/SAMBA_4_0/source/torture/local/config.mk   2006-10-17 14:54:47 UTC 
(rev 19373)
@@ -7,8 +7,6 @@
                proto.h
 OBJ_FILES = \
                iconv.o \
-               ../../lib/replace/test/testsuite.o \
-               ../../lib/replace/test/os2_delete.o \
                ../../lib/crypto/md4test.o \
                ../../lib/crypto/md5test.o \
                ../../lib/crypto/hmacmd5test.o \

Modified: branches/SAMBA_4_0/source/torture/local/local.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/local.c     2006-10-17 13:19:55 UTC 
(rev 19372)
+++ branches/SAMBA_4_0/source/torture/local/local.c     2006-10-17 14:54:47 UTC 
(rev 19373)
@@ -53,7 +53,6 @@
                                                                                
talloc_autofree_context(),
                                                                                
"LOCAL");
 
-       torture_suite_add_simple_test(suite, "REPLACE", torture_local_replace);
        torture_suite_add_simple_test(suite, "CRYPTO-SHA1", 
                                                                  
torture_local_crypto_sha1);
        torture_suite_add_simple_test(suite, 

Reply via email to