[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-1308-g3f2d12c

Stefan Metzmacher metze at samba.org
Mon Mar 17 15:08:03 GMT 2008


The branch, v4-0-test has been updated
       via  3f2d12c61e95475009baf77c3e0fbea2abecc17a (commit)
       via  c84e3abae9781c0cbea5fee00bafe70967fb6468 (commit)
       via  9196213c49532ac60349ff55e66430b7c80b09c2 (commit)
       via  61a87bed61ef661d98131239976be95c6a8b4d96 (commit)
      from  f14737e4d2040d2f401a3b20c5e78d0d793cfc3a (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 3f2d12c61e95475009baf77c3e0fbea2abecc17a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Mar 17 12:11:44 2008 +0100

    RAW-BENCH-OPEN: avoid sync calls before the main loop
    
    On multi cpu machines the server may reply to the
    first requests while the test is still in setup mode.
    
    Now we setup the first opens, but send them all together
    when entering the main loop.
    
    metze

commit c84e3abae9781c0cbea5fee00bafe70967fb6468
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Mar 17 09:59:30 2008 +0100

    RAW-BENCH-OPEN: fix the output and calculate the total operations
    
    metze

commit 9196213c49532ac60349ff55e66430b7c80b09c2
Author: Stefan Metzmacher <metze at sernet.de>
Date:   Mon Mar 17 15:17:19 2008 +0100

    selftest: handle progress output in verbose mode
    
    metze

commit 61a87bed61ef661d98131239976be95c6a8b4d96
Author: Stefan Metzmacher <metze at sernet.de>
Date:   Mon Mar 17 14:08:57 2008 +0100

    socket_wrapper: make pcap code more portable
    
    Now the pcap support works on x86_64.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source/lib/socket_wrapper/socket_wrapper.c |   79 ++++++++++----------
 source/selftest/Subunit.pm                 |   29 +++++++-
 source/selftest/output/plain.pm            |    4 +-
 source/selftest/selftest.pl                |    2 +-
 source/torture/raw/openbench.c             |  112 ++++++++++++++++++----------
 5 files changed, 143 insertions(+), 83 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/socket_wrapper/socket_wrapper.c b/source/lib/socket_wrapper/socket_wrapper.c
index 644365a..86d9f7a 100644
--- a/source/lib/socket_wrapper/socket_wrapper.c
+++ b/source/lib/socket_wrapper/socket_wrapper.c
@@ -64,6 +64,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdint.h>
 
 #endif
 
@@ -624,67 +625,67 @@ enum swrap_packet_type {
 };
 
 struct swrap_file_hdr {
-	unsigned long	magic;
-	unsigned short	version_major;	
-	unsigned short	version_minor;
-	long		timezone;
-	unsigned long	sigfigs;
-	unsigned long	frame_max_len;
+	uint32_t	magic;
+	uint16_t	version_major;
+	uint16_t	version_minor;
+	int32_t		timezone;
+	uint32_t	sigfigs;
+	uint32_t	frame_max_len;
 #define SWRAP_FRAME_LENGTH_MAX 0xFFFF
-	unsigned long	link_type;
+	uint32_t	link_type;
 };
 #define SWRAP_FILE_HDR_SIZE 24
 
 struct swrap_packet {
 	struct {
-		unsigned long seconds;
-		unsigned long micro_seconds;
-		unsigned long recorded_length;
-		unsigned long full_length;
+		uint32_t seconds;
+		uint32_t micro_seconds;
+		uint32_t recorded_length;
+		uint32_t full_length;
 	} frame;
 #define SWRAP_PACKET__FRAME_SIZE 16
 
 	struct {
 		struct {
-			unsigned char	ver_hdrlen;
-			unsigned char	tos;
-			unsigned short	packet_length;
-			unsigned short	identification;
-			unsigned char	flags;
-			unsigned char	fragment;
-			unsigned char	ttl;
-			unsigned char	protocol;
-			unsigned short	hdr_checksum;
-			unsigned long	src_addr;
-			unsigned long	dest_addr;
+			uint8_t		ver_hdrlen;
+			uint8_t		tos;
+			uint16_t	packet_length;
+			uint16_t	identification;
+			uint8_t		flags;
+			uint8_t		fragment;
+			uint8_t		ttl;
+			uint8_t		protocol;
+			uint16_t	hdr_checksum;
+			uint32_t	src_addr;
+			uint32_t	dest_addr;
 		} hdr;
 #define SWRAP_PACKET__IP_HDR_SIZE 20
 
 		union {
 			struct {
-				unsigned short	source_port;
-				unsigned short	dest_port;
-				unsigned long	seq_num;
-				unsigned long	ack_num;
-				unsigned char	hdr_length;
-				unsigned char	control;
-				unsigned short	window;
-				unsigned short	checksum;
-				unsigned short	urg;
+				uint16_t	source_port;
+				uint16_t	dest_port;
+				uint32_t	seq_num;
+				uint32_t	ack_num;
+				uint8_t		hdr_length;
+				uint8_t		control;
+				uint16_t	window;
+				uint16_t	checksum;
+				uint16_t	urg;
 			} tcp;
 #define SWRAP_PACKET__IP_P_TCP_SIZE 20
 			struct {
-				unsigned short	source_port;
-				unsigned short	dest_port;
-				unsigned short	length;
-				unsigned short	checksum;
+				uint16_t	source_port;
+				uint16_t	dest_port;
+				uint16_t	length;
+				uint16_t	checksum;
 			} udp;
 #define SWRAP_PACKET__IP_P_UDP_SIZE 8
 			struct {
-				unsigned char	type;
-				unsigned char	code;
-				unsigned short	checksum;
-				unsigned long	unused;
+				uint8_t		type;
+				uint8_t		code;
+				uint16_t	checksum;
+				uint32_t	unused;
 			} icmp;
 #define SWRAP_PACKET__IP_P_ICMP_SIZE 8
 		} p;
diff --git a/source/selftest/Subunit.pm b/source/selftest/Subunit.pm
index e5c61ca..f8a7794 100644
--- a/source/selftest/Subunit.pm
+++ b/source/selftest/Subunit.pm
@@ -15,7 +15,34 @@ sub parse_results($$$$$)
 	my $unexpected_err = 0;
 	my $orig_open_len = $#$open_tests;
 
-	while(<$fh>) {
+	while(1) {
+		my $line = "";
+		my $char = "";
+		my $eof = 0;
+		my $error = 0;
+
+		while ($char ne "\n") {
+			my $ret = sysread($fh, $char, 1);
+			if (not defined($ret)) {
+				$error = $!;
+				last;
+			}
+			if ($ret == 0) {
+				$eof = 1;
+				last;
+			}
+
+			$line .= $char;
+			if ($char eq "\r") {
+				$msg_ops->output_msg($line);
+				$line = "";
+			}
+		}
+
+		last if ($eof or $error);
+
+		$_ = $line;
+
 		if (/^test: (.+)\n/) {
 			$msg_ops->control_msg($_);
 			$msg_ops->start_test($open_tests, $1);
diff --git a/source/selftest/output/plain.pm b/source/selftest/output/plain.pm
index e491a99..25ff747 100644
--- a/source/selftest/output/plain.pm
+++ b/source/selftest/output/plain.pm
@@ -7,8 +7,6 @@ use Exporter;
 use FindBin qw($RealBin);
 use lib "$RealBin/..";
 
-use Subunit qw(parse_results);
-
 use strict;
 
 sub new($$$$$$$) {
@@ -62,7 +60,9 @@ sub output_msg($$)
 	my ($self, $output) = @_;
 
 	if ($self->{verbose}) {
+		require FileHandle;
 		print $output;
+		STDOUT->flush();
 	} else {
 		$self->{test_output}->{$self->{NAME}} .= $output;
 	}
diff --git a/source/selftest/selftest.pl b/source/selftest/selftest.pl
index 73d03f3..39a1b5a 100755
--- a/source/selftest/selftest.pl
+++ b/source/selftest/selftest.pl
@@ -584,7 +584,7 @@ push (@torture_options, "--configfile=$conffile");
 push (@torture_options, "--maximum-runtime=$torture_maxtime");
 push (@torture_options, "--target=$opt_target");
 push (@torture_options, "--basedir=$prefix_abs");
-push (@torture_options, "--option=torture:progress=no") if ($opt_format eq "buildfarm");
+push (@torture_options, "--option=torture:progress=no") unless ($opt_verbose);
 push (@torture_options, "--format=subunit");
 push (@torture_options, "--option=torture:quick=yes") if ($opt_quick);
 
diff --git a/source/torture/raw/openbench.c b/source/torture/raw/openbench.c
index 87b27d0..e8b2f56 100644
--- a/source/torture/raw/openbench.c
+++ b/source/torture/raw/openbench.c
@@ -37,7 +37,7 @@
 
 static int nprocs;
 static int open_failed;
-static int open_retries;
+static int close_failed;
 static char **fnames;
 static int num_connected;
 static struct timed_event *report_te;
@@ -49,12 +49,16 @@ struct benchopen_state {
 	struct smbcli_state *cli;
 	struct smbcli_tree *tree;
 	int client_num;
-	int old_fnum;
-	int fnum;
-	int file_num;
+	int close_fnum;
+	int open_fnum;
+	int close_file_num;
+	int open_file_num;
+	int pending_file_num;
+	int next_file_num;
 	int count;
 	int lastcount;
 	union smb_open open_parms;
+	int open_retries;
 	union smb_close close_parms;
 	struct smbcli_request *req_open;
 	struct smbcli_request *req_close;
@@ -95,11 +99,11 @@ static void reopen_connection_complete(struct composite_context *ctx)
 
 	num_connected++;
 
-	DEBUG(0,("reconnect to %s finished (%u connected)\n", state->dest_host,
-		 num_connected));
+	DEBUG(0,("[%u] reconnect to %s finished (%u connected)\n",
+		 state->client_num, state->dest_host, num_connected));
 
-	state->fnum = -1;
-	state->old_fnum = -1;
+	state->open_fnum = -1;
+	state->close_fnum = -1;
 	next_open(state);
 }
 
@@ -136,7 +140,8 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te,
 	/* kill off the remnants of the old connection */
 	talloc_free(state->tree);
 	state->tree = NULL;
-	state->fnum = -1;
+	state->open_fnum = -1;
+	state->close_fnum = -1;
 
 	ctx = smb_composite_connect_send(io, state->mem_ctx, 
 					 lp_resolve_context(state->tctx->lp_ctx), 
@@ -158,9 +163,10 @@ static void next_open(struct benchopen_state *state)
 {
 	state->count++;
 
-	state->file_num = (state->file_num+1) % (3*nprocs);
+	state->pending_file_num = state->next_file_num;
+	state->next_file_num = (state->next_file_num+1) % (3*nprocs);
 
-	DEBUG(2,("[%d] opening %u\n", state->client_num, state->file_num));
+	DEBUG(2,("[%d] opening %u\n", state->client_num, state->pending_file_num));
 	state->open_parms.ntcreatex.level = RAW_OPEN_NTCREATEX;
 	state->open_parms.ntcreatex.in.flags = 0;
 	state->open_parms.ntcreatex.in.root_fid = 0;
@@ -172,7 +178,7 @@ static void next_open(struct benchopen_state *state)
 	state->open_parms.ntcreatex.in.create_options = 0;
 	state->open_parms.ntcreatex.in.impersonation = 0;
 	state->open_parms.ntcreatex.in.security_flags = 0;
-	state->open_parms.ntcreatex.in.fname = fnames[state->file_num];
+	state->open_parms.ntcreatex.in.fname = fnames[state->pending_file_num];
 
 	state->req_open = smb_raw_open_send(state->tree, &state->open_parms);
 	state->req_open->async.fn = open_completed;
@@ -182,18 +188,18 @@ static void next_open(struct benchopen_state *state)
 
 static void next_close(struct benchopen_state *state)
 {
-	DEBUG(2,("[%d] closing %d\n", state->client_num, state->old_fnum));
-	if (state->old_fnum == -1) {
+	if (state->close_fnum == -1) {
 		return;
 	}
+	DEBUG(2,("[%d] closing %d (fnum[%d])\n",
+		 state->client_num, state->close_file_num, state->close_fnum));
 	state->close_parms.close.level = RAW_CLOSE_CLOSE;
-	state->close_parms.close.in.file.fnum = state->old_fnum;
+	state->close_parms.close.in.file.fnum = state->close_fnum;
 	state->close_parms.close.in.write_time = 0;
 
 	state->req_close = smb_raw_close_send(state->tree, &state->close_parms);
 	state->req_close->async.fn = close_completed;
 	state->req_close->async.private = state;
-	state->old_fnum = -1;
 }
 
 /*
@@ -218,7 +224,8 @@ static void open_completed(struct smbcli_request *req)
 		state->tree = NULL;
 		state->cli = NULL;
 		num_connected--;	
-		DEBUG(0,("reopening connection to %s\n", state->dest_host));
+		DEBUG(0,("[%u] reopening connection to %s\n",
+			 state->client_num, state->dest_host));
 		talloc_free(state->te);
 		state->te = event_add_timed(state->ev, state->mem_ctx, 
 					    timeval_current_ofs(1,0), 
@@ -227,8 +234,9 @@ static void open_completed(struct smbcli_request *req)
 	}
 
 	if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
-		DEBUG(2,("[%d] retrying open\n", state->client_num));
-		open_retries++;
+		DEBUG(2,("[%d] retrying open %d\n",
+			 state->client_num, state->pending_file_num));
+		state->open_retries++;
 		state->req_open = smb_raw_open_send(state->tree, &state->open_parms);
 		state->req_open->async.fn = open_completed;
 		state->req_open->async.private = state;
@@ -237,17 +245,21 @@ static void open_completed(struct smbcli_request *req)
 
 	if (!NT_STATUS_IS_OK(status)) {
 		open_failed++;
-		DEBUG(0,("open failed - %s\n", nt_errstr(status)));
+		DEBUG(0,("[%u] open failed %d - %s\n",
+			 state->client_num, state->pending_file_num,
+			 nt_errstr(status)));
 		return;
 	}
 
-	state->old_fnum = state->fnum;
-	state->fnum = state->open_parms.ntcreatex.out.file.fnum;
+	state->close_file_num = state->open_file_num;
+	state->close_fnum = state->open_fnum;
+	state->open_file_num = state->pending_file_num;
+	state->open_fnum = state->open_parms.ntcreatex.out.file.fnum;
 
-	DEBUG(2,("[%d] open completed: fnum=%d old_fnum=%d\n", 
-		 state->client_num, state->fnum, state->old_fnum));
+	DEBUG(2,("[%d] open completed %d (fnum[%d])\n",
+		 state->client_num, state->open_file_num, state->open_fnum));
 
-	if (state->old_fnum != -1) {
+	if (state->close_fnum != -1) {
 		next_close(state);
 	}
 
@@ -271,7 +283,8 @@ static void close_completed(struct smbcli_request *req)
 		state->tree = NULL;
 		state->cli = NULL;
 		num_connected--;	
-		DEBUG(0,("reopening connection to %s\n", state->dest_host));
+		DEBUG(0,("[%u] reopening connection to %s\n",
+			 state->client_num, state->dest_host));
 		talloc_free(state->te);
 		state->te = event_add_timed(state->ev, state->mem_ctx, 
 					    timeval_current_ofs(1,0), 
@@ -280,13 +293,17 @@ static void close_completed(struct smbcli_request *req)
 	}
 
 	if (!NT_STATUS_IS_OK(status)) {
-		open_failed++;
-		DEBUG(0,("close failed - %s\n", nt_errstr(status)));
+		close_failed++;
+		DEBUG(0,("[%u] close failed %d (fnum[%d]) - %s\n",
+			 state->client_num, state->close_file_num,
+			 state->close_fnum,
+			 nt_errstr(status)));
 		return;
 	}
 
-	DEBUG(2,("[%d] close completed: fnum=%d old_fnum=%d\n", 
-		 state->client_num, state->fnum, state->old_fnum));
+	DEBUG(2,("[%d] close completed %d (fnum[%d])\n",
+		 state->client_num, state->close_file_num,
+		 state->close_fnum));
 }	
 
 static void echo_completion(struct smbcli_request *req)
@@ -298,7 +315,8 @@ static void echo_completion(struct smbcli_request *req)
 		talloc_free(state->tree);
 		state->tree = NULL;
 		num_connected--;	
-		DEBUG(0,("reopening connection to %s\n", state->dest_host));
+		DEBUG(0,("[%u] reopening connection to %s\n",
+			 state->client_num, state->dest_host));
 		talloc_free(state->te);
 		state->te = event_add_timed(state->ev, state->mem_ctx, 
 					    timeval_current_ofs(1,0), 
@@ -352,7 +370,9 @@ bool torture_bench_open(struct torture_context *torture)
 	struct timeval tv;
 	struct event_context *ev = event_context_find(mem_ctx);
 	struct benchopen_state *state;
-	int total = 0, minops=0;
+	int total = 0;
+	int total_retries = 0;
+	int minops = 0;
 	bool progress=false;
 
 	progress = torture_setting_bool(torture, "progress", true);
@@ -397,11 +417,10 @@ bool torture_bench_open(struct torture_context *torture)
 	}
 
 	for (i=0;i<nprocs;i++) {
-		state[i].file_num = i;		
-		state[i].fnum = smbcli_open(state[i].tree, 
-					    fnames[state->file_num], 
-					    O_RDWR|O_CREAT, DENY_ALL);
-		state[i].old_fnum = -1;
+		/* all connections start with the same file */
+		state[i].next_file_num = 0;
+		state[i].open_fnum = -1;
+		state[i].close_fnum = -1;
 		next_open(&state[i]);
 	}
 
@@ -420,17 +439,30 @@ bool torture_bench_open(struct torture_context *torture)
 			DEBUG(0,("open failed\n"));
 			goto failed;
 		}
+		if (close_failed) {
+			DEBUG(0,("open failed\n"));
+			goto failed;
+		}
 	}
 
 	talloc_free(report_te);
+	if (progress) {
+		for (i=0;i<nprocs;i++) {
+			printf("      ");
+		}
+		printf("\r");
+	}
 
-	printf("%.2f ops/second (%d retries)\n", 
-	       total/timeval_elapsed(&tv), open_retries);
 	minops = state[0].count;
 	for (i=0;i<nprocs;i++) {
-		printf("[%d] %u ops\n", i, state[i].count);
+		total += state[i].count;
+		total_retries += state[i].open_retries;
+		printf("[%d] %u ops (%u retries)\n",
+		       i, state[i].count, state[i].open_retries);
 		if (state[i].count < minops) minops = state[i].count;
 	}
+	printf("%.2f ops/second (%d retries)\n",
+	       total/timeval_elapsed(&tv), total_retries);
 	if (minops < 0.5*total/nprocs) {
 		printf("Failed: unbalanced open\n");
 		goto failed;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list