mirror of
https://github.com/samba-team/samba.git
synced 2025-09-05 13:44:19 +03:00
ctdb-tests: Avoid segfault by initializing logging
Setting DEBUGLEVEL before calling debug_init() causes segmentation violation with gcc8. DEBUGLEVEL_CLASS is statically initialized to debug_class_list_initial which is defined as const. Only after debug_init() is called, DEBUGLEVEL_CLASS becomes a talloc'd array. So before modifying DEBUGLEVEL, ensure debug_init() is called via setup_logging(). (debug_init is a static function.) Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
committed by
Martin Schwenke
parent
b977ded38a
commit
af69700853
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "client/client.h"
|
#include "client/client.h"
|
||||||
@@ -230,6 +231,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("fetch_loop", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_basic(argc, argv, &opts);
|
status = process_options_basic(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "client/client.h"
|
#include "client/client.h"
|
||||||
@@ -155,6 +156,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("fetch_loop_key", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_database(argc, argv, &opts);
|
status = process_options_database(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "client/client.h"
|
#include "client/client.h"
|
||||||
@@ -107,6 +108,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("fetch_readonly", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_database(argc, argv, &opts);
|
status = process_options_database(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "client/client.h"
|
#include "client/client.h"
|
||||||
@@ -214,6 +215,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("fetch_readonly_loop", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_basic(argc, argv, &opts);
|
status = process_options_basic(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/time.h"
|
#include "lib/util/time.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
@@ -331,6 +332,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("fetch_ring", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_basic(argc, argv, &opts);
|
status = process_options_basic(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -213,6 +213,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("glock_loop", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_basic(argc, argv, &opts);
|
status = process_options_basic(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -230,8 +232,6 @@ int main(int argc, const char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_logging("glock_loop", DEBUG_STDERR);
|
|
||||||
|
|
||||||
ret = ctdb_client_init(mem_ctx, ev, opts->socket, &client);
|
ret = ctdb_client_init(mem_ctx, ev, opts->socket, &client);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
fprintf(stderr, "Failed to initialize client, ret=%d\n", ret);
|
fprintf(stderr, "Failed to initialize client, ret=%d\n", ret);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/time.h"
|
#include "lib/util/time.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
@@ -317,6 +318,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("message_ring", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_basic(argc, argv, &opts);
|
status = process_options_basic(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "client/client.h"
|
#include "client/client.h"
|
||||||
@@ -342,6 +343,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("transaction_loop", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_database(argc, argv, &opts);
|
status = process_options_database(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "protocol/protocol_private.h"
|
#include "protocol/protocol_private.h"
|
||||||
@@ -429,6 +430,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("tunnel_test", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_basic(argc, argv, &opts);
|
status = process_options_basic(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "protocol/protocol_api.h"
|
#include "protocol/protocol_api.h"
|
||||||
@@ -177,6 +178,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("update_record", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_database(argc, argv, &opts);
|
status = process_options_database(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "replace.h"
|
#include "replace.h"
|
||||||
#include "system/network.h"
|
#include "system/network.h"
|
||||||
|
|
||||||
|
#include "lib/util/debug.h"
|
||||||
#include "lib/util/tevent_unix.h"
|
#include "lib/util/tevent_unix.h"
|
||||||
|
|
||||||
#include "protocol/protocol_api.h"
|
#include "protocol/protocol_api.h"
|
||||||
@@ -153,6 +154,8 @@ int main(int argc, const char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
bool status;
|
bool status;
|
||||||
|
|
||||||
|
setup_logging("update_record_persistene", DEBUG_STDERR);
|
||||||
|
|
||||||
status = process_options_database(argc, argv, &opts);
|
status = process_options_database(argc, argv, &opts);
|
||||||
if (! status) {
|
if (! status) {
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -865,7 +865,7 @@ def build(bld):
|
|||||||
source=bld.SUBDIR('tests/src',
|
source=bld.SUBDIR('tests/src',
|
||||||
'cluster_wait.c test_options.c'),
|
'cluster_wait.c test_options.c'),
|
||||||
includes='include',
|
includes='include',
|
||||||
deps='replace popt talloc tevent tdb')
|
deps='samba-util replace popt talloc tevent tdb')
|
||||||
|
|
||||||
# Test binaries
|
# Test binaries
|
||||||
ctdb_tests = [
|
ctdb_tests = [
|
||||||
|
Reference in New Issue
Block a user