[SCM] Samba Shared Repository - branch v4-8-test updated

Stefan Metzmacher metze at samba.org
Mon Feb 12 14:55:02 UTC 2018


The branch, v4-8-test has been updated
       via  f093cdd ctdb-tests: Set test timeout to an hour
       via  6711e70 ctdb-tests: Fix a typo
       via  74e2d61 ctdb-tests: Add a UNIT pseudo-test-suite
       via  10ffffa ctdb-tests: Only use socket-wrapper for simple, local daemon tests
       via  e7af9b0 ctdb-tests: Add timeout for individual tests, default is 10 minutes
       via  83b2971 ctdb-tests: Avoid race condition in sock_daemon test 5
       via  11acdbe selftest: fix envvars for creation of default user in wait_for_start
      from  f20fcac VERSION: Bump version up to 4.8.0rc4...

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-8-test


- Log -----------------------------------------------------------------
commit f093cdd2afeb54e7927be59839402ecb1e82ce3b
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 5 15:45:09 2018 +1100

    ctdb-tests: Set test timeout to an hour
    
    The current 10 minute timeout is causing autobuild failures in some
    environments.
    
    This timeout is simply meant to stop a test run from hanging
    indefinitely due to a broken test.  A 1 hour timeout is better than no
    timeout.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Thu Feb  8 04:42:56 CET 2018 on sn-devel-144
    
    (cherry picked from commit a3485c41b826e307b31a1113abcea9843ca78540)
    
    The last 6 patches address https://bugzilla.samba.org/show_bug.cgi?id=13265
    
    Autobuild-User(v4-8-test): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(v4-8-test): Mon Feb 12 15:54:28 CET 2018 on sn-devel-144

commit 6711e701585c162646da9e434908db06f31bf2af
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jan 23 20:18:54 2018 +1100

    ctdb-tests: Fix a typo
    
    This typo causes the script to be run with the default shell.  If this
    is not bash then the shell will fail to parse integration.bash.
    
    This is a regression caused by commit
    c607989d91b64d837253aae794b1a3d6013eb3e0.  Clearly nobody has run this
    test on Debian for a long time.  :-(
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Wed Jan 24 10:28:52 CET 2018 on sn-devel-144
    
    (cherry picked from commit 8b82d10856160d3b3f172bf7d45ac561002dbcac)

commit 74e2d615d134b56ccdbf4ae8d91c46a1c387eb7c
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jan 22 19:48:02 2018 +1100

    ctdb-tests: Add a UNIT pseudo-test-suite
    
    This runs all of the unit tests.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 50150d75814de6a1e2cb28fb7af72caa31d73e3c)

commit 10ffffa6c00a890b46c22ea87e4653953d0948c2
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Jan 22 19:14:48 2018 +1100

    ctdb-tests: Only use socket-wrapper for simple, local daemon tests
    
    The run_tests.sh -S option now takes the path to the socker-wrapper
    shared library.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit e17d02d4039001563d189b33200c30e3906ce845)

commit e7af9b0baf46e90d63621c709dcc8e85af465f5c
Author: Martin Schwenke <martin at meltin.net>
Date:   Sat Jan 20 17:05:37 2018 +1100

    ctdb-tests: Add timeout for individual tests, default is 10 minutes
    
    This will cause a hung test to time out and fail rather than letting a
    test run hang indefinitely.  Some tests can take 5 minutes to run, so
    10 minutes should be plenty.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit da3aaf972ab5b339b51ba1e802329b69885ccfe4)

commit 83b2971f002f80f7bbbd098bfe7da70e1b019607
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Jan 22 12:54:49 2018 +1100

    ctdb-tests: Avoid race condition in sock_daemon test 5
    
    This test fails when it takes more than 10s to run.  This can occur
    when the system is loaded and socket-wrapper is used.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 33c0f5599d93a34619c8f37945f79a6e399a1b5e)

commit 11acdbe842435d2f7ac4f62cd1b11358dee0ade1
Author: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
Date:   Mon Jan 15 15:25:10 2018 +1300

    selftest: fix envvars for creation of default user in wait_for_start
    
    Resolves failure of ad_member to start up under ad_dc (if
    the user is determined to be needed).
    
    Signed-off-by: Jamie McClymont <jamiemcclymont at catalyst.net.nz>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13225
    
    Autobuild-User(master): Garming Sam <garming at samba.org>
    Autobuild-Date(master): Tue Jan 16 07:12:01 CET 2018 on sn-devel-144
    
    (cherry picked from commit 7a3f97f2662c6197913aeb50e5e3c0c09ff8307f)

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

Summary of changes:
 ctdb/tests/run_tests.sh                      | 52 ++++++++++++++++++++--------
 ctdb/tests/simple/14_ctdb_statistics.sh      |  1 -
 ctdb/tests/simple/scripts/local_daemons.bash |  6 ++++
 ctdb/tests/src/sock_daemon_test.c            | 26 +++++++++-----
 ctdb/wscript                                 |  3 +-
 selftest/target/Samba3.pm                    |  4 +++
 6 files changed, 65 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh
index ffc81d4..a7ca44e 100755
--- a/ctdb/tests/run_tests.sh
+++ b/ctdb/tests/run_tests.sh
@@ -14,7 +14,7 @@ Options:
   -H		No headers - for running single test with other wrapper
   -N		Don't print summary of tests results after running all tests
   -q		Quiet - don't show tests being run (hint: use with -s)
-  -S            Enable socket wrapper
+  -S <lib>      Use socket wrapper library <lib> for local integration tests
   -v		Verbose - print test output for non-failures (only some tests)
   -V <dir>	Use <dir> as TEST_VAR_DIR
   -x		Trace this script with the -x option
@@ -36,7 +36,6 @@ with_desc=false
 quiet=false
 exit_on_fail=false
 no_header=false
-socket_wrapper=false
 
 export TEST_VERBOSE=false
 export TEST_COMMAND_TRACE=false
@@ -46,8 +45,10 @@ export TEST_LOCAL_DAEMONS
 [ -n "$TEST_LOCAL_DAEMONS" ] || TEST_LOCAL_DAEMONS=3
 export TEST_VAR_DIR=""
 export TEST_CLEANUP=false
+export TEST_TIMEOUT=3600
+export TEST_SOCKET_WRAPPER_SO_PATH=""
 
-temp=$(getopt -n "$prog" -o "AcCdDehHNqSvV:xX" -l help -- "$@")
+temp=$(getopt -n "$prog" -o "AcCdDehHNqS:T:vV:xX" -l help -- "$@")
 
 [ $? != 0 ] && usage
 
@@ -64,7 +65,8 @@ while true ; do
 	-H) no_header=true ; shift ;;
 	-N) with_summary=false ; shift ;;
 	-q) quiet=true ; shift ;;
-	-S) socket_wrapper=true ; shift ;;
+	-S) TEST_SOCKET_WRAPPER_SO_PATH="$2" ; shift 2 ;;
+	-T) TEST_TIMEOUT="$2" ; shift 2 ;;
 	-v) TEST_VERBOSE=true ; shift ;;
 	-V) TEST_VAR_DIR="$2" ; shift 2 ;;
 	-x) set -x; shift ;;
@@ -114,6 +116,9 @@ ctdb_test_end ()
 	    interp="PASSED"
 	    statstr=""
 	    echo "ALL OK: $*"
+	elif [ $status -eq 124 ] ; then
+	    interp="TIMEOUT"
+	    statstr=" (status $status)"
 	else
 	    interp="FAILED"
 	    statstr=" (status $status)"
@@ -137,7 +142,7 @@ ctdb_test_run ()
     $no_header || ctdb_test_begin "$name"
 
     local status=0
-    "$@" || status=$?
+    timeout $TEST_TIMEOUT "$@" || status=$?
 
     $no_header || ctdb_test_end "$name" "$status" "$*"
 
@@ -247,20 +252,25 @@ mkdir -p "$TEST_VAR_DIR"
 TEST_VAR_DIR=$(cd "$TEST_VAR_DIR"; echo "$PWD")
 echo "TEST_VAR_DIR=$TEST_VAR_DIR"
 
-if $socket_wrapper ; then
-    export SOCKET_WRAPPER_DIR="${TEST_VAR_DIR}/sw"
-    mkdir -p "$SOCKET_WRAPPER_DIR"
-fi
-
 export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
 
+unit_tests="
+	cunit
+	eventd
+	eventscripts
+	onnode
+	shellcheck
+	takeover
+	takeover_helper
+	tool
+"
+
 # If no tests specified then run some defaults
 if [ -z "$1" ] ; then
-    if [ -n "$TEST_LOCAL_DAEMONS" ] ; then
-	set -- onnode takeover takeover_helper tool eventscripts \
-	    cunit eventd shellcheck simple
-    else
-	set -- simple complex
+	if [ -n "$TEST_LOCAL_DAEMONS" ] ; then
+		set -- UNIT simple
+	else
+		set -- simple complex
     fi
 fi
 
@@ -287,7 +297,19 @@ cleanup_handler ()
 
 trap cleanup_handler SIGINT SIGTERM
 
+declare -a tests
+i=0
 for f ; do
+	if [ "$f" = "UNIT" ] ; then
+		for t in $unit_tests ; do
+			tests[i++]="$t"
+		done
+	else
+		tests[i++]="$f"
+	fi
+done
+
+for f in "${tests[@]}" ; do
     find_and_run_one_test "$f"
 
     if [ $status -eq 127 ] ; then
diff --git a/ctdb/tests/simple/14_ctdb_statistics.sh b/ctdb/tests/simple/14_ctdb_statistics.sh
index 3dd55e0..5ff22d7 100755
--- a/ctdb/tests/simple/14_ctdb_statistics.sh
+++ b/ctdb/tests/simple/14_ctdb_statistics.sh
@@ -1,4 +1,3 @@
-
 #!/bin/bash
 
 test_info()
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash
index a0c8077..512d11f 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -17,6 +17,12 @@ fi
 
 export CTDB_NODES="${TEST_VAR_DIR}/nodes.txt"
 
+if [ -n "$TEST_SOCKET_WRAPPER_SO_PATH" ] ; then
+	export LD_PRELOAD="$TEST_SOCKET_WRAPPER_SO_PATH"
+	export SOCKET_WRAPPER_DIR="${TEST_VAR_DIR}/sw"
+	mkdir -p "$SOCKET_WRAPPER_DIR"
+fi
+
 #######################################
 
 config_from_environment ()
diff --git a/ctdb/tests/src/sock_daemon_test.c b/ctdb/tests/src/sock_daemon_test.c
index 5641d37..ebc0b85 100644
--- a/ctdb/tests/src/sock_daemon_test.c
+++ b/ctdb/tests/src/sock_daemon_test.c
@@ -668,7 +668,8 @@ static void test4(TALLOC_CTX *mem_ctx, const char *pidfile,
  * Start daemon, multiple client connects, requests, disconnects
  */
 
-#define TEST5_MAX_CLIENTS	10
+#define TEST5_VALID_CLIENTS	10
+#define TEST5_MAX_CLIENTS	100
 
 struct test5_pkt {
 	uint32_t len;
@@ -710,7 +711,8 @@ static void test5_client_callback(uint8_t *buf, size_t buflen,
 	state->done = true;
 }
 
-static int test5_client(const char *sockpath, int id)
+static int test5_client(const char *sockpath, int id, pid_t pid_server,
+			pid_t *client_pid)
 {
 	pid_t pid;
 	int fd[2];
@@ -760,7 +762,9 @@ static int test5_client(const char *sockpath, int id)
 		close(fd[0]);
 		state.fd = -1;
 
-		sleep(10);
+		while (kill(pid_server, 0) == 0 || errno != ESRCH) {
+			sleep(1);
+		}
 		exit(0);
 	}
 
@@ -775,6 +779,7 @@ static int test5_client(const char *sockpath, int id)
 
 	close(fd[0]);
 
+	*client_pid = pid;
 	return ret;
 }
 
@@ -788,12 +793,12 @@ static bool test5_connect(struct sock_client_context *client,
 	struct test5_server_state *state =
 		(struct test5_server_state *)private_data;
 
-	if (state->num_clients == TEST5_MAX_CLIENTS) {
+	if (state->num_clients == TEST5_VALID_CLIENTS) {
 		return false;
 	}
 
 	state->num_clients += 1;
-	assert(state->num_clients <= TEST5_MAX_CLIENTS);
+	assert(state->num_clients <= TEST5_VALID_CLIENTS);
 	return true;
 }
 
@@ -925,6 +930,7 @@ static void test5(TALLOC_CTX *mem_ctx, const char *pidfile,
 	pid_t pid_server, pid;
 	int fd[2], ret, i;
 	ssize_t n;
+	pid_t client_pid[TEST5_MAX_CLIENTS];
 
 	pid = getpid();
 
@@ -968,16 +974,18 @@ static void test5(TALLOC_CTX *mem_ctx, const char *pidfile,
 
 	close(fd[0]);
 
-	for (i=0; i<100; i++) {
-		ret = test5_client(sockpath, i);
-		if (i < TEST5_MAX_CLIENTS) {
+	for (i=0; i<TEST5_MAX_CLIENTS; i++) {
+		ret = test5_client(sockpath, i, pid_server, &client_pid[i]);
+		if (i < TEST5_VALID_CLIENTS) {
 			assert(ret == i+1);
 		} else {
 			assert(ret == 0);
 		}
 	}
 
-	for (i=0; i<100; i++) {
+	for (i=TEST5_MAX_CLIENTS-1; i>=0; i--) {
+		kill(client_pid[i], SIGKILL);
+
 		pid = wait(&ret);
 		assert(pid != -1);
 	}
diff --git a/ctdb/wscript b/ctdb/wscript
index 715ecb1..059ce3d 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -986,8 +986,7 @@ def test(ctx):
 
 def autotest(ctx):
     env = samba_utils.LOAD_ENVIRONMENT()
-    ld = 'LD_PRELOAD=%s' % env.SOCKET_WRAPPER_SO_PATH
-    cmd = '%s tests/run_tests.sh -e -S -C' % ld
+    cmd = 'tests/run_tests.sh -e -S %s -C' % env.SOCKET_WRAPPER_SO_PATH
     ret = samba_utils.RUN_COMMAND(cmd)
     if ret != 0:
         print('autotest exited with exit status %d' % ret)
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index f4ae0f3..f2dcdd1 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2455,6 +2455,8 @@ sub wait_for_start($$$$$)
 	}
 	if ($create_builtin_users eq "yes") {
 	    $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
+	    $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
+	    $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
 	    $cmd .= Samba::bindir_path($self, "net") . " $envvars->{CONFIGURATION} ";
 	    $cmd .= "sam createbuiltingroup Users";
 	    $ret = system($cmd);
@@ -2469,6 +2471,8 @@ sub wait_for_start($$$$$)
 	    system($cmd);
 
 	    $cmd = "SELFTEST_WINBINDD_SOCKET_DIR='$envvars->{SELFTEST_WINBINDD_SOCKET_DIR}' ";
+	    $cmd .= "NSS_WRAPPER_PASSWD='$envvars->{NSS_WRAPPER_PASSWD}' ";
+	    $cmd .= "NSS_WRAPPER_GROUP='$envvars->{NSS_WRAPPER_GROUP}' ";
 	    $cmd .= Samba::bindir_path($self, "wbinfo") . " --sid-to-gid=S-1-5-32-545";
 	    $ret = system($cmd);
 	    if ($ret != 0) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list