diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-02-21 04:02:55 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2004-02-21 04:02:55 +0000 |
commit | 420c7b4c5dd4213f0b97e1aa987274b611726455 (patch) | |
tree | 7ad49fddb0578dc07a0170f80b54569c96ec2482 /source4/torture/torture.c | |
parent | 6c7e231773ec83c0ec31df51866ad5765e593100 (diff) | |
download | samba-420c7b4c5dd4213f0b97e1aa987274b611726455.tar.gz samba-420c7b4c5dd4213f0b97e1aa987274b611726455.tar.bz2 samba-420c7b4c5dd4213f0b97e1aa987274b611726455.zip |
added the simple HOLDCON torture test. This is used to establish
hundreds of idle connections to the server, which can be used to
simulate environments with large numbers of idle connections.
(This used to be commit cfce9458a22e8b6da1a10bb338b287c3eab9a1fc)
Diffstat (limited to 'source4/torture/torture.c')
-rw-r--r-- | source4/torture/torture.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 9c71508bdf..a770e98c5f 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -2827,6 +2827,61 @@ static BOOL run_pipe_number(int dummy) } + + +/* + open N connections to the server and just hold them open + used for testing performance when there are N idle users + already connected + */ + static BOOL torture_holdcon(int dummy) +{ + int i; + struct cli_state **cli; + int num_dead = 0; + + printf("Opening %d connections\n", torture_numops); + + cli = malloc(sizeof(struct cli_state *) * torture_numops); + + for (i=0;i<torture_numops;i++) { + if (!torture_open_connection(&cli[i])) { + return False; + } + printf("opened %d connections\r", i); + fflush(stdout); + } + + printf("\nStarting pings\n"); + + while (1) { + for (i=0;i<torture_numops;i++) { + NTSTATUS status; + if (cli[i]) { + status = cli_chkpath(cli[i]->tree, "\\"); + if (!NT_STATUS_IS_OK(status)) { + printf("Connection %d is dead\n", i); + cli[i] = NULL; + num_dead++; + } + usleep(100); + } + } + + if (num_dead == torture_numops) { + printf("All connections dead - finishing\n"); + break; + } + + printf("."); + fflush(stdout); + } + + return True; +} + + + /* Test open mode returns on read-only files. */ @@ -3943,6 +3998,7 @@ static struct { {"PIPE_NUMBER", run_pipe_number, 0}, {"IOCTL", torture_ioctl_test, 0}, {"CHKPATH", torture_chkpath_test, 0}, + {"HOLDCON", torture_holdcon, 0}, {"RAW-QFSINFO", torture_raw_qfsinfo, 0}, {"RAW-QFILEINFO", torture_raw_qfileinfo, 0}, {"RAW-SFILEINFO", torture_raw_sfileinfo, 0}, |