[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Tue May 3 10:14:01 UTC 2022


The branch, master has been updated
       via  64275fc1a22 ctdb-tests: Add backtrace on abort to some tests
       via  d39377d6fc9 ctdb-tests: Provide a method to dump the stack on abort
       via  73b27def7b7 build: Add missing ctdb-client dependencies
       via  d57d624a77e ctdb-build: Drop unnecessary uses of include/ sub-directory
       via  6d3c9e64d91 ctdb-tests: Use test_case() to help document test cases
       via  d52b497d11a ctdb-locking: Don't pass NULL to tevent_req_is_unix_error()
       via  490e5f4d4ce ctdb-mutex: Don't pass NULL to tevent_req_is_unix_error()
      from  45b648486b9 s3:tests: Reformat test_deadtime.sh

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 64275fc1a2276adf73ab35d5df6e1a4b77058908
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 28 15:44:59 2022 +1100

    ctdb-tests: Add backtrace on abort to some tests
    
    These are easier to debug with a backtrace.
    
    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): Tue May  3 10:13:23 UTC 2022 on sn-devel-184

commit d39377d6fc91763b094f2cc888475287de7fbd3b
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 5 13:45:33 2022 +1100

    ctdb-tests: Provide a method to dump the stack on abort
    
    Some tests make generous use of assert() and it can be difficult to
    guess the cause of failures without resorting to GDB.  This provides
    some help.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 73b27def7b729de7fc4e48025b1491a609e73332
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon May 2 14:25:42 2022 +1000

    build: Add missing ctdb-client dependencies
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit d57d624a77e437769a5252584ed79da38e272fed
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 7 09:37:14 2022 +1100

    ctdb-build: Drop unnecessary uses of include/ sub-directory
    
    None of these include any files from the include/ sub-directory.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 6d3c9e64d91a67e717cd0cea1ca59faffed2c5ef
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Feb 28 15:44:04 2022 +1100

    ctdb-tests: Use test_case() to help document test cases
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit d52b497d11a2d5d82fabc8d20d656682af2f3c9d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jan 21 12:14:05 2022 +1100

    ctdb-locking: Don't pass NULL to tevent_req_is_unix_error()
    
    If there is an error then this pointer is unconditionally
    dereferenced.
    
    However, the only possible error appears to be ENOMEM, where a crash
    caused by dereferencing a NULL pointer isn't a terrible outcome.  In
    the absence of a security issue this is probably not worth
    backporting.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 490e5f4d4ce2facd4c396a2e213f53de923629c2
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jan 21 12:09:45 2022 +1100

    ctdb-mutex: Don't pass NULL to tevent_req_is_unix_error()
    
    If there is an error then this pointer is unconditionally
    dereferenced.
    
    However, the only possible error appears to be ENOMEM, where a crash
    caused by dereferencing a NULL pointer isn't a terrible outcome.  In
    the absence of a security issue this is probably not worth
    backporting.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/server/ctdb_lock_helper.c                     | 11 +++---
 ctdb/server/ctdb_mutex_fcntl_helper.c              | 31 +++++++++-------
 ctdb/tests/UNIT/cunit/cluster_mutex_001.sh         |  7 ++++
 ctdb/tests/UNIT/cunit/cluster_mutex_002.sh         | 11 ++++++
 ctdb/tests/UNIT/cunit/cluster_mutex_003.sh         |  7 ++++
 ctdb/tests/UNIT/cunit/system_socket_test_002.sh    |  6 ++++
 ctdb/tests/UNIT/cunit/system_socket_test_003.sh    |  3 ++
 ctdb/tests/src/cluster_mutex_test.c                |  4 +++
 ctdb/tests/src/system_socket_test.c                |  4 +++
 .../{ipalloc_read_known_ips.h => test_backtrace.c} | 27 ++++++++------
 .../mkdir_p.h => ctdb/tests/src/test_backtrace.h   | 12 ++++---
 ctdb/wscript                                       | 41 ++++++++++++++++------
 12 files changed, 121 insertions(+), 43 deletions(-)
 copy ctdb/tests/src/{ipalloc_read_known_ips.h => test_backtrace.c} (60%)
 copy lib/util/mkdir_p.h => ctdb/tests/src/test_backtrace.h (72%)


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_lock_helper.c b/ctdb/server/ctdb_lock_helper.c
index 6b6fbbe27a5..51d2992b64e 100644
--- a/ctdb/server/ctdb_lock_helper.c
+++ b/ctdb/server/ctdb_lock_helper.c
@@ -230,9 +230,9 @@ static void wait_for_parent_check(struct tevent_req *subreq)
 	tevent_req_set_callback(subreq, wait_for_parent_check, req);
 }
 
-static bool wait_for_parent_recv(struct tevent_req *req)
+static bool wait_for_parent_recv(struct tevent_req *req, int *perr)
 {
-	if (tevent_req_is_unix_error(req, NULL)) {
+	if (tevent_req_is_unix_error(req, perr)) {
 		return false;
 	}
 
@@ -273,6 +273,7 @@ int main(int argc, char *argv[])
 	int ppid;
 	const char *lock_type;
 	bool status;
+	int err;
 
 	reset_scheduler();
 
@@ -336,9 +337,11 @@ int main(int argc, char *argv[])
 
 	tevent_req_poll(req, ev);
 
-	status = wait_for_parent_recv(req);
+	status = wait_for_parent_recv(req, &err);
 	if (! status) {
-		fprintf(stderr, "locking: wait_for_parent_recv() failed\n");
+		fprintf(stderr,
+			"locking: wait_for_parent_recv() failed (%d)\n",
+			err);
 	}
 
 	talloc_free(ev);
diff --git a/ctdb/server/ctdb_mutex_fcntl_helper.c b/ctdb/server/ctdb_mutex_fcntl_helper.c
index 87f5dc22c41..97a4a1d4a71 100644
--- a/ctdb/server/ctdb_mutex_fcntl_helper.c
+++ b/ctdb/server/ctdb_mutex_fcntl_helper.c
@@ -150,9 +150,9 @@ static void wait_for_parent_check(struct tevent_req *subreq)
 	tevent_req_set_callback(subreq, wait_for_parent_check, req);
 }
 
-static bool wait_for_parent_recv(struct tevent_req *req)
+static bool wait_for_parent_recv(struct tevent_req *req, int *perr)
 {
-	if (tevent_req_is_unix_error(req, NULL)) {
+	if (tevent_req_is_unix_error(req, perr)) {
 		return false;
 	}
 
@@ -265,9 +265,9 @@ static void wait_for_lost_check(struct tevent_req *subreq)
 	tevent_req_set_callback(subreq, wait_for_lost_check, req);
 }
 
-static bool wait_for_lost_recv(struct tevent_req *req)
+static bool wait_for_lost_recv(struct tevent_req *req, int *perr)
 {
-	if (tevent_req_is_unix_error(req, NULL)) {
+	if (tevent_req_is_unix_error(req, perr)) {
 		return false;
 	}
 
@@ -325,14 +325,16 @@ static void wait_for_exit_parent_done(struct tevent_req *subreq)
 	struct tevent_req *req = tevent_req_callback_data(
 		subreq, struct tevent_req);
 	bool status;
+	int err;
 
-	status = wait_for_parent_recv(subreq);
+	status = wait_for_parent_recv(subreq, &err);
 	TALLOC_FREE(subreq);
 	if (! status) {
 		/* Ignore error */
 		fprintf(stderr,
 			"ctdb_mutex_fcntl_helper: "
-			"wait_for_parent_recv() failed\n");
+			"wait_for_parent_recv() failed (%d)\n",
+			err);
 	}
 
 	tevent_req_done(req);
@@ -343,22 +345,24 @@ static void wait_for_exit_lost_done(struct tevent_req *subreq)
 	struct tevent_req *req = tevent_req_callback_data(
 		subreq, struct tevent_req);
 	bool status;
+	int err;
 
-	status = wait_for_lost_recv(subreq);
+	status = wait_for_lost_recv(subreq, &err);
 	TALLOC_FREE(subreq);
 	if (! status) {
 		/* Ignore error */
 		fprintf(stderr,
 			"ctdb_mutex_fcntl_helper: "
-			"wait_for_lost_recv() failed\n");
+			"wait_for_lost_recv() failed (%d)\n",
+			err);
 	}
 
 	tevent_req_done(req);
 }
 
-static bool wait_for_exit_recv(struct tevent_req *req)
+static bool wait_for_exit_recv(struct tevent_req *req, int *perr)
 {
-	if (tevent_req_is_unix_error(req, NULL)) {
+	if (tevent_req_is_unix_error(req, perr)) {
 		return false;
 	}
 
@@ -429,11 +433,12 @@ int main(int argc, char *argv[])
 
 	tevent_req_poll(req, ev);
 
-	status = wait_for_exit_recv(req);
+	status = wait_for_exit_recv(req, &ret);
 	if (! status) {
 		fprintf(stderr,
-			"%s: wait_for_exit_recv() failed\n",
-			progname);
+			"%s: wait_for_exit_recv() failed (%d)\n",
+			progname,
+			ret);
 	}
 
 	if (fd != -1) {
diff --git a/ctdb/tests/UNIT/cunit/cluster_mutex_001.sh b/ctdb/tests/UNIT/cunit/cluster_mutex_001.sh
index eaa7b2d5b1c..79761436d92 100755
--- a/ctdb/tests/UNIT/cunit/cluster_mutex_001.sh
+++ b/ctdb/tests/UNIT/cunit/cluster_mutex_001.sh
@@ -10,12 +10,14 @@ export CTDB_CLUSTER_MUTEX_HELPER="$t"
 lockfile="${CTDB_TEST_TMP_DIR}/cluster_mutex.lockfile"
 trap 'rm -f ${lockfile}' 0
 
+test_case "No contention: lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock "$lockfile"
 
+test_case "Contention: lock, lock, unlock"
 ok <<EOF
 LOCK
 CONTENTION
@@ -24,6 +26,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-lock-unlock "$lockfile"
 
+test_case "No contention: lock, unlock, lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
@@ -32,24 +35,28 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock-lock-unlock "$lockfile"
 
+test_case "Cancelled: unlock while lock still in progress"
 ok <<EOF
 CANCEL
 NOLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-check "$lockfile"
 
+test_case "Cancelled: unlock while lock still in progress, unlock again"
 ok <<EOF
 CANCEL
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-unlock "$lockfile"
 
+test_case "PPID doesn't go away: lock, wait, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-wait-unlock "$lockfile"
 
+test_case "PPID goes away: lock, wait, lock, unlock"
 ok <<EOF
 LOCK
 parent gone
diff --git a/ctdb/tests/UNIT/cunit/cluster_mutex_002.sh b/ctdb/tests/UNIT/cunit/cluster_mutex_002.sh
index c36a9f583a9..65d57c3f2b1 100755
--- a/ctdb/tests/UNIT/cunit/cluster_mutex_002.sh
+++ b/ctdb/tests/UNIT/cunit/cluster_mutex_002.sh
@@ -12,12 +12,14 @@ trap 'rm ${lockfile}' 0
 t="${CTDB_SCRIPTS_HELPER_BINDIR}/ctdb_mutex_fcntl_helper"
 helper="!${t} ${lockfile}"
 
+test_case "No contention: lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock "$helper"
 
+test_case "Contention: lock, lock, unlock"
 ok <<EOF
 LOCK
 CONTENTION
@@ -26,6 +28,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-lock-unlock "$helper"
 
+test_case "No contention: lock, unlock, lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
@@ -34,24 +37,28 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock-lock-unlock "$helper"
 
+test_case "Cancelled: unlock while lock still in progress"
 ok <<EOF
 CANCEL
 NOLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-check "$helper"
 
+test_case "Cancelled: unlock while lock still in progress, unlock again"
 ok <<EOF
 CANCEL
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-unlock "$helper"
 
+test_case "PPID doesn't go away: lock, wait, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-wait-unlock "$helper"
 
+test_case "PPID goes away: lock, wait, lock, unlock"
 ok <<EOF
 LOCK
 parent gone
@@ -60,6 +67,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-ppid-gone-lock-unlock "$helper"
 
+test_case "Recheck off, lock file removed"
 ok <<EOF
 LOCK
 LOCK
@@ -69,6 +77,7 @@ EOF
 unit_test cluster_mutex_test lock-file-removed-no-recheck \
 	  "$helper 0" "$lockfile"
 
+test_case "Recheck on, lock file not removed"
 ok <<EOF
 LOCK
 UNLOCK
@@ -76,6 +85,7 @@ EOF
 unit_test cluster_mutex_test lock-file-wait-recheck-unlock \
 	  "$helper 5" 10
 
+test_case "Recheck on, lock file removed"
 ok <<EOF
 LOCK
 ctdb_mutex_fcntl_helper: lock lost - lock file "${lockfile}" check failed (ret=2)
@@ -83,6 +93,7 @@ LOST
 EOF
 unit_test cluster_mutex_test lock-file-removed "$helper 5" "$lockfile"
 
+test_case "Recheck on, lock file replaced"
 ok <<EOF
 LOCK
 ctdb_mutex_fcntl_helper: lock lost - lock file "${lockfile}" inode changed
diff --git a/ctdb/tests/UNIT/cunit/cluster_mutex_003.sh b/ctdb/tests/UNIT/cunit/cluster_mutex_003.sh
index e4f95c1f509..57319bd2ef2 100755
--- a/ctdb/tests/UNIT/cunit/cluster_mutex_003.sh
+++ b/ctdb/tests/UNIT/cunit/cluster_mutex_003.sh
@@ -19,12 +19,14 @@ else
 	helper="!${t} ${lockfile}"
 fi
 
+test_case "No contention: lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock "$helper"
 
+test_case "Contention: lock, lock, unlock"
 ok <<EOF
 LOCK
 CONTENTION
@@ -33,6 +35,7 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-lock-unlock "$helper"
 
+test_case "No contention: lock, unlock, lock, unlock"
 ok <<EOF
 LOCK
 UNLOCK
@@ -41,24 +44,28 @@ UNLOCK
 EOF
 unit_test cluster_mutex_test lock-unlock-lock-unlock "$helper"
 
+test_case "Cancelled: unlock while lock still in progress"
 ok <<EOF
 CANCEL
 NOLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-check "$helper"
 
+test_case "Cancelled: unlock while lock still in progress, unlock again"
 ok <<EOF
 CANCEL
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-cancel-unlock "$helper"
 
+test_case "PPID doesn't go away: lock, wait, unlock"
 ok <<EOF
 LOCK
 UNLOCK
 EOF
 unit_test cluster_mutex_test lock-wait-unlock "$helper"
 
+test_case "PPID goes away: lock, wait, lock, unlock"
 ok <<EOF
 LOCK
 parent gone
diff --git a/ctdb/tests/UNIT/cunit/system_socket_test_002.sh b/ctdb/tests/UNIT/cunit/system_socket_test_002.sh
index 417ad8f4792..c20bcfe7547 100755
--- a/ctdb/tests/UNIT/cunit/system_socket_test_002.sh
+++ b/ctdb/tests/UNIT/cunit/system_socket_test_002.sh
@@ -7,6 +7,7 @@ tcp_test ()
 	unit_test system_socket_test tcp "$@"
 }
 
+test_case "ACK, IPv4, seq# 0, ack# 0"
 ok <<EOF
 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
 000010 c0 a8 02 4b 01 bd d4 31 00 00 00 00 00 00 00 00
@@ -15,6 +16,7 @@ ok <<EOF
 EOF
 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 0 0 0
 
+test_case "RST, IPv4, seq# 0, ack# 0"
 ok <<EOF
 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
 000010 c0 a8 02 4b 01 bd d4 31 00 00 00 00 00 00 00 00
@@ -23,6 +25,7 @@ ok <<EOF
 EOF
 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 0 0 1
 
+test_case "RST, IPv4, seq# 12345, ack# 23456"
 ok <<EOF
 000000 45 00 00 08 00 00 00 00 ff 06 00 00 c0 a8 01 19
 000010 c0 a8 02 4b 01 bd d4 31 39 30 00 00 a0 5b 00 00
@@ -31,6 +34,7 @@ ok <<EOF
 EOF
 tcp_test "192.168.1.25:445" "192.168.2.75:54321" 12345 23456 1
 
+test_case "ACK, IPv6, seq# 0, ack# 0"
 ok <<EOF
 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
@@ -41,6 +45,7 @@ EOF
 tcp_test "[fe80::6af7:28ff:fefa:d136]:445" \
 	 "[fe80::6af7:28ff:fefb:d137]:54321" 0 0 0
 
+test_case "RST, IPv6, seq# 0, ack# 0"
 ok <<EOF
 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
@@ -51,6 +56,7 @@ EOF
 tcp_test "[fe80::6af7:28ff:fefa:d136]:445" \
 	 "[fe80::6af7:28ff:fefb:d137]:54321" 0 0 1
 
+test_case "RST, IPv6, seq# 12345, ack# 23456"
 ok <<EOF
 000000 60 00 00 00 00 14 06 40 fe 80 00 00 00 00 00 00
 000010 6a f7 28 ff fe fa d1 36 fe 80 00 00 00 00 00 00
diff --git a/ctdb/tests/UNIT/cunit/system_socket_test_003.sh b/ctdb/tests/UNIT/cunit/system_socket_test_003.sh
index 0b265eabdfa..c94ac30632f 100755
--- a/ctdb/tests/UNIT/cunit/system_socket_test_003.sh
+++ b/ctdb/tests/UNIT/cunit/system_socket_test_003.sh
@@ -9,6 +9,7 @@ arp_test ()
 	unit_test system_socket_test arp "$@"
 }
 
+test_case "IPv4 ARP send"
 ok <<EOF
 000000 ff ff ff ff ff ff 12 34 56 78 9a bc 08 06 00 01
 000010 08 00 06 04 00 01 12 34 56 78 9a bc c0 a8 01 19
@@ -18,6 +19,7 @@ ok <<EOF
 EOF
 arp_test "192.168.1.25" "12:34:56:78:9a:bc"
 
+test_case "IPv4 ARP reply"
 ok <<EOF
 000000 ff ff ff ff ff ff 12 34 56 78 9a bc 08 06 00 01
 000010 08 00 06 04 00 02 12 34 56 78 9a bc c0 a8 01 19
@@ -27,6 +29,7 @@ ok <<EOF
 EOF
 arp_test "192.168.1.25" "12:34:56:78:9a:bc" reply
 
+test_case "IPv6 neighbor advertisement"
 ok <<EOF
 000000 33 33 00 00 00 01 12 34 56 78 9a bc 86 dd 60 00
 000010 00 00 00 20 3a ff fe 80 00 00 00 00 00 00 6a f7
diff --git a/ctdb/tests/src/cluster_mutex_test.c b/ctdb/tests/src/cluster_mutex_test.c
index 3c045f3e807..1252b688d94 100644
--- a/ctdb/tests/src/cluster_mutex_test.c
+++ b/ctdb/tests/src/cluster_mutex_test.c
@@ -29,6 +29,8 @@
 #include "lib/util/util.h"
 #include "lib/util/smb_strtox.h"
 
+#include "tests/src/test_backtrace.h"
+
 /*
  * ctdb_cluster_mutex.c is included below.  This requires a few hacks...
  */
@@ -663,6 +665,8 @@ int main(int argc, const char *argv[])
 	assert(ret == 0);
 	alarm(60);
 
+	test_backtrace_setup();
+
 	test = argv[1];
 	mutex_string = argv[2];
 
diff --git a/ctdb/tests/src/system_socket_test.c b/ctdb/tests/src/system_socket_test.c
index a6fe8547651..436f52a2df8 100644
--- a/ctdb/tests/src/system_socket_test.c
+++ b/ctdb/tests/src/system_socket_test.c
@@ -36,6 +36,8 @@
 
 #include "protocol/protocol_util.h"
 
+#include "tests/src/test_backtrace.h"
+
 static void hexdump(uint8_t *buf, size_t len)
 {
 	size_t i;
@@ -238,6 +240,8 @@ int main(int argc, char **argv)
 		usage(argv[0]);
 	}
 
+	test_backtrace_setup();
+
 	if (strcmp(argv[1], "types") == 0) {
 		test_types();
 	} else if (strcmp(argv[1], "arp") == 0) {
diff --git a/ctdb/tests/src/ipalloc_read_known_ips.h b/ctdb/tests/src/test_backtrace.c
similarity index 60%
copy from ctdb/tests/src/ipalloc_read_known_ips.h
copy to ctdb/tests/src/test_backtrace.c
index aa6d1541b9a..aa3fc0c0216 100644
--- a/ctdb/tests/src/ipalloc_read_known_ips.h
+++ b/ctdb/tests/src/test_backtrace.c
@@ -1,7 +1,7 @@
 /*
-   Tests support for CTDB IP allocation
+   Print a backtrace when a test aborts
 
-   Copyright (C) Martin Schwenke 2011
+   Copyright (C) Martin Schwenke, DataDirect Networks  2022
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,16 +17,21 @@
    along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef __IPALLOC_READ_KNOWN_IPS_H__
-#define __IPALLOC_READ_KNOWN_IPS_H__
+#include "replace.h"
 
-#include <stdbool.h>
-#include <talloc.h>
+#include "lib/util/fault.h"
+#include "lib/util/signal.h"
 
-#include "protocol/protocol.h"
+#include "tests/src/test_backtrace.h"
 
-struct ctdb_public_ip_list * ipalloc_read_known_ips(TALLOC_CTX *ctx,
-						    int numnodes,
-						    bool multi);
+static void test_abort_backtrace_handler(int sig)
+{
+	log_stack_trace();
+	CatchSignal(SIGABRT, SIG_DFL);
+	abort();
+}
 
-#endif /* __IPALLOC_READ_KNOWN_IPS_H__ */
+void test_backtrace_setup(void)
+{


-- 
Samba Shared Repository



More information about the samba-cvs mailing list