summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-26 17:21:04 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-10-28 13:10:28 +0200
commitf31fd31b71eda4957475fb09de1ef26e3a050414 (patch)
tree196f11dafee64c8eb3a9ac2bb10d950323547387 /source3/torture
parent4cc0552f6ef4f7985c48d23cc3854b214103bb97 (diff)
downloadsamba-f31fd31b71eda4957475fb09de1ef26e3a050414.tar.gz
samba-f31fd31b71eda4957475fb09de1ef26e3a050414.tar.bz2
samba-f31fd31b71eda4957475fb09de1ef26e3a050414.zip
s3-torture run t_strappend tests as LOCAL-sprintf_append
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/proto.h1
-rw-r--r--source3/torture/t_strappend.c14
-rw-r--r--source3/torture/torture.c1
3 files changed, 11 insertions, 5 deletions
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 <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;
}
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}};