[SCM] Samba Shared Repository - branch master updated
Amitay Isaacs
amitay at samba.org
Mon Sep 3 12:05:01 UTC 2018
The branch, master has been updated
via 30eb288 ctdb-tests: Don't run valgrind or other tracing in simple_test_command()
via 8aacde3 ctdb-tests: Use known install paths in local daemon tests
via eed738a ctdb-tests: If bin/ isn't in ctdb/ then look one level higher
via 4f1727f ctdb-common: Process the whole config file even if an error occurs
via 920ed66 ctdb-common: Avoid ENOENT for unknown conf options
via f108440 ctdb-common: Avoid ENOENT for unknown conf type tags
via a017d31 ctdb-common: Log a message when an invalid conf value is encountered
via ebb28c5 ctdb-common: Log a message for unknown conf option
via 421d828 ctdb-common: Fix log message for conf option with unknown section
via b5453bc ctdb-daemon: Drop incorrect log message
via 6d3d9a8 ctdb-daemon: Log complete eventd startup command
from 74357bf selftest: Split up password_lockout into tests with and without a call to sleep()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 30eb28818d5fbbb35d0965a92f721243aca6ab54
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Aug 20 14:55:17 2018 +1000
ctdb-tests: Don't run valgrind or other tracing in simple_test_command()
This function is used to run a extra command to check a result. This
command is usually a script (often a stub) or an external command, so
no need to trace it with valgrind or whatever else might be specified.
In the worst case the command being run is a shell function, which
valgrind won't be able to find.
There is little use running the event script tests under valgrind.
However, when the whole test suite is being run under valgrind then it
should work.
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): Mon Sep 3 14:04:00 CEST 2018 on sn-devel-144
commit 8aacde3c5d86d8a0216b3bba200a39ca9a561653
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Aug 30 09:37:53 2018 +1000
ctdb-tests: Use known install paths in local daemon tests
The in-tree local daemons tests don't work from a top-level Samba
compile. The simple test suite was the first test suite and things
have generally worked, so it has been slow to adopt general test
infrastructure changes.
Instead of re-calculating script and helper locations, use the paths
from script_install_paths.sh. The bin/ directory is already added to
PATH in common.sh, so don't add it here.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit eed738a37a6f40ca259153979f364c17e77f52ea
Author: Martin Schwenke <martin at meltin.net>
Date: Thu Aug 30 09:35:58 2018 +1000
ctdb-tests: If bin/ isn't in ctdb/ then look one level higher
CTDB's test suite doesn't work from a top-level compile. The first
step to fixing this is to correctly locate the bin/ directory.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 4f1727fe0bf2b0962a5d131d60a416b8f459ad94
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 31 09:35:14 2018 +1000
ctdb-common: Process the whole config file even if an error occurs
At the moment multiple errors will be encountered one at a time, on
each load or validate. Instead, allow all configuration errors to
printed in a single pass.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 920ed66ba7e874ca23d72fff9342fbd64a1e329f
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 31 08:42:04 2018 +1000
ctdb-common: Avoid ENOENT for unknown conf options
Only use ENOENT for missing configuration file.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit f1084400387c0b1257b6d92ee6e8a89504d788fc
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 31 08:45:25 2018 +1000
ctdb-common: Avoid ENOENT for unknown conf type tags
Only use ENOENT for missing configuration file.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit a017d3181ac1062b66ae506a8a523f7455630fce
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 31 09:34:12 2018 +1000
ctdb-common: Log a message when an invalid conf value is encountered
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit ebb28c57a17777ea15afab63cd0742dd79b30ffe
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 31 08:32:12 2018 +1000
ctdb-common: Log a message for unknown conf option
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 421d828f6cb7c13d5f33c6cc1c6be254554588a4
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 31 19:57:56 2018 +1000
ctdb-common: Fix log message for conf option with unknown section
This covers both options that appear before a section and options in
unknown sections.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit b5453bc27add11a7288772a59adcc605328b9098
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 31 09:06:51 2018 +1000
ctdb-daemon: Drop incorrect log message
The message is incorrect because the actual failure was loading the
config file. Instead of fixing the message, drop it because
ctdb_config_load() already logs the failure.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 6d3d9a85e5630ba398ac953ad1515155f10224d9
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Sep 3 16:12:16 2018 +1000
ctdb-daemon: Log complete eventd startup command
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13592
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
ctdb/common/conf.c | 47 ++++++++++++++++++----------
ctdb/server/ctdbd.c | 2 +-
ctdb/server/eventscript.c | 8 +++--
ctdb/tests/cunit/conf_test_001.sh | 4 ++-
ctdb/tests/cunit/config_test_001.sh | 5 +--
ctdb/tests/cunit/config_test_005.sh | 6 ++++
ctdb/tests/eventscripts/scripts/local.sh | 2 +-
ctdb/tests/scripts/common.sh | 12 ++++---
ctdb/tests/scripts/script_install_paths.sh | 2 +-
ctdb/tests/simple/scripts/local_daemons.bash | 23 ++++++--------
10 files changed, 69 insertions(+), 42 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/common/conf.c b/ctdb/common/conf.c
index 669ac23..3d668de 100644
--- a/ctdb/common/conf.c
+++ b/ctdb/common/conf.c
@@ -155,7 +155,7 @@ static int conf_value_from_string(TALLOC_CTX *mem_ctx,
break;
default:
- return ENOENT;
+ return EINVAL;
}
return ret;
@@ -232,7 +232,7 @@ static int conf_value_copy(TALLOC_CTX *mem_ctx,
break;
default:
- return ENOENT;
+ return EINVAL;
}
return 0;
@@ -1048,6 +1048,10 @@ static int conf_load_internal(struct conf_context *conf)
}
}
+ if (state.err != 0) {
+ goto fail;
+ }
+
conf_all_update(conf);
return 0;
@@ -1066,7 +1070,7 @@ static bool conf_load_section(const char *section, void *private_data)
ok = conf_section_validate(state->conf, state->s, state->mode);
if (!ok) {
state->err = EINVAL;
- return false;
+ return true;
}
}
@@ -1078,7 +1082,7 @@ static bool conf_load_section(const char *section, void *private_data)
} else {
D_ERR("conf: unknown section [%s]\n", section);
state->err = EINVAL;
- return false;
+ return true;
}
}
@@ -1099,23 +1103,30 @@ static bool conf_load_option(const char *name,
if (state->s == NULL) {
if (state->conf->ignore_unknown) {
- D_DEBUG("conf: ignoring unknown option \"%s\"\n",
+ D_DEBUG("conf: unknown section for option \"%s\"\n",
name);
return true;
} else {
- D_ERR("conf: unknown option \"%s\"\n", name);
+ D_ERR("conf: unknown section for option \"%s\"\n",
+ name);
state->err = EINVAL;
- return false;
+ return true;
}
}
opt = conf_option_find(state->s, name);
if (opt == NULL) {
if (state->conf->ignore_unknown) {
+ D_DEBUG("conf: unknown option [%s] -> \"%s\"\n",
+ state->s->name,
+ name);
return true;
} else {
- state->err = ENOENT;
- return false;
+ D_ERR("conf: unknown option [%s] -> \"%s\"\n",
+ state->s->name,
+ name);
+ state->err = EINVAL;
+ return true;
}
}
@@ -1128,9 +1139,13 @@ static bool conf_load_option(const char *name,
value.type = opt->type;
ret = conf_value_from_string(tmp_ctx, value_str, &value);
if (ret != 0) {
+ D_ERR("conf: invalid value [%s] -> \"%s\" = \"%s\"\n",
+ state->s->name,
+ name,
+ value_str);
talloc_free(tmp_ctx);
state->err = ret;
- return false;
+ return true;
}
ok = conf_option_same_value(opt, &value);
@@ -1142,7 +1157,7 @@ static bool conf_load_option(const char *name,
if (ret != 0) {
talloc_free(tmp_ctx);
state->err = ret;
- return false;
+ return true;
}
done:
@@ -1196,16 +1211,16 @@ static int conf_set(struct conf_context *conf,
s = conf_section_find(conf, section);
if (s == NULL) {
- return ENOENT;
+ return EINVAL;
}
opt = conf_option_find(s, key);
if (opt == NULL) {
- return ENOENT;
+ return EINVAL;
}
if (opt->type != value->type) {
- return ENOENT;
+ return EINVAL;
}
ok = conf_option_same_value(opt, value);
@@ -1280,12 +1295,12 @@ static int conf_get(struct conf_context *conf,
s = conf_section_find(conf, section);
if (s == NULL) {
- return ENOENT;
+ return EINVAL;
}
opt = conf_option_find(s, key);
if (opt == NULL) {
- return ENOENT;
+ return EINVAL;
}
if (opt->type != type) {
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index ef829e5..721347c 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -223,7 +223,7 @@ int main(int argc, const char *argv[])
ret = ctdbd_config_load(ctdb, &conf);
if (ret != 0) {
- fprintf(stderr, "Failed to setup config file handling\n");
+ /* ctdbd_config_load() logs the failure */
goto fail;
}
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 8c87a3d..267f38a 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -263,8 +263,12 @@ int ctdb_start_eventd(struct ctdb_context *ctdb)
return -1;
}
- DEBUG(DEBUG_NOTICE,
- ("Starting event daemon %s %s %s\n", argv[0], argv[1], argv[2]));
+ D_NOTICE("Starting event daemon %s %s %s %s %s\n",
+ argv[0],
+ argv[1],
+ argv[2],
+ argv[3],
+ argv[4]);
pid = ctdb_fork(ctdb);
if (pid == -1) {
diff --git a/ctdb/tests/cunit/conf_test_001.sh b/ctdb/tests/cunit/conf_test_001.sh
index 08a51b0..d2ffa98 100755
--- a/ctdb/tests/cunit/conf_test_001.sh
+++ b/ctdb/tests/cunit/conf_test_001.sh
@@ -106,6 +106,7 @@ EOF
required_result 22 <<EOF
conf: unknown section [section2]
+conf: unknown section for option "foo"
[section1]
# key1 = value1
# key2 = 10
@@ -120,7 +121,8 @@ cat > "$conffile" <<EOF
key2 = 20
EOF
-required_result 2 <<EOF
+required_error EINVAL <<EOF
+conf: unknown option [section1] -> "foo"
[section1]
# key1 = value1
# key2 = 10
diff --git a/ctdb/tests/cunit/config_test_001.sh b/ctdb/tests/cunit/config_test_001.sh
index bf1e589..d213aa8 100755
--- a/ctdb/tests/cunit/config_test_001.sh
+++ b/ctdb/tests/cunit/config_test_001.sh
@@ -81,7 +81,7 @@ foobar = cat
EOF
required_result 22 <<EOF
-conf: unknown option "foobar"
+conf: unknown section for option "foobar"
Failed to load config file $conffile
EOF
unit_test ctdb-config validate
@@ -101,7 +101,8 @@ cat > "$conffile" <<EOF
log level = debug
EOF
-required_result 2 <<EOF
+required_error EINVAL <<EOF
+conf: unknown option [database] -> "unknown key"
Failed to load config file $conffile
EOF
unit_test ctdb-config validate
diff --git a/ctdb/tests/cunit/config_test_005.sh b/ctdb/tests/cunit/config_test_005.sh
index df63676..cd48a84 100755
--- a/ctdb/tests/cunit/config_test_005.sh
+++ b/ctdb/tests/cunit/config_test_005.sh
@@ -30,6 +30,10 @@ EOF
required_result 22 <<EOF
volatile database directory "${dbdir_volatile}" does not exist
conf: validation for option "volatile database directory" failed
+persistent database directory "${dbdir_persistent}" does not exist
+conf: validation for option "persistent database directory" failed
+state database directory "${dbdir_state}" does not exist
+conf: validation for option "state database directory" failed
Failed to load config file $conffile
EOF
unit_test ctdb-config validate
@@ -39,6 +43,8 @@ mkdir -p "$dbdir_volatile"
required_result 22 <<EOF
persistent database directory "${dbdir_persistent}" does not exist
conf: validation for option "persistent database directory" failed
+state database directory "${dbdir_state}" does not exist
+conf: validation for option "state database directory" failed
Failed to load config file $conffile
EOF
unit_test ctdb-config validate
diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
index 03df068..ad683cf 100644
--- a/ctdb/tests/eventscripts/scripts/local.sh
+++ b/ctdb/tests/eventscripts/scripts/local.sh
@@ -547,5 +547,5 @@ simple_test_event ()
simple_test_command ()
{
- unit_test "$@"
+ unit_test_notrace "$@"
}
diff --git a/ctdb/tests/scripts/common.sh b/ctdb/tests/scripts/common.sh
index dfba6fd..143ae08 100644
--- a/ctdb/tests/scripts/common.sh
+++ b/ctdb/tests/scripts/common.sh
@@ -37,13 +37,15 @@ else
PATH="${_tools_dir}:$PATH"
fi
- _test_bin_dir="${ctdb_dir}/bin"
+ top_dir=$(cd -P "$ctdb_dir" && echo "$PWD") # real path
+
+ _test_bin_dir="${top_dir}/bin"
+ if [ ! -d "$_test_bin_dir" ] ; then
+ top_dir=$(dirname "$top_dir")
+ _test_bin_dir="${top_dir}/bin"
+ fi
fi
-case "$_test_bin_dir" in
-/*) : ;;
-*) _test_bin_dir="${PWD}/${_test_bin_dir}" ;;
-esac
if [ -d "$_test_bin_dir" ] ; then
PATH="${_test_bin_dir}:$PATH"
fi
diff --git a/ctdb/tests/scripts/script_install_paths.sh b/ctdb/tests/scripts/script_install_paths.sh
index c0777c9..5266ba4 100644
--- a/ctdb/tests/scripts/script_install_paths.sh
+++ b/ctdb/tests/scripts/script_install_paths.sh
@@ -8,7 +8,7 @@ if [ -n "$ctdb_dir" ] ; then
CTDB_SCRIPTS_SBIN_DIR="${ctdb_dir}/config"
CTDB_SCRIPTS_TOOLS_BIN_DIR="${ctdb_dir}/tools"
CTDB_SCRIPTS_TOOLS_HELPER_DIR="${ctdb_dir}/tools"
- CTDB_SCRIPTS_HELPER_BINDIR="${ctdb_dir}/bin"
+ CTDB_SCRIPTS_HELPER_BINDIR="${top_dir}/bin"
CTDB_SCRIPTS_DATA_DIR="${ctdb_dir}/config"
else
# Installed
diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash
index c7a5ee0..f4a32aa 100644
--- a/ctdb/tests/simple/scripts/local_daemons.bash
+++ b/ctdb/tests/simple/scripts/local_daemons.bash
@@ -1,19 +1,16 @@
# If we're not running on a real cluster then we need a local copy of
# ctdb (and other stuff) in $PATH and we will use local daemons.
-# Use in-tree binaries if running against local daemons.
-# Otherwise CTDB need to be installed on all nodes.
-if [ -n "$ctdb_dir" -a -d "${ctdb_dir}/bin" ] ; then
- # ctdbd_wrapper is in config/ directory
- PATH="${ctdb_dir}/bin:${ctdb_dir}/config:${PATH}"
- hdir="${ctdb_dir}/bin"
- export CTDB_EVENTD="${hdir}/ctdb-eventd"
- export CTDB_EVENT_HELPER="${hdir}/ctdb-event"
- export CTDB_LOCK_HELPER="${hdir}/ctdb_lock_helper"
- export CTDB_RECOVERY_HELPER="${hdir}/ctdb_recovery_helper"
- export CTDB_TAKEOVER_HELPER="${hdir}/ctdb_takeover_helper"
- export CTDB_CLUSTER_MUTEX_HELPER="${hdir}/ctdb_mutex_fcntl_helper"
-fi
+# For ctdbd_wrapper
+PATH="${CTDB_SCRIPTS_BASE}:${PATH}"
+
+hdir="$CTDB_SCRIPTS_HELPER_BINDIR"
+export CTDB_EVENTD="${hdir}/ctdb-eventd"
+export CTDB_EVENT_HELPER="${hdir}/ctdb-event"
+export CTDB_LOCK_HELPER="${hdir}/ctdb_lock_helper"
+export CTDB_RECOVERY_HELPER="${hdir}/ctdb_recovery_helper"
+export CTDB_TAKEOVER_HELPER="${hdir}/ctdb_takeover_helper"
+export CTDB_CLUSTER_MUTEX_HELPER="${hdir}/ctdb_mutex_fcntl_helper"
if [ -n "$TEST_SOCKET_WRAPPER_SO_PATH" ] ; then
export LD_PRELOAD="$TEST_SOCKET_WRAPPER_SO_PATH"
--
Samba Shared Repository
More information about the samba-cvs
mailing list