summaryrefslogtreecommitdiff
path: root/source3/torture/mangle_test.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-04-22 12:56:14 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-04-22 12:56:14 +0000
commitbc238b9d67614b3f6d2c43b8deb724eef2d1a5f7 (patch)
treeed812ee3d202ac476798279c29fcd506b583606c /source3/torture/mangle_test.c
parenta85e84118860f85eba0c7859d8bdaf96a6595dee (diff)
downloadsamba-bc238b9d67614b3f6d2c43b8deb724eef2d1a5f7.tar.gz
samba-bc238b9d67614b3f6d2c43b8deb724eef2d1a5f7.tar.bz2
samba-bc238b9d67614b3f6d2c43b8deb724eef2d1a5f7.zip
Make the mangleing code actually use a common prefix, not just the same
name for many files. Also report complete failure to create a filename as a failure of the test. Andrew Bartlett (This used to be commit ce572df77f941c3c3f445be2c9708c096a9186ef)
Diffstat (limited to 'source3/torture/mangle_test.c')
-rw-r--r--source3/torture/mangle_test.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index d1475eb64e..e4ccfc1b83 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -107,7 +107,7 @@ static BOOL test_one(struct cli_state *cli, const char *name)
static void gen_name(char *name)
{
- const char *chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-$~...";
+ const char *chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-$~... ";
unsigned max_idx = strlen(chars);
unsigned len;
int i;
@@ -135,7 +135,12 @@ static void gen_name(char *name)
/* and a medium probability of a common lead string */
if (random() % 10 == 0) {
- strncpy(p, "ABCDE", 6);
+ if (strlen(p) <= 5) {
+ fstrcpy(p, "ABCDE");
+ } else {
+ /* try not to kill off the null termination */
+ memcpy(p, "ABCDE", 5);
+ }
}
/* and a high probability of a good extension length */
@@ -153,6 +158,7 @@ BOOL torture_mangle(int dummy)
extern int torture_numops;
static struct cli_state *cli;
int i;
+ BOOL ret = True;
printf("starting mangle test\n");
@@ -177,10 +183,12 @@ BOOL torture_mangle(int dummy)
for (i=0;i<torture_numops;i++) {
fstring name;
+ ZERO_STRUCT(name);
gen_name(name);
-
+
if (!test_one(cli, name)) {
+ ret = False;
break;
}
if (total && total % 100 == 0) {
@@ -201,5 +209,5 @@ BOOL torture_mangle(int dummy)
torture_close_connection(cli);
printf("mangle test finished\n");
- return (failures == 0);
+ return (ret && (failures == 0));
}