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/torture/proto.h | 1 + source3/torture/t_strappend.c | 14 +++++++++----- source3/torture/torture.c | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'source3/torture') 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}}; -- cgit