Add rewritten build test script and remove some build warnings.

This commit is contained in:
Roger A. Light 2019-02-12 13:24:54 +00:00
parent e72d1d6ff5
commit 9999faf9da
7 changed files with 68 additions and 5 deletions

View File

@ -15,6 +15,7 @@ Library:
Build:
- Don't require C99 compiler.
- Add rewritten build test script and remove some build warnings.
1.5.6 - 20190206

59
buildtest.py Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/python3
build_variants = [
'WITH_ADNS',
'WITH_BRIDGE',
'WITH_DOCS',
'WITH_EC',
'WITH_EPOLL',
'WITH_MEMORY_TRACKING',
'WITH_PERSISTENCE',
'WITH_SHARED_LIBRARIES',
'WITH_SOCKS',
'WITH_SRV',
'WITH_STATIC_LIBRARIES',
'WITH_STRIP',
'WITH_SYSTEMD',
'WITH_SYS_TREE',
'WITH_THREADING',
'WITH_TLS',
'WITH_TLS_PSK',
'WITH_WEBSOCKETS',
'WITH_WRAP',
]
special_variants = [
'WITH_BUNDLED_DEPS',
'WITH_COVERAGE',
]
import random
import subprocess
def run_test(msg, opts):
subprocess.run(["make", "clean"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print("%s: %s" % (msg, str(opts)))
args = ["make", "-j"] + opts
proc = subprocess.run(args, stdout=subprocess.DEVNULL)
if proc.returncode != 0:
raise RuntimeError("BUILD FAILED: %s" % (' '.join(args)))
def simple_tests():
for bv in build_variants:
for enabled in ["yes", "no"]:
opts = "%s=%s" % (bv, enabled)
run_test("SIMPLE BUILD", [opts])
def random_tests(count=10):
for i in range(1, count):
opts = []
for bv in build_variants:
opts.append("%s=%s" % (bv, random.choice(["yes", "no"])))
run_test("RANDOM BUILD", opts)
if __name__ == "__main__":
simple_tests()
random_tests(100)

View File

@ -21,10 +21,10 @@ static : static_pub static_sub
# libmosquitto only.
static_pub : pub_client.o client_shared.o ../lib/libmosquitto.a
${CROSS_COMPILE}${CC} $^ -o mosquitto_pub ${CLIENT_LDFLAGS} -lssl -lcrypto -lpthread
${CROSS_COMPILE}${CC} $^ -o mosquitto_pub ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS}
static_sub : sub_client.o sub_client_output.o client_shared.o ../lib/libmosquitto.a
${CROSS_COMPILE}${CC} $^ -o mosquitto_sub ${CLIENT_LDFLAGS} -lssl -lcrypto -lpthread
${CROSS_COMPILE}${CC} $^ -o mosquitto_sub ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS}
mosquitto_pub : pub_client.o client_shared.o
${CROSS_COMPILE}${CC} $^ -o $@ ${CLIENT_LDFLAGS}

View File

@ -129,6 +129,7 @@ else
CFLAGS?=-Wall -ggdb -O2
endif
STATIC_LIB_DEPS:=
LIB_CFLAGS:=${CFLAGS} ${CPPFLAGS} -I. -I.. -I../lib
LIB_CXXFLAGS:=$(CFLAGS) ${CPPFLAGS} -I. -I.. -I../lib
LIB_LDFLAGS:=${LDFLAGS}
@ -192,6 +193,7 @@ ifeq ($(WITH_TLS),yes)
LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_TLS
PASSWD_LIBS:=-lcrypto
CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_TLS
STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lssl -lcrypto
ifeq ($(WITH_TLS_PSK),yes)
BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_TLS_PSK
@ -204,6 +206,7 @@ ifeq ($(WITH_THREADING),yes)
LIB_LIBS:=$(LIB_LIBS) -lpthread
LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_THREADING
CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_THREADING
STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lpthread
endif
ifeq ($(WITH_SOCKS),yes)
@ -249,6 +252,7 @@ ifeq ($(WITH_SRV),yes)
LIB_CFLAGS:=$(LIB_CFLAGS) -DWITH_SRV
LIB_LIBS:=$(LIB_LIBS) -lcares
CLIENT_CFLAGS:=$(CLIENT_CFLAGS) -DWITH_SRV
STATIC_LIB_DEPS:=$(STATIC_LIB_DEPS) -lcares
endif
ifeq ($(UNAME),SunOS)

View File

@ -112,7 +112,6 @@ int bridge__new(struct mosquitto_db *db, struct mosquitto__bridge *bridge)
int bridge__connect_step1(struct mosquitto_db *db, struct mosquitto *context)
{
int rc;
int i;
char *notification_topic;
int notification_topic_len;
uint8_t notification_payload;

View File

@ -727,12 +727,12 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
char *tmp_char;
struct mosquitto__bridge *cur_bridge = NULL;
struct mosquitto__bridge_topic *cur_topic;
int len;
#endif
struct mosquitto__auth_plugin_config *cur_auth_plugin_config = NULL;
time_t expiration_mult;
char *key;
int len;
struct mosquitto__listener *cur_listener = &config->default_listener;
int i;
int lineno_ext;

View File

@ -756,7 +756,7 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol
if(!getsockopt(context->sock, SOL_SOCKET, SO_ERROR, (char *)&err, &len)){
if(err == 0){
context->state = mosq_cs_new;
#ifdef WITH_ADNS
#if defined(WITH_ADNS) && defined(WITH_BRIDGE)
if(context->bridge){
bridge__connect_step3(db, context);
continue;