From f31fd31b71eda4957475fb09de1ef26e3a050414 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 26 Oct 2011 17:21:04 +1100 Subject: s3-torture run t_strappend tests as LOCAL-sprintf_append --- source3/Makefile.in | 7 ++----- source3/torture/proto.h | 1 + source3/torture/t_strappend.c | 14 +++++++++----- source3/torture/torture.c | 1 + source3/wscript_build | 3 ++- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index f65e4aba2e..b8841e6c91 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -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) diff --git a/source3/torture/proto.h b/source3/torture/proto.h index 7d6b2baab7..bf75a5ae93 100644 --- a/source3/torture/proto.h +++ b/source3/torture/proto.h @@ -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__ */ diff --git a/source3/torture/t_strappend.c b/source3/torture/t_strappend.c index 59874421bc..d52371e998 100644 --- a/source3/torture/t_strappend.c +++ b/source3/torture/t_strappend.c @@ -5,9 +5,9 @@ */ #include "includes.h" -#include +#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; } diff --git a/source3/torture/torture.c b/source3/torture/torture.c index e42684dc01..cf2966c77c 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -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}}; diff --git a/source3/wscript_build b/source3/wscript_build index 231a14bff4..d8f6893d46 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -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''' -- cgit