git.samba.org
/
sfrench
/
samba-autobuild
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a2d5f9a
)
nicer measurement of failures and collisions
author
Andrew Tridgell
<tridge@samba.org>
Fri, 12 Apr 2002 03:54:13 +0000
(
03:54
+0000)
committer
Andrew Tridgell
<tridge@samba.org>
Fri, 12 Apr 2002 03:54:13 +0000
(
03:54
+0000)
(This used to be commit
61c61f6b4f22c1ef6f837145f5e05730706cc8d4
)
source3/torture/mangle_test.c
patch
|
blob
|
history
diff --git
a/source3/torture/mangle_test.c
b/source3/torture/mangle_test.c
index 7f05b953c5e3d26735f48e692c1da4adf0b0269c..2d5b3610d557a7e5ed7d90e1091f7e6fb9cfbe89 100644
(file)
--- a/
source3/torture/mangle_test.c
+++ b/
source3/torture/mangle_test.c
@@
-24,7
+24,7
@@
static TDB_CONTEXT *tdb;
#define NAME_LENGTH 20
#define NAME_LENGTH 20
-static unsigned total, collisions;
+static unsigned total, collisions
, failures
;
static BOOL test_one(struct cli_state *cli, const char *name)
{
static BOOL test_one(struct cli_state *cli, const char *name)
{
@@
-76,7
+76,9
@@
static BOOL test_one(struct cli_state *cli, const char *name)
if (!cli_unlink(cli, name)) {
printf("unlink2 of %s (%s) failed (%s)\n",
name, name2, cli_errstr(cli));
if (!cli_unlink(cli, name)) {
printf("unlink2 of %s (%s) failed (%s)\n",
name, name2, cli_errstr(cli));
- return False;
+ failures++;
+ cli_unlink(cli, name2);
+ return True;
}
/* see if the short name is already in the tdb */
}
/* see if the short name is already in the tdb */
@@
-127,6
+129,11
@@
static void gen_name(char *name)
p[0] = 'A';
}
p[0] = 'A';
}
+ /* and a medium probability of a common lead string */
+ if (random() % 10 == 0) {
+ strncpy(p, "ABCDE", 5);
+ }
+
/* and a high probability of a good extension length */
if (random() % 2 == 0) {
char *s = strrchr(p, '.');
/* and a high probability of a good extension length */
if (random() % 2 == 0) {
char *s = strrchr(p, '.');
@@
-173,21
+180,22
@@
BOOL torture_mangle(int dummy)
break;
}
if (total && total % 100 == 0) {
break;
}
if (total && total % 100 == 0) {
- printf("collisions %u/%u - %.2f%%\r",
- collisions, total, (100.0*collisions) / total);
+ printf("collisions %u/%u - %.2f%%
(%u failures)
\r",
+ collisions, total, (100.0*collisions) / total
, failures
);
}
}
}
}
+ cli_unlink(&cli, "\\mangle_test\\*");
if (!cli_rmdir(&cli, "\\mangle_test")) {
printf("ERROR: Failed to remove directory\n");
return False;
}
if (!cli_rmdir(&cli, "\\mangle_test")) {
printf("ERROR: Failed to remove directory\n");
return False;
}
- printf("\nTotal collisions %u/%u - %.2f%%\n",
- collisions, total, (100.0*collisions) / total);
+ printf("\nTotal collisions %u/%u - %.2f%%
(%u failures)
\n",
+ collisions, total, (100.0*collisions) / total
, failures
);
torture_close_connection(&cli);
printf("mangle test finished\n");
torture_close_connection(&cli);
printf("mangle test finished\n");
- return
True
;
+ return
(failures == 0)
;
}
}