summaryrefslogtreecommitdiff
path: root/source4/torture/winbind/struct_based.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-09-19 16:22:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:06:58 -0500
commita75ba7c53d28ab2182d70377837d7b9dd8682997 (patch)
tree479dc416e2273321535e20b0c602fa681e5f3d28 /source4/torture/winbind/struct_based.c
parent90bd9f377013cd9d83b1d37e2833e980e8d6c735 (diff)
downloadsamba-a75ba7c53d28ab2182d70377837d7b9dd8682997.tar.gz
samba-a75ba7c53d28ab2182d70377837d7b9dd8682997.tar.bz2
samba-a75ba7c53d28ab2182d70377837d7b9dd8682997.zip
r25234: make WINBIND-STRUCT-PING a benchmark test
which runs WINBIND_PING for 5 seconds metze (This used to be commit 86809a965e160d0e6dff2d9bde8c990783388d8d)
Diffstat (limited to 'source4/torture/winbind/struct_based.c')
-rw-r--r--source4/torture/winbind/struct_based.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c
index 3e17fe6358..5ecc5c99da 100644
--- a/source4/torture/winbind/struct_based.c
+++ b/source4/torture/winbind/struct_based.c
@@ -22,15 +22,31 @@
#include "torture/winbind/proto.h"
#include "nsswitch/winbind_client.h"
+#define DO_STRUCT_REQ_REP(op,req,rep) do { \
+ NSS_STATUS _result; \
+ _result = winbindd_request_response(op, req, rep); \
+ torture_assert_int_equal(torture, _result, NSS_STATUS_SUCCESS, \
+ __STRING(op) "(struct based)"); \
+} while (0)
+
static bool torture_winbind_struct_ping(struct torture_context *torture)
{
- NSS_STATUS result;
-
- torture_comment(torture, "Testing WINBINDD_PING (struct based protocol)\n");
-
- result = winbindd_request_response(WINBINDD_PING, NULL, NULL);
- torture_assert_int_equal(torture,result,NSS_STATUS_SUCCESS,
- "WINBINDD_PING (struct based protocol)");
+ struct timeval tv = timeval_current();
+ int timelimit = torture_setting_int(torture, "timelimit", 5);
+ uint32_t total = 0;
+
+ torture_comment(torture,
+ "Running WINBINDD_PING (struct based) for %d seconds\n",
+ timelimit);
+
+ while (timeval_elapsed(&tv) < timelimit) {
+ DO_STRUCT_REQ_REP(WINBINDD_PING, NULL, NULL);
+ total++;
+ }
+
+ torture_comment(torture,
+ "%u (%.1f/s) WINBINDD_PING (struct based)\n",
+ total, total / timeval_elapsed(&tv));
return true;
}