s3-torture run t_strappend tests as LOCAL-sprintf_append
authorAndrew Bartlett <abartlet@samba.org>
Wed, 26 Oct 2011 06:21:04 +0000 (17:21 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 28 Oct 2011 11:10:28 +0000 (13:10 +0200)
source3/Makefile.in
source3/torture/proto.h
source3/torture/t_strappend.c
source3/torture/torture.c
source3/wscript_build

index f65e4aba2ee3b22cf9468a153fc6e7ca15bdca49..b8841e6c913f0ca7c5fe89850a479dd7742ad561 100644 (file)
@@ -1268,7 +1268,8 @@ SMBTORTURE_OBJ1 = torture/torture.o torture/nbio.o torture/scanner.o torture/uta
                torture/test_case_insensitive.o \
                torture/test_posix_append.o \
                torture/test_smb2.o \
-               torture/test_authinfo_structs.o
+               torture/test_authinfo_structs.o \
+               torture/t_strappend.o
 
 SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) $(TLDAP_OBJ) \
        $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
@@ -3183,10 +3184,6 @@ bin/tdbtorture@EXEEXT@: $(BINARY_PREREQS) $(TDBTORTURE_OBJ) $(LIBTALLOC) $(LIBTD
        @$(CC) -o $@ $(LDFLAGS) $(TDBTORTURE_OBJ) $(DYNEXP) \
                $(LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
-bin/t_strappend@EXEEXT@: $(BINARY_PREREQS) $(LIBTALLOC) bin/libbigballofmud.@SHLIBEXT@ torture/t_strappend.o
-       $(CC) -o $@ $(DYNEXP) $(LIBS) $(LIBTALLOC_LIBS) \
-               torture/t_strappend.o -L ./bin -lbigballofmud $(LIBWBCLIENT_LIBS)
-
 bin/t_stringoverflow@EXEEXT@: $(BINARY_PREREQS) bin/libbigballofmud.@SHLIBEXT@ torture/t_stringoverflow.o
        $(CC) -o $@ $(DYNEXP) torture/t_stringoverflow.o \
                -L./bin -lbigballofmud $(LIBWBCLIENT_LIBS)
index 7d6b2baab74b6483176a91ee940e303f36d963f8..bf75a5ae93d61752da3ccc3bfa9404f2b3cdce99 100644 (file)
@@ -95,5 +95,6 @@ bool run_nttrans_create(int dummy);
 bool run_nttrans_fsctl(int dummy);
 bool run_smb2_basic(int dummy);
 bool run_local_conv_auth_info(int dummy);
+bool run_local_sprintf_append(int dummy);
 
 #endif /* __TORTURE_H__ */
index 59874421bc5b80ae6acaf494c57d6015e03bcafd..d52371e998f9719c5dcba069ccced34c68218f67 100644 (file)
@@ -5,9 +5,9 @@
  */
 
 #include "includes.h"
-#include <assert.h>
+#include "torture/proto.h"
 
-int main(int argc, char *argv[])
+bool run_local_sprintf_append(int dummy)
 {
        TALLOC_CTX *mem_ctx;
        char *string = NULL;
@@ -18,7 +18,7 @@ int main(int argc, char *argv[])
        mem_ctx = talloc_init("t_strappend");
        if (mem_ctx == NULL) {
                fprintf(stderr, "talloc_init failed\n");
-               return 1;
+               return false;
        }
 
        sprintf_append(mem_ctx, &string, &len, &bufsize, "");
@@ -36,10 +36,14 @@ int main(int argc, char *argv[])
                        fflush(stdout);
                }
                sprintf_append(mem_ctx, &string, &len, &bufsize, "%d\n", i);
-               assert(strlen(string) == len);
+               if (strlen(string) != len) {
+                       fprintf(stderr, "sprintf_append failed: strlen(string) %lld != len %lld\n",
+                               (long long int)strlen(string), (long long int)len);
+                       return false;
+               }
        }
 
        talloc_destroy(mem_ctx);
 
-       return 0;
+       return true;
 }
index e42684dc0194572cdb7141d4fb33847bf0e54a38..cf2966c77cc2ce5988c872359a413e403bf5da62 100644 (file)
@@ -8885,6 +8885,7 @@ static struct {
        { "LOCAL-TEVENT-SELECT", run_local_tevent_select, 0},
        { "LOCAL-CONVERT-STRING", run_local_convert_string, 0},
        { "LOCAL-CONV-AUTH-INFO", run_local_conv_auth_info, 0},
+       { "LOCAL-sprintf_append", run_local_sprintf_append, 0},
        {NULL, NULL, 0}};
 
 
index 231a14bff402662190d5fe32c214f94119be84c8..d8f6893d4656b155de256567ea3eb36ebb171c45 100755 (executable)
@@ -569,7 +569,8 @@ SMBTORTURE_SRC1 = '''torture/torture.c torture/nbio.c torture/scanner.c torture/
                torture/test_notify_online.c
                torture/test_smb2.c
                torture/test_authinfo_structs.c
-                torture/test_smbsock_any_connect.c'''
+                torture/test_smbsock_any_connect.c
+                torture/t_strappend.c'''
 
 SMBTORTURE_SRC = '''${SMBTORTURE_SRC1}
         torture/wbc_async.c'''