1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

346 Commits

Author SHA1 Message Date
Martin Schwenke
d1543d5c78 ctdb-build: Add --enable-pcap configure option
This forces the use pcap for packet capture on Linux.

It appears that using a raw socket for capture does not work with
infiniband - pcap support for that to come.

Don't (yet?) change the default capture method to pcap.  On some
platforms (e.g. my personal Intel NUC, running Debian testing), pcap
is much less reliable than the raw socket.  However, pcap seems fine
on most other platforms.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-09-20 10:43:37 +00:00
Martin Schwenke
a83e9ca696 ctdb-build: Use pcap-config when available
The build currently fails on AIX, which can't find the pcap headers
because they're installed in a non-standard place.  However, there is
a pcap-config script available.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-09-20 10:43:37 +00:00
Martin Schwenke
b5db286791 ctdb-mutex: Do inode checks in a child process
In future this will allow extra I/O tests and a timeout in the parent
to (hopefully) release the lock if the child gets wedged.  For
simplicity, use tmon only to detect when either parent or child goes
away.  Plumbing a timeout for pings from child to parent will be done
later.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28 10:09:34 +00:00
Martin Schwenke
a8da8810f1 ctdb-tests: Add tests for trivial FD monitoring
tmon_ping_test covers complex 2-way interaction between processes
using tmon_ping_send(), including via a socketpair().  tmon_test
covers the more general functionality of tmon_send() but uses a
simpler 1-way harness with wide coverage.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28 10:09:34 +00:00
Martin Schwenke
8d04235f46 ctdb-common: Add trivial FD monitoring abstraction
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28 10:09:34 +00:00
Martin Schwenke
f9467cdf3b ctdb-build: Link in backtrace support for ctdb_util_tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28 10:09:34 +00:00
Martin Schwenke
7a1c43fc74 ctdb-build: Separate test backtrace support into separate subsystem
A convention when testing members of ctdb-util is to include the .c
file so that static functions can potentially be tested.  This means
that such tests can't be linked against ctdb-util or duplicate symbols
will be encountered.

ctdb-tests-common depends on ctdb-client, which depends in turn on
ctdb-util, so this can't be used to pull in backtrace support.
Instead, make ctdb-tests-backtrace its own subsystem.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28 10:09:34 +00:00
Martin Schwenke
b195e8c0d0 ctdb-build: Sort sources in ctdb-util and ctdb_unit_tests
Also, rename ctdb_unit_tests to ctdb_util_tests.  The sorting makes
it clear that only items from ctdb-util are tested here.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28 10:09:34 +00:00
Martin Schwenke
30c40046ef ctdb-build: Add missing dependency on talloc
The include isn't strictly necessary, since it is included via
common/reqid.c anyway.  However, it is a useful hint.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Fri Jul 22 17:01:00 UTC 2022 on sn-devel-184
2022-07-22 17:01:00 +00:00
Martin Schwenke
64275fc1a2 ctdb-tests: Add backtrace on abort to some tests
These are easier to debug with a backtrace.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue May  3 10:13:23 UTC 2022 on sn-devel-184
2022-05-03 10:13:23 +00:00
Martin Schwenke
d39377d6fc 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@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-05-03 09:19:31 +00:00
Martin Schwenke
73b27def7b build: Add missing ctdb-client dependencies
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-05-03 09:19:31 +00:00
Martin Schwenke
d57d624a77 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@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-05-03 09:19:31 +00:00
Martin Schwenke
8deec3bc67 ctdb-scripts: Drop unused ctdbd_wrapper
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-04-06 06:34:37 +00:00
Martin Schwenke
b14f2a205d ctdb-tests: Add unit tests for tunables code
This aims to test ctdb_tunable_load_file() but also exercises
ctdb_tunable_names() and ctdb_tunable_get_value().
ctdb_tunable_set_value() is indirectly exercised via
ctdb_tunable_load_file().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-04-06 06:34:37 +00:00
Martin Schwenke
ef9017a150 ctdb-tests: Dump a stack trace on abort
Debugging a test failure here without GDB is not possible.  Dumping a
stack trace gives a good hint.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-02-23 01:08:37 +00:00
Amitay Isaacs
cb55b68b3e ctdb-utils: Add tdb_mutex_check utility
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2021-05-28 06:46:29 +00:00
David Mulder
6f5b0fef59 ctdb: Prevent man page duplication
The new waf detects a duplicate instance of
ctdb_mutex_ceph_rados_helper.7.xml, which is due
to manpages_extra being a pointer to
manpages_misc, therefore each call to build()
added duplicate entries to the manpages_misc
global entry.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-09-11 03:43:40 +00:00
Martin Schwenke
066c205e5f ctdb-build: Don't build/install tests in top-level build by default
The standalone build still includes tests, as does the top-level build
when --enable-selftest is used.  The latter is consistent with the use
of --enable-selftest in the rest of the tree.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-07-22 07:53:35 +00:00
Martin Schwenke
6436c74ebf Revert "ctdb-build: Don't build/install tests in top-level build by default"
Fix missing Reviewed-by: tag.

This reverts commit 91c36c16c8.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Wed Jul 22 06:29:43 UTC 2020 on sn-devel-184
2020-07-22 06:29:43 +00:00
Martin Schwenke
91c36c16c8 ctdb-build: Don't build/install tests in top-level build by default
The standalone build still includes tests, as does the top-level build
when --enable-selftest is used.  The latter is consistent with the use
of --enable-selftest in the rest of the tree.

Signed-off-by: Martin Schwenke <martin@meltin.net>
2020-07-22 02:42:37 +00:00
Martin Schwenke
c28914bfa7 ctdb-build: Fix a typo
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-05-22 06:41:44 +00:00
Amitay Isaacs
23c2195e2c ctdb-build: Add messages_dgm build to ctdb
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed May  6 01:47:16 UTC 2020 on sn-devel-184
2020-05-06 01:47:16 +00:00
Amitay Isaacs
a59fd8164c lib/util: Build genrand for util core
messages_dgm depends on genrand.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-05-06 00:06:40 +00:00
Andrew Bartlett
92ce387ed0 build: Remove workaround for missing os.path.relpath in Python < 2.6
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-11-13 08:42:30 +00:00
Martin Schwenke
5a6d319eea ctdb-tests: Add ctdb-db-test tool
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-24 04:06:44 +00:00
Martin Schwenke
e8dc125ed2 ctdb-tests: Drop setting of test state directory for testonly target
This is the default and deciding this should be left to run_tests.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-22 19:39:41 +00:00
Martin Schwenke
fc16b8dbc6 ctdb-tests: Enable printing of logs on failure in autobuild
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-22 19:39:41 +00:00
Martin Schwenke
653b35764a ctdb-tests: Add cluster.bash include file
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
8a5c4a60e1 ctdb-tests: Move simple tests to INTEGRATION/ subdirectory
Split some tests out into database/ and failover/ subdirectories.
Rename the remaining tests in simple/.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
658068184f ctdb-tests: Move complex tests to CLUSTER/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
df6800e330 ctdb-tests: Convert local daemons include file into top-level include
Do the same with the alternative code for real clusters.

Both of these can now be used by other test suites.

Fix some basic shellcheck warnings (e.g. avoid word-splitting by
quoting) while moving code and add the new files to the shellcheck
test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
1061bdf29d ctdb-tests: Move tool tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
9585ece00c ctdb-tests: Move takeover_helper tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
cf0b87f9b7 ctdb-tests: Move takeover tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
010c1a85fa ctdb-tests: Move shellcheck tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
a3cbb7eb21 ctdb-tests: Move onnode tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
8ed075d396 ctdb-tests: Move eventscript tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
330a106aaa ctdb-tests: Move eventd tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
43ed3a6eb3 ctdb-tests: Move cunit tests to UNIT/ subdirectory
The UNIT subdirectory directory will contain all unit tests.  Use an
uppercase name to avoid conflicts with source code subdirectories.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
522a8480fa ctdb-tests: Drop reference to unused ctdb_eventd test directory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:25 +00:00
Björn Baumbach
16c3a00d2e build: remove unneeded libceph-common dependency
librados and libcephfs are both dependent on ceph-common, but
ctdb_mutex_ceph_rados_helper and vfs_ceph needn't be explicitly linked
against it.

Signed-off-by: Björn Baumbach <bb@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Sep  2 03:44:24 UTC 2019 on sn-devel-184
2019-09-02 03:44:24 +00:00
David Disseldorp
dfa4dcf386 build: drop --with-libcephfs=<path> support
--with-libcephfs=<path> provides a mechanism for explicitly specifying
header and library paths for Ceph. This adds unnecessary complexity and
can be achieved using generic compiler environment variables (e.g.
GCC LIBRARY_PATH and C_INCLUDE_PATH), so drop --with-libcephfs support.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-02 02:25:29 +00:00
Martin Schwenke
061656d383 ctdb-tests: Simplify test_wrap script
Given other improvements, this is now needlessly complex.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:35 +00:00
Martin Schwenke
45c9fe3abb ctdb-tests: Avoid shellcheck warning SC2155
SC2155 Declare and assign separately to avoid masking return values

The wscript changes require an identical change in local_daemons.sh.

While touching the lines in wscript, escape the backslashes to make
them literal backslashes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:35 +00:00
Ralph Boehme
f5388f9779 ctdb: fix compilation on systems with glibc robust mutexes
On older systems like SLES 11 without POSIX robust mutexes, but with glib robust
mutexes where all the functions are available but have a "_np" suffix,
compilation fails in:

ctdb/tests/src/test_mutex_raw.c.239.o: In function `worker':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:129: undefined reference to `pthread_mutex_consistent'
ctdb/tests/src/test_mutex_raw.c.239.o: In function `main':
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:285: undefined reference to `pthread_mutex_consistent'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:332: undefined reference to `pthread_mutexattr_setrobust'
/root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:363: undefined reference to `pthread_mutex_consistent'
collect2: ld returned 1 exit status

This could be fixed by using libreplace system/threads.h instead of pthreads.h
directly, but as there has been a desire to keep test_mutex_raw.c standalone and
compilable without other external depenencies then libc and libpthread, make the
tool developer build only. This should get the average user over the cliff.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14038
RN: Fix compiling ctdb on older systems lacking POSIX robust mutexes

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-08-06 14:23:36 +00:00
Martin Schwenke
fae8e438f0 ctdb-mutex: Change parent checking to use an asynchronous computation
Put the checking for the process being immediately re-parented into
the computation too.  This will be very rare and doing it
consistently makes testing saner.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-26 03:34:17 +00:00
Martin Schwenke
adcf313c49 ctdb-tests: Add cluster mutex tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-26 03:34:17 +00:00
Martin Schwenke
e0b33c5549 ctdb-build: Tweak hacking of rpcgen output
csbuild doesn't like the hack where variable buf is initialised to
itself to avoid an unused variable warning.  buf is unused so remove
it instead.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-07-05 05:03:25 +00:00
David Disseldorp
04c0e5212d ctdb/build: fix ctdb_mutex_ceph_rados_helper builds
2b5dbb3525 fixed builds with an explicit
--with-libcephfs but broke builds against system Ceph libraries. This
change handles both cases.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu May  9 04:24:56 UTC 2019 on sn-devel-184
2019-05-09 04:24:56 +00:00