Add mosq_test.env_add_ld_library_path() for tests

pull/1820/merge
Roger A. Light 2 years ago
parent 068778f7d9
commit 41f0d34348

@ -18,8 +18,7 @@ def do_test(args, rc_expected, response=None):
if proc.returncode != rc_expected: if proc.returncode != rc_expected:
raise ValueError(args) raise ValueError(args)
env = dict(os.environ) env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib'
do_test([], 1) do_test([], 1)
do_test(["broker"], 1) do_test(["broker"], 1)

@ -50,8 +50,7 @@ ports = mosq_test.get_port(2)
conf_file = os.path.basename(__file__).replace('.py', '.conf') conf_file = os.path.basename(__file__).replace('.py', '.conf')
write_config(conf_file, ports) write_config(conf_file, ports)
env = dict(os.environ) env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib'
if not os.path.exists(str(ports[0])): if not os.path.exists(str(ports[0])):
os.mkdir(str(ports[0])) os.mkdir(str(ports[0]))

@ -60,8 +60,7 @@ ports = mosq_test.get_port(2)
conf_file = os.path.basename(__file__).replace('.py', '.conf') conf_file = os.path.basename(__file__).replace('.py', '.conf')
write_config(conf_file, ports) write_config(conf_file, ports)
env = dict(os.environ) env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib'
if not os.path.exists(str(ports[0])): if not os.path.exists(str(ports[0])):
os.mkdir(str(ports[0])) os.mkdir(str(ports[0]))

@ -47,9 +47,9 @@ def do_test(counts):
try: try:
broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port, use_conf=True) broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port, use_conf=True)
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib',
'XDG_CONFIG_HOME':'/tmp/missing' 'XDG_CONFIG_HOME':'/tmp/missing'
} }
env = mosq_test.env_add_ld_library_path(env)
# Set up persistent client session, including a subscription # Set up persistent client session, including a subscription
cmd = [ cmd = [

@ -34,14 +34,7 @@ conf_file2 = "08-tls-psk-bridge.conf2"
write_config1(conf_file1, port1, port2) write_config1(conf_file1, port1, port2)
write_config2(conf_file2, port2, port3) write_config2(conf_file2, port2, port3)
env = dict(os.environ) env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib:' + mosq_test.get_build_root() + '/lib/cpp'
try:
pp = env['PYTHONPATH']
except KeyError:
pp = ''
env['PYTHONPATH'] = mosq_test.get_build_root() + '/lib/python:'+pp
rc = 1 rc = 1
connect_packet = mosq_test.gen_connect("no-psk-test-client") connect_packet = mosq_test.gen_connect("no-psk-test-client")

@ -22,14 +22,7 @@ def write_config(filename, port1, port2):
conf_file = os.path.basename(__file__).replace('.py', '.conf') conf_file = os.path.basename(__file__).replace('.py', '.conf')
write_config(conf_file, port1, port2) write_config(conf_file, port1, port2)
env = dict(os.environ) env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib:' + mosq_test.get_build_root() + '/lib/cpp'
try:
pp = env['PYTHONPATH']
except KeyError:
pp = ''
env['PYTHONPATH'] = mosq_test.get_build_root() + '/lib/python:'+pp
rc = 1 rc = 1
connect_packet = mosq_test.gen_connect("no-psk-test-client") connect_packet = mosq_test.gen_connect("no-psk-test-client")

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub'] + args cmd = ['../../client/mosquitto_sub'] + args
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub'] + args cmd = ['../../client/mosquitto_sub'] + args
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub'] + args cmd = ['../../client/mosquitto_sub'] + args
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -16,7 +16,7 @@ def do_test(proto_ver, env):
else: else:
V = 'mqttv31' V = 'mqttv31'
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib' env = mosq_test.env_add_ld_library_path(env)
cmd = [mosq_test.get_build_root() + '/client/mosquitto_sub', cmd = [mosq_test.get_build_root() + '/client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '0', '-q', '0',

@ -18,9 +18,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -18,9 +18,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-F', '%j', '-F', '%j',

@ -18,9 +18,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -18,9 +18,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-F', '%j', '-F', '%j',

@ -17,9 +17,9 @@ def do_test(format_str, expected_output, proto_ver=4, payload="message"):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -25,9 +25,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib:'+ os.getenv("LD_LIBRARY_PATH", ""), 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(ports[0]), '-p', str(ports[0]),
'-q', '1', '-q', '1',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_sub', cmd = ['../../client/mosquitto_sub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub'] + args cmd = ['../../client/mosquitto_pub'] + args
pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub'] + args cmd = ['../../client/mosquitto_pub'] + args
pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub'] + args cmd = ['../../client/mosquitto_pub'] + args
pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) pub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -16,8 +16,7 @@ def do_test(proto_ver, env):
else: else:
V = 'mqttv31' V = 'mqttv31'
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib' env = mosq_test.env_add_ld_library_path(env)
cmd = [mosq_test.get_build_root() + '/client/mosquitto_pub', cmd = [mosq_test.get_build_root() + '/client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -23,9 +23,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -24,9 +24,10 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -26,9 +26,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-o', conf_file '-o', conf_file
] ]

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '0', '-q', '0',

@ -10,9 +10,9 @@ def do_test(proto_ver):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
if proto_ver == 5: if proto_ver == 5:
V = 'mqttv5' V = 'mqttv5'
elif proto_ver == 4: elif proto_ver == 4:

@ -25,9 +25,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib:'+ os.getenv("LD_LIBRARY_PATH", ""), 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
payload = "abcdefghijklmnopqrstuvwxyz0123456789"*1821 payload = "abcdefghijklmnopqrstuvwxyz0123456789"*1821

@ -25,9 +25,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib:'+ os.getenv("LD_LIBRARY_PATH", ""), 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(ports[0]), '-p', str(ports[0]),
'-q', '1', '-q', '1',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -36,9 +36,9 @@ def do_test(proto_ver, host):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = [ cmd = [
'../../client/mosquitto_pub', '../../client/mosquitto_pub',
'-h', host, '-h', host,

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '1', '-q', '1',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-p', str(port), '-p', str(port),
'-q', '2', '-q', '2',

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_pub', cmd = ['../../client/mosquitto_pub',
'-L', f'mqtt://localhost:{port}/03/pub/url/test', '-L', f'mqtt://localhost:{port}/03/pub/url/test',
'-m', 'message', '-m', 'message',

@ -10,9 +10,10 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_rr'] + args cmd = ['../../client/mosquitto_rr'] + args
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_rr'] + args cmd = ['../../client/mosquitto_rr'] + args
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -10,9 +10,9 @@ def do_test(args, stderr_expected, rc_expected):
port = mosq_test.get_port() port = mosq_test.get_port()
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
cmd = ['../../client/mosquitto_rr'] + args cmd = ['../../client/mosquitto_rr'] + args
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)

@ -16,7 +16,7 @@ def do_test(proto_ver, env):
else: else:
V = 'mqttv31' V = 'mqttv31'
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib' env = mosq_test.env_add_ld_library_path(env)
payload = "message" payload = "message"
cmd = [mosq_test.get_build_root() + '/client/mosquitto_rr', cmd = [mosq_test.get_build_root() + '/client/mosquitto_rr',

@ -25,9 +25,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib:'+ os.getenv("LD_LIBRARY_PATH", ""), 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
payload = "message" payload = "message"
cmd = ['../../client/mosquitto_rr', cmd = ['../../client/mosquitto_rr',
'-p', str(ports[0]), '-p', str(ports[0]),

@ -17,9 +17,9 @@ def do_test(proto_ver):
V = 'mqttv31' V = 'mqttv31'
env = { env = {
'LD_LIBRARY_PATH': mosq_test.get_build_root() + '/lib', 'XDG_CONFIG_HOME':'/tmp/missing'
'XDG_CONFIG_HOME':'/tmp/missing' }
} env = mosq_test.env_add_ld_library_path(env)
payload = "message" payload = "message"
cmd = ['../../client/mosquitto_rr', cmd = ['../../client/mosquitto_rr',
'-p', str(port), '-p', str(port),

@ -25,8 +25,7 @@ def do_test(client_cmd):
sock.listen(5) sock.listen(5)
client_args = [client_cmd, str(port)] client_args = [client_cmd, str(port)]
env = dict(os.environ) env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib:' + mosq_test.get_build_root() + '/lib/cpp'
client = mosq_test.start_client(filename=client_cmd.replace('/', '-'), cmd=client_args, env=env) client = mosq_test.start_client(filename=client_cmd.replace('/', '-'), cmd=client_args, env=env)

@ -27,8 +27,7 @@ def do_test(client_cmd):
sock.listen(5) sock.listen(5)
client_args = [client_cmd, str(port)] client_args = [client_cmd, str(port)]
env = dict(os.environ) env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib:' + mosq_test.get_build_root() + '/lib/cpp'
client = mosq_test.start_client(filename=client_cmd.replace('/', '-'), cmd=client_args, env=env) client = mosq_test.start_client(filename=client_cmd.replace('/', '-'), cmd=client_args, env=env)

@ -88,8 +88,7 @@ class MsgSequence(object):
global vg_index global vg_index
global vg_logfiles global vg_logfiles
env = {} env = mosq_test.env_add_ld_library_path()
env['LD_LIBRARY_PATH'] = mosq_test.get_build_root() + '/lib'
cmd = [ cmd = [
mosq_test.get_build_root() + '/test/lib/c/fuzzish.test', mosq_test.get_build_root() + '/test/lib/c/fuzzish.test',
str(port), str(self.proto_ver), str(self.clean_start) str(port), str(self.proto_ver), str(self.clean_start)

@ -30,6 +30,28 @@ def get_build_root():
result = str(Path(__file__).resolve().parents[1]) result = str(Path(__file__).resolve().parents[1])
return result return result
def env_add_ld_library_path(env=None):
p = ":".join([
get_build_root() + '/lib',
get_build_root() + '/lib/cpp',
os.getenv("LD_LIBRARY_PATH", "")
])
if env is None:
env = {
'LD_LIBRARY_PATH': p,
'DYLIB_LIBRARY_PATH': p,
}
else:
for v in ['LD_LIBRARY_PATH', 'DYLIB_LIBRARY_PATH']:
try:
val = env[v]
env[v] = ":".join([val, p])
except KeyError:
env[v] = p
return env
def listen_sock(port): def listen_sock(port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@ -105,9 +127,7 @@ def start_broker(filename, cmd=None, port=0, use_conf=False, expect_fail=False,
def start_client(filename, cmd, env=None): def start_client(filename, cmd, env=None):
if cmd is None: if cmd is None:
raise ValueError raise ValueError
if env is None: env = env_add_ld_library_path(env)
env = dict(os.environ)
env['LD_LIBRARY_PATH'] = get_build_root() + '/lib:' + get_build_root() + '/lib/cpp'
if os.environ.get('MOSQ_USE_VALGRIND') is not None: if os.environ.get('MOSQ_USE_VALGRIND') is not None:
cmd = ['valgrind', '-q', '--log-file='+filename+'.vglog'] + cmd cmd = ['valgrind', '-q', '--log-file='+filename+'.vglog'] + cmd

@ -39,8 +39,6 @@ def run_clients(max_clients):
c.wait() c.wait()
env = {} env = mosq_test.env_add_ld_library_path()
env["LD_LIBRARY_PATH"] = "../../lib"
#broker = subprocess.Popen(["../../src/mosquitto", "-c", "random.conf"], env=env) #broker = subprocess.Popen(["../../src/mosquitto", "-c", "random.conf"], env=env)
run_clients(1000) run_clients(1000)

Loading…
Cancel
Save