mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-15 08:56:38 -05:00
test: replace all spa_assert() macros with spa_assert_se()
These are tests, we never want those to be optimized away.
This commit is contained in:
parent
63d833dabf
commit
49f3d5842e
14 changed files with 981 additions and 981 deletions
|
|
@ -80,27 +80,27 @@ static int setup_context(struct context *ctx)
|
||||||
factory = &test_source_factory;
|
factory = &test_source_factory;
|
||||||
size = spa_handle_factory_get_size(factory, NULL);
|
size = spa_handle_factory_get_size(factory, NULL);
|
||||||
ctx->follower_handle = calloc(1, size);
|
ctx->follower_handle = calloc(1, size);
|
||||||
spa_assert(ctx->follower_handle != NULL);
|
spa_assert_se(ctx->follower_handle != NULL);
|
||||||
|
|
||||||
res = spa_handle_factory_init(factory,
|
res = spa_handle_factory_init(factory,
|
||||||
ctx->follower_handle,
|
ctx->follower_handle,
|
||||||
NULL, support, 1);
|
NULL, support, 1);
|
||||||
spa_assert(res >= 0);
|
spa_assert_se(res >= 0);
|
||||||
|
|
||||||
res = spa_handle_get_interface(ctx->follower_handle,
|
res = spa_handle_get_interface(ctx->follower_handle,
|
||||||
SPA_TYPE_INTERFACE_Node, &iface);
|
SPA_TYPE_INTERFACE_Node, &iface);
|
||||||
spa_assert(res >= 0);
|
spa_assert_se(res >= 0);
|
||||||
|
|
||||||
ctx->follower_node = iface;
|
ctx->follower_node = iface;
|
||||||
|
|
||||||
/* make adapter */
|
/* make adapter */
|
||||||
factory = find_factory(SPA_NAME_AUDIO_ADAPT);
|
factory = find_factory(SPA_NAME_AUDIO_ADAPT);
|
||||||
spa_assert(factory != NULL);
|
spa_assert_se(factory != NULL);
|
||||||
|
|
||||||
size = spa_handle_factory_get_size(factory, NULL);
|
size = spa_handle_factory_get_size(factory, NULL);
|
||||||
|
|
||||||
ctx->adapter_handle = calloc(1, size);
|
ctx->adapter_handle = calloc(1, size);
|
||||||
spa_assert(ctx->adapter_handle != NULL);
|
spa_assert_se(ctx->adapter_handle != NULL);
|
||||||
|
|
||||||
snprintf(value, sizeof(value), "pointer:%p", ctx->follower_node);
|
snprintf(value, sizeof(value), "pointer:%p", ctx->follower_node);
|
||||||
items[0] = SPA_DICT_ITEM_INIT("audio.adapt.follower", value);
|
items[0] = SPA_DICT_ITEM_INIT("audio.adapt.follower", value);
|
||||||
|
|
@ -109,11 +109,11 @@ static int setup_context(struct context *ctx)
|
||||||
ctx->adapter_handle,
|
ctx->adapter_handle,
|
||||||
&SPA_DICT_INIT(items, 1),
|
&SPA_DICT_INIT(items, 1),
|
||||||
support, 1);
|
support, 1);
|
||||||
spa_assert(res >= 0);
|
spa_assert_se(res >= 0);
|
||||||
|
|
||||||
res = spa_handle_get_interface(ctx->adapter_handle,
|
res = spa_handle_get_interface(ctx->adapter_handle,
|
||||||
SPA_TYPE_INTERFACE_Node, &iface);
|
SPA_TYPE_INTERFACE_Node, &iface);
|
||||||
spa_assert(res >= 0);
|
spa_assert_se(res >= 0);
|
||||||
ctx->adapter_node = iface;
|
ctx->adapter_node = iface;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -134,8 +134,8 @@ static void node_info(void *data, const struct spa_node_info *info)
|
||||||
info->max_input_ports,
|
info->max_input_ports,
|
||||||
info->max_output_ports);
|
info->max_output_ports);
|
||||||
|
|
||||||
spa_assert(info->max_input_ports == 0);
|
spa_assert_se(info->max_input_ports == 0);
|
||||||
spa_assert(info->max_output_ports > 0);
|
spa_assert_se(info->max_output_ports > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void port_info_none(void *data,
|
static void port_info_none(void *data,
|
||||||
|
|
@ -167,8 +167,8 @@ static void port_info_5_1(void *data,
|
||||||
enum spa_direction direction, uint32_t port,
|
enum spa_direction direction, uint32_t port,
|
||||||
const struct spa_port_info *info)
|
const struct spa_port_info *info)
|
||||||
{
|
{
|
||||||
spa_assert(direction == SPA_DIRECTION_OUTPUT);
|
spa_assert_se(direction == SPA_DIRECTION_OUTPUT);
|
||||||
spa_assert(port < 6);
|
spa_assert_se(port < 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int test_split_setup(struct context *ctx)
|
static int test_split_setup(struct context *ctx)
|
||||||
|
|
@ -207,7 +207,7 @@ static int test_split_setup(struct context *ctx)
|
||||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
||||||
|
|
||||||
res = spa_node_set_param(ctx->adapter_node, SPA_PARAM_PortConfig, 0, param);
|
res = spa_node_set_param(ctx->adapter_node, SPA_PARAM_PortConfig, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
spa_zero(listener);
|
spa_zero(listener);
|
||||||
spa_node_add_listener(ctx->adapter_node,
|
spa_node_add_listener(ctx->adapter_node,
|
||||||
|
|
@ -228,7 +228,7 @@ static int test_split_setup(struct context *ctx)
|
||||||
spa_log_debug(&logger.log, "set format %d@%d", info.channels, info.rate);
|
spa_log_debug(&logger.log, "set format %d@%d", info.channels, info.rate);
|
||||||
res = spa_node_set_param(ctx->adapter_node, SPA_PARAM_Format, 0, param);
|
res = spa_node_set_param(ctx->adapter_node, SPA_PARAM_Format, 0, param);
|
||||||
spa_log_debug(&logger.log, "result %d", res);
|
spa_log_debug(&logger.log, "result %d", res);
|
||||||
spa_assert(res >= 0);
|
spa_assert_se(res >= 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,22 +79,22 @@ static int setup_context(struct context *ctx)
|
||||||
|
|
||||||
/* make convert */
|
/* make convert */
|
||||||
factory = find_factory(SPA_NAME_AUDIO_CONVERT);
|
factory = find_factory(SPA_NAME_AUDIO_CONVERT);
|
||||||
spa_assert(factory != NULL);
|
spa_assert_se(factory != NULL);
|
||||||
|
|
||||||
size = spa_handle_factory_get_size(factory, NULL);
|
size = spa_handle_factory_get_size(factory, NULL);
|
||||||
|
|
||||||
ctx->convert_handle = calloc(1, size);
|
ctx->convert_handle = calloc(1, size);
|
||||||
spa_assert(ctx->convert_handle != NULL);
|
spa_assert_se(ctx->convert_handle != NULL);
|
||||||
|
|
||||||
res = spa_handle_factory_init(factory,
|
res = spa_handle_factory_init(factory,
|
||||||
ctx->convert_handle,
|
ctx->convert_handle,
|
||||||
NULL,
|
NULL,
|
||||||
support, 1);
|
support, 1);
|
||||||
spa_assert(res >= 0);
|
spa_assert_se(res >= 0);
|
||||||
|
|
||||||
res = spa_handle_get_interface(ctx->convert_handle,
|
res = spa_handle_get_interface(ctx->convert_handle,
|
||||||
SPA_TYPE_INTERFACE_Node, &iface);
|
SPA_TYPE_INTERFACE_Node, &iface);
|
||||||
spa_assert(res >= 0);
|
spa_assert_se(res >= 0);
|
||||||
ctx->convert_node = iface;
|
ctx->convert_node = iface;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -115,8 +115,8 @@ static void node_info_check(void *data, const struct spa_node_info *info)
|
||||||
info->max_input_ports,
|
info->max_input_ports,
|
||||||
info->max_output_ports);
|
info->max_output_ports);
|
||||||
|
|
||||||
spa_assert(info->max_input_ports == MAX_PORTS);
|
spa_assert_se(info->max_input_ports == MAX_PORTS);
|
||||||
spa_assert(info->max_output_ports == MAX_PORTS);
|
spa_assert_se(info->max_output_ports == MAX_PORTS);
|
||||||
|
|
||||||
ctx->got_node_info = true;
|
ctx->got_node_info = true;
|
||||||
}
|
}
|
||||||
|
|
@ -151,11 +151,11 @@ static int test_init_state(struct context *ctx)
|
||||||
&listener, &init_events, ctx);
|
&listener, &init_events, ctx);
|
||||||
spa_hook_remove(&listener);
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
spa_assert(ctx->got_node_info);
|
spa_assert_se(ctx->got_node_info);
|
||||||
spa_assert(ctx->n_port_info[0] == 1);
|
spa_assert_se(ctx->n_port_info[0] == 1);
|
||||||
spa_assert(ctx->n_port_info[1] == 1);
|
spa_assert_se(ctx->n_port_info[1] == 1);
|
||||||
spa_assert(ctx->got_port_info[0][0] == true);
|
spa_assert_se(ctx->got_port_info[0][0] == true);
|
||||||
spa_assert(ctx->got_port_info[1][0] == true);
|
spa_assert_se(ctx->got_port_info[1][0] == true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +181,7 @@ static int test_set_in_format(struct context *ctx)
|
||||||
|
|
||||||
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_INPUT, 0,
|
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_INPUT, 0,
|
||||||
SPA_PARAM_Format, 0, param);
|
SPA_PARAM_Format, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +225,7 @@ static int test_split_setup1(struct context *ctx)
|
||||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
||||||
|
|
||||||
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
spa_hook_remove(&listener);
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
|
|
@ -269,7 +269,7 @@ static int test_split_setup2(struct context *ctx)
|
||||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
||||||
|
|
||||||
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
spa_hook_remove(&listener);
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
|
|
@ -300,7 +300,7 @@ static int test_convert_setup1(struct context *ctx)
|
||||||
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_convert));
|
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_convert));
|
||||||
|
|
||||||
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
spa_hook_remove(&listener);
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
|
|
@ -331,7 +331,7 @@ static int test_set_out_format(struct context *ctx)
|
||||||
|
|
||||||
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_OUTPUT, 0,
|
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_OUTPUT, 0,
|
||||||
SPA_PARAM_Format, 0, param);
|
SPA_PARAM_Format, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -375,7 +375,7 @@ static int test_merge_setup1(struct context *ctx)
|
||||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
||||||
|
|
||||||
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
spa_hook_remove(&listener);
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
|
|
@ -403,7 +403,7 @@ static int test_set_out_format2(struct context *ctx)
|
||||||
|
|
||||||
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_OUTPUT, 0,
|
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_OUTPUT, 0,
|
||||||
SPA_PARAM_Format, 0, param);
|
SPA_PARAM_Format, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -445,7 +445,7 @@ static int test_merge_setup2(struct context *ctx)
|
||||||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
|
||||||
|
|
||||||
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
spa_hook_remove(&listener);
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
|
|
@ -476,7 +476,7 @@ static int test_convert_setup2(struct context *ctx)
|
||||||
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_convert));
|
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_convert));
|
||||||
|
|
||||||
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
res = spa_node_set_param(ctx->convert_node, SPA_PARAM_PortConfig, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
spa_hook_remove(&listener);
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
|
|
@ -505,7 +505,7 @@ static int test_set_in_format2(struct context *ctx)
|
||||||
|
|
||||||
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_INPUT, 0,
|
res = spa_node_port_set_param(ctx->convert_node, SPA_DIRECTION_INPUT, 0,
|
||||||
SPA_PARAM_Format, 0, param);
|
SPA_PARAM_Format, 0, param);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ static void dump_matrix(struct channelmix *mix, float *coeff)
|
||||||
for (j = 0; j < mix->src_chan; j++) {
|
for (j = 0; j < mix->src_chan; j++) {
|
||||||
float v = mix->matrix_orig[i][j];
|
float v = mix->matrix_orig[i][j];
|
||||||
spa_log_debug(mix->log, "%d %d: %f <-> %f", i, j, v, *coeff);
|
spa_log_debug(mix->log, "%d %d: %f <-> %f", i, j, v, *coeff);
|
||||||
spa_assert(fabs(v - *coeff) < 0.000001);
|
spa_assert_se(fabs(v - *coeff) < 0.000001);
|
||||||
coeff++;
|
coeff++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ static void compare_mem(int i, int j, const void *m1, const void *m2, size_t siz
|
||||||
spa_debug_mem(0, m1, size);
|
spa_debug_mem(0, m1, size);
|
||||||
spa_debug_mem(0, m2, size);
|
spa_debug_mem(0, m2, size);
|
||||||
}
|
}
|
||||||
// spa_assert(res == 0);
|
// spa_assert_se(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void run_test(const char *name,
|
static void run_test(const char *name,
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ static void pull_blocks(struct resample *r, uint32_t first, uint32_t size)
|
||||||
in_len, pin_len, out_len, pout_len,
|
in_len, pin_len, out_len, pout_len,
|
||||||
resample_in_len(r, size));
|
resample_in_len(r, size));
|
||||||
|
|
||||||
spa_assert(in_len == pin_len);
|
spa_assert_se(in_len == pin_len);
|
||||||
spa_assert(out_len == pout_len);
|
spa_assert_se(out_len == pout_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,16 +38,16 @@ static void test_create(struct pw_protocol_native_connection *conn)
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = pw_protocol_native_connection_get_next(conn, &msg);
|
res = pw_protocol_native_connection_get_next(conn, &msg);
|
||||||
spa_assert(res != 1);
|
spa_assert_se(res != 1);
|
||||||
|
|
||||||
res = pw_protocol_native_connection_get_fd(conn, 0);
|
res = pw_protocol_native_connection_get_fd(conn, 0);
|
||||||
spa_assert(res == -ENOENT);
|
spa_assert_se(res == -ENOENT);
|
||||||
|
|
||||||
res = pw_protocol_native_connection_flush(conn);
|
res = pw_protocol_native_connection_flush(conn);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
|
|
||||||
res = pw_protocol_native_connection_clear(conn);
|
res = pw_protocol_native_connection_clear(conn);
|
||||||
spa_assert(res == 0);
|
spa_assert_se(res == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_message(struct pw_protocol_native_connection *conn, int fd)
|
static void write_message(struct pw_protocol_native_connection *conn, int fd)
|
||||||
|
|
@ -57,8 +57,8 @@ static void write_message(struct pw_protocol_native_connection *conn, int fd)
|
||||||
int seq = -1, res;
|
int seq = -1, res;
|
||||||
|
|
||||||
b = pw_protocol_native_connection_begin(conn, 1, 5, &msg);
|
b = pw_protocol_native_connection_begin(conn, 1, 5, &msg);
|
||||||
spa_assert(b != NULL);
|
spa_assert_se(b != NULL);
|
||||||
spa_assert(msg->seq != -1);
|
spa_assert_se(msg->seq != -1);
|
||||||
|
|
||||||
seq = SPA_RESULT_RETURN_ASYNC(msg->seq);
|
seq = SPA_RESULT_RETURN_ASYNC(msg->seq);
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ static void write_message(struct pw_protocol_native_connection *conn, int fd)
|
||||||
SPA_POD_Int(pw_protocol_native_connection_add_fd(conn, fd)));
|
SPA_POD_Int(pw_protocol_native_connection_add_fd(conn, fd)));
|
||||||
|
|
||||||
res = pw_protocol_native_connection_end(conn, b);
|
res = pw_protocol_native_connection_end(conn, b);
|
||||||
spa_assert(seq == res);
|
spa_assert_se(seq == res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_message(struct pw_protocol_native_connection *conn,
|
static int read_message(struct pw_protocol_native_connection *conn,
|
||||||
|
|
@ -88,10 +88,10 @@ static int read_message(struct pw_protocol_native_connection *conn,
|
||||||
if (pmsg)
|
if (pmsg)
|
||||||
*pmsg = msg;
|
*pmsg = msg;
|
||||||
|
|
||||||
spa_assert(msg->opcode == 5);
|
spa_assert_se(msg->opcode == 5);
|
||||||
spa_assert(msg->id == 1);
|
spa_assert_se(msg->id == 1);
|
||||||
spa_assert(msg->data != NULL);
|
spa_assert_se(msg->data != NULL);
|
||||||
spa_assert(msg->size > 0);
|
spa_assert_se(msg->size > 0);
|
||||||
|
|
||||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||||
if (spa_pod_parser_get_struct(&prs,
|
if (spa_pod_parser_get_struct(&prs,
|
||||||
|
|
@ -101,7 +101,7 @@ static int read_message(struct pw_protocol_native_connection *conn,
|
||||||
spa_assert_not_reached();
|
spa_assert_not_reached();
|
||||||
|
|
||||||
fd = pw_protocol_native_connection_get_fd(conn, fdidx);
|
fd = pw_protocol_native_connection_get_fd(conn, fdidx);
|
||||||
spa_assert(fd != -ENOENT);
|
spa_assert_se(fd != -ENOENT);
|
||||||
pw_log_debug("got fd %d %d", fdidx, fd);
|
pw_log_debug("got fd %d %d", fdidx, fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -113,16 +113,16 @@ static void test_read_write(struct pw_protocol_native_connection *in,
|
||||||
pw_protocol_native_connection_flush(out);
|
pw_protocol_native_connection_flush(out);
|
||||||
write_message(out, 2);
|
write_message(out, 2);
|
||||||
pw_protocol_native_connection_flush(out);
|
pw_protocol_native_connection_flush(out);
|
||||||
spa_assert(read_message(in, NULL) == 0);
|
spa_assert_se(read_message(in, NULL) == 0);
|
||||||
spa_assert(read_message(in, NULL) == 0);
|
spa_assert_se(read_message(in, NULL) == 0);
|
||||||
spa_assert(read_message(in, NULL) == -1);
|
spa_assert_se(read_message(in, NULL) == -1);
|
||||||
|
|
||||||
write_message(out, 1);
|
write_message(out, 1);
|
||||||
write_message(out, 2);
|
write_message(out, 2);
|
||||||
pw_protocol_native_connection_flush(out);
|
pw_protocol_native_connection_flush(out);
|
||||||
spa_assert(read_message(in, NULL) == 0);
|
spa_assert_se(read_message(in, NULL) == 0);
|
||||||
spa_assert(read_message(in, NULL) == 0);
|
spa_assert_se(read_message(in, NULL) == 0);
|
||||||
spa_assert(read_message(in, NULL) == -1);
|
spa_assert_se(read_message(in, NULL) == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_reentering(struct pw_protocol_native_connection *in,
|
static void test_reentering(struct pw_protocol_native_connection *in,
|
||||||
|
|
@ -132,16 +132,16 @@ static void test_reentering(struct pw_protocol_native_connection *in,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#define READ_MSG(idx) \
|
#define READ_MSG(idx) \
|
||||||
spa_assert(read_message(in, &msg ## idx) == 0); \
|
spa_assert_se(read_message(in, &msg ## idx) == 0); \
|
||||||
spa_assert((msg ## idx)->n_fds == 1); \
|
spa_assert_se((msg ## idx)->n_fds == 1); \
|
||||||
spa_assert((msg ## idx)->size < sizeof(buf ## idx)); \
|
spa_assert_se((msg ## idx)->size < sizeof(buf ## idx)); \
|
||||||
fd ## idx = (msg ## idx)->fds[0]; \
|
fd ## idx = (msg ## idx)->fds[0]; \
|
||||||
memcpy(buf ## idx, (msg ## idx)->data, (msg ## idx)->size); \
|
memcpy(buf ## idx, (msg ## idx)->data, (msg ## idx)->size); \
|
||||||
size ## idx = (msg ## idx)->size
|
size ## idx = (msg ## idx)->size
|
||||||
|
|
||||||
#define CHECK_MSG(idx) \
|
#define CHECK_MSG(idx) \
|
||||||
spa_assert((msg ## idx)->fds[0] == fd ## idx); \
|
spa_assert_se((msg ## idx)->fds[0] == fd ## idx); \
|
||||||
spa_assert(memcmp((msg ## idx)->data, buf ## idx, size ## idx) == 0)
|
spa_assert_se(memcmp((msg ## idx)->data, buf ## idx, size ## idx) == 0)
|
||||||
|
|
||||||
for (i = 0; i < 50; ++i) {
|
for (i = 0; i < 50; ++i) {
|
||||||
int fd1, fd2;
|
int fd1, fd2;
|
||||||
|
|
@ -165,16 +165,16 @@ static void test_reentering(struct pw_protocol_native_connection *in,
|
||||||
CHECK_MSG(2);
|
CHECK_MSG(2);
|
||||||
pw_protocol_native_connection_enter(in); /* 2 */
|
pw_protocol_native_connection_enter(in); /* 2 */
|
||||||
pw_protocol_native_connection_enter(in); /* 3 */
|
pw_protocol_native_connection_enter(in); /* 3 */
|
||||||
spa_assert(read_message(in, NULL) == 0);
|
spa_assert_se(read_message(in, NULL) == 0);
|
||||||
CHECK_MSG(1);
|
CHECK_MSG(1);
|
||||||
CHECK_MSG(2);
|
CHECK_MSG(2);
|
||||||
pw_protocol_native_connection_leave(in); /* 3 */
|
pw_protocol_native_connection_leave(in); /* 3 */
|
||||||
spa_assert(read_message(in, NULL) == 0);
|
spa_assert_se(read_message(in, NULL) == 0);
|
||||||
CHECK_MSG(1);
|
CHECK_MSG(1);
|
||||||
CHECK_MSG(2);
|
CHECK_MSG(2);
|
||||||
pw_protocol_native_connection_leave(in); /* 2 */
|
pw_protocol_native_connection_leave(in); /* 2 */
|
||||||
CHECK_MSG(2);
|
CHECK_MSG(2);
|
||||||
spa_assert(read_message(in, NULL) == 0);
|
spa_assert_se(read_message(in, NULL) == 0);
|
||||||
CHECK_MSG(1);
|
CHECK_MSG(1);
|
||||||
pw_protocol_native_connection_leave(in); /* 1 */
|
pw_protocol_native_connection_leave(in); /* 1 */
|
||||||
CHECK_MSG(1);
|
CHECK_MSG(1);
|
||||||
|
|
@ -199,9 +199,9 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
in = pw_protocol_native_connection_new(context, fds[0]);
|
in = pw_protocol_native_connection_new(context, fds[0]);
|
||||||
spa_assert(in != NULL);
|
spa_assert_se(in != NULL);
|
||||||
out = pw_protocol_native_connection_new(context, fds[1]);
|
out = pw_protocol_native_connection_new(context, fds[1]);
|
||||||
spa_assert(out != NULL);
|
spa_assert_se(out != NULL);
|
||||||
|
|
||||||
test_create(in);
|
test_create(in);
|
||||||
test_create(out);
|
test_create(out);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#define TEST_FUNC(a,b,func) \
|
#define TEST_FUNC(a,b,func) \
|
||||||
do { \
|
do { \
|
||||||
a.func = b.func; \
|
a.func = b.func; \
|
||||||
spa_assert(SPA_PTRDIFF(&a.func, &a) == SPA_PTRDIFF(&b.func, &b)); \
|
spa_assert_se(SPA_PTRDIFF(&a.func, &a) == SPA_PTRDIFF(&b.func, &b)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
static void test_abi(void)
|
static void test_abi(void)
|
||||||
|
|
@ -54,8 +54,8 @@ static void test_abi(void)
|
||||||
TEST_FUNC(ev, test, resource_removed);
|
TEST_FUNC(ev, test, resource_removed);
|
||||||
TEST_FUNC(ev, test, busy_changed);
|
TEST_FUNC(ev, test, busy_changed);
|
||||||
|
|
||||||
spa_assert(PW_VERSION_IMPL_CLIENT_EVENTS == 0);
|
spa_assert_se(PW_VERSION_IMPL_CLIENT_EVENTS == 0);
|
||||||
spa_assert(sizeof(ev) == sizeof(test));
|
spa_assert_se(sizeof(ev) == sizeof(test));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
|
||||||
|
|
@ -272,27 +272,27 @@ endpoint_event_info(void *object, const struct pw_endpoint_info *info)
|
||||||
struct test_endpoint_data *d = object;
|
struct test_endpoint_data *d = object;
|
||||||
const char *val;
|
const char *val;
|
||||||
|
|
||||||
spa_assert(info);
|
spa_assert_se(info);
|
||||||
spa_assert(info->version == PW_VERSION_ENDPOINT_INFO);
|
spa_assert_se(info->version == PW_VERSION_ENDPOINT_INFO);
|
||||||
spa_assert(info->id == pw_proxy_get_bound_id(d->bound_proxy));
|
spa_assert_se(info->id == pw_proxy_get_bound_id(d->bound_proxy));
|
||||||
spa_assert(info->id == pw_proxy_get_bound_id(d->export_proxy));
|
spa_assert_se(info->id == pw_proxy_get_bound_id(d->export_proxy));
|
||||||
spa_assert(info->change_mask == PW_ENDPOINT_CHANGE_MASK_ALL);
|
spa_assert_se(info->change_mask == PW_ENDPOINT_CHANGE_MASK_ALL);
|
||||||
spa_assert(spa_streq(info->name, "test-endpoint"));
|
spa_assert_se(spa_streq(info->name, "test-endpoint"));
|
||||||
spa_assert(spa_streq(info->media_class, "Audio/Sink"));
|
spa_assert_se(spa_streq(info->media_class, "Audio/Sink"));
|
||||||
spa_assert(info->direction == PW_DIRECTION_OUTPUT);
|
spa_assert_se(info->direction == PW_DIRECTION_OUTPUT);
|
||||||
spa_assert(info->n_streams == 0);
|
spa_assert_se(info->n_streams == 0);
|
||||||
spa_assert(info->session_id == SPA_ID_INVALID);
|
spa_assert_se(info->session_id == SPA_ID_INVALID);
|
||||||
spa_assert(info->n_params == SPA_N_ELEMENTS (param_info));
|
spa_assert_se(info->n_params == SPA_N_ELEMENTS (param_info));
|
||||||
spa_assert(info->n_params == 2);
|
spa_assert_se(info->n_params == 2);
|
||||||
spa_assert(info->params[0].id == param_info[0].id);
|
spa_assert_se(info->params[0].id == param_info[0].id);
|
||||||
spa_assert(info->params[0].flags == param_info[0].flags);
|
spa_assert_se(info->params[0].flags == param_info[0].flags);
|
||||||
spa_assert(info->params[1].id == param_info[1].id);
|
spa_assert_se(info->params[1].id == param_info[1].id);
|
||||||
spa_assert(info->params[1].flags == param_info[1].flags);
|
spa_assert_se(info->params[1].flags == param_info[1].flags);
|
||||||
spa_assert(info->props != NULL);
|
spa_assert_se(info->props != NULL);
|
||||||
val = spa_dict_lookup(info->props, PW_KEY_ENDPOINT_NAME);
|
val = spa_dict_lookup(info->props, PW_KEY_ENDPOINT_NAME);
|
||||||
spa_assert(val && spa_streq(val, "test-endpoint"));
|
spa_assert_se(val && spa_streq(val, "test-endpoint"));
|
||||||
val = spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS);
|
val = spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS);
|
||||||
spa_assert(val && spa_streq(val, "Audio/Sink"));
|
spa_assert_se(val && spa_streq(val, "Audio/Sink"));
|
||||||
|
|
||||||
d->info_received = true;
|
d->info_received = true;
|
||||||
pw_main_loop_quit(d->loop);
|
pw_main_loop_quit(d->loop);
|
||||||
|
|
@ -307,12 +307,12 @@ endpoint_event_param(void *object, int seq,
|
||||||
|
|
||||||
if (id == SPA_PARAM_Props) {
|
if (id == SPA_PARAM_Props) {
|
||||||
struct props *p = &d->props;
|
struct props *p = &d->props;
|
||||||
spa_assert(param);
|
spa_assert_se(param);
|
||||||
spa_pod_parse_object(param,
|
spa_pod_parse_object(param,
|
||||||
SPA_TYPE_OBJECT_Props, &id,
|
SPA_TYPE_OBJECT_Props, &id,
|
||||||
SPA_PROP_volume, SPA_POD_OPT_Float(&p->volume),
|
SPA_PROP_volume, SPA_POD_OPT_Float(&p->volume),
|
||||||
SPA_PROP_mute, SPA_POD_OPT_Bool(&p->mute));
|
SPA_PROP_mute, SPA_POD_OPT_Bool(&p->mute));
|
||||||
spa_assert(id == SPA_PARAM_Props);
|
spa_assert_se(id == SPA_PARAM_Props);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->params_received++;
|
d->params_received++;
|
||||||
|
|
@ -351,13 +351,13 @@ test_endpoint_global(void *object, uint32_t id,
|
||||||
|
|
||||||
d->bound_proxy = pw_registry_bind(d->registry, id, type,
|
d->bound_proxy = pw_registry_bind(d->registry, id, type,
|
||||||
PW_VERSION_ENDPOINT, 0);
|
PW_VERSION_ENDPOINT, 0);
|
||||||
spa_assert(d->bound_proxy != NULL);
|
spa_assert_se(d->bound_proxy != NULL);
|
||||||
|
|
||||||
spa_assert(props != NULL);
|
spa_assert_se(props != NULL);
|
||||||
val = spa_dict_lookup(props, PW_KEY_ENDPOINT_NAME);
|
val = spa_dict_lookup(props, PW_KEY_ENDPOINT_NAME);
|
||||||
spa_assert(val && spa_streq(val, "test-endpoint"));
|
spa_assert_se(val && spa_streq(val, "test-endpoint"));
|
||||||
val = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS);
|
val = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS);
|
||||||
spa_assert(val && spa_streq(val, "Audio/Sink"));
|
spa_assert_se(val && spa_streq(val, "Audio/Sink"));
|
||||||
|
|
||||||
pw_endpoint_add_listener(d->bound_proxy, &d->object_listener,
|
pw_endpoint_add_listener(d->bound_proxy, &d->object_listener,
|
||||||
&endpoint_events, d);
|
&endpoint_events, d);
|
||||||
|
|
@ -388,10 +388,10 @@ static void test_endpoint(void)
|
||||||
|
|
||||||
d.loop = pw_main_loop_new(NULL);
|
d.loop = pw_main_loop_new(NULL);
|
||||||
d.context = pw_context_new(pw_main_loop_get_loop(d.loop), NULL, 0);
|
d.context = pw_context_new(pw_main_loop_get_loop(d.loop), NULL, 0);
|
||||||
spa_assert(d.context != NULL);
|
spa_assert_se(d.context != NULL);
|
||||||
|
|
||||||
d.core = pw_context_connect_self(d.context, NULL, 0);
|
d.core = pw_context_connect_self(d.context, NULL, 0);
|
||||||
spa_assert(d.core != NULL);
|
spa_assert_se(d.core != NULL);
|
||||||
|
|
||||||
d.registry = pw_core_get_registry(d.core, PW_VERSION_REGISTRY, 0);
|
d.registry = pw_core_get_registry(d.core, PW_VERSION_REGISTRY, 0);
|
||||||
pw_registry_add_listener(d.registry,
|
pw_registry_add_listener(d.registry,
|
||||||
|
|
@ -403,10 +403,10 @@ static void test_endpoint(void)
|
||||||
endpoint_init(&d.endpoint);
|
endpoint_init(&d.endpoint);
|
||||||
d.export_proxy = pw_core_export(d.core, PW_TYPE_INTERFACE_Endpoint,
|
d.export_proxy = pw_core_export(d.core, PW_TYPE_INTERFACE_Endpoint,
|
||||||
d.endpoint.info.props, &d.endpoint.iface, 0);
|
d.endpoint.info.props, &d.endpoint.iface, 0);
|
||||||
spa_assert(d.export_proxy != NULL);
|
spa_assert_se(d.export_proxy != NULL);
|
||||||
pw_main_loop_run(d.loop);
|
pw_main_loop_run(d.loop);
|
||||||
spa_assert(d.bound_proxy);
|
spa_assert_se(d.bound_proxy);
|
||||||
spa_assert(d.info_received == true);
|
spa_assert_se(d.info_received == true);
|
||||||
|
|
||||||
/* request params */
|
/* request params */
|
||||||
d.params_received = 0;
|
d.params_received = 0;
|
||||||
|
|
@ -414,9 +414,9 @@ static void test_endpoint(void)
|
||||||
d.props.mute = true;
|
d.props.mute = true;
|
||||||
pw_endpoint_subscribe_params(d.bound_proxy, ids, SPA_N_ELEMENTS(ids));
|
pw_endpoint_subscribe_params(d.bound_proxy, ids, SPA_N_ELEMENTS(ids));
|
||||||
pw_main_loop_run(d.loop);
|
pw_main_loop_run(d.loop);
|
||||||
spa_assert(d.params_received == 1);
|
spa_assert_se(d.params_received == 1);
|
||||||
spa_assert(d.props.volume > 0.89 && d.props.volume < 0.91);
|
spa_assert_se(d.props.volume > 0.89 && d.props.volume < 0.91);
|
||||||
spa_assert(d.props.mute == false);
|
spa_assert_se(d.props.mute == false);
|
||||||
|
|
||||||
/* set param from the client */
|
/* set param from the client */
|
||||||
d.params_received = 0;
|
d.params_received = 0;
|
||||||
|
|
@ -425,9 +425,9 @@ static void test_endpoint(void)
|
||||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props,
|
||||||
SPA_PROP_volume, SPA_POD_Float(0.5)));
|
SPA_PROP_volume, SPA_POD_Float(0.5)));
|
||||||
pw_main_loop_run(d.loop);
|
pw_main_loop_run(d.loop);
|
||||||
spa_assert(d.params_received == 1);
|
spa_assert_se(d.params_received == 1);
|
||||||
spa_assert(d.props.volume > 0.49 && d.props.volume < 0.51);
|
spa_assert_se(d.props.volume > 0.49 && d.props.volume < 0.51);
|
||||||
spa_assert(d.props.mute == false);
|
spa_assert_se(d.props.mute == false);
|
||||||
|
|
||||||
/* set param from the impl */
|
/* set param from the impl */
|
||||||
d.params_received = 0;
|
d.params_received = 0;
|
||||||
|
|
@ -437,14 +437,14 @@ static void test_endpoint(void)
|
||||||
SPA_PROP_volume, SPA_POD_Float(0.2),
|
SPA_PROP_volume, SPA_POD_Float(0.2),
|
||||||
SPA_PROP_mute, SPA_POD_Bool(true)));
|
SPA_PROP_mute, SPA_POD_Bool(true)));
|
||||||
pw_main_loop_run(d.loop);
|
pw_main_loop_run(d.loop);
|
||||||
spa_assert(d.params_received == 1);
|
spa_assert_se(d.params_received == 1);
|
||||||
spa_assert(d.props.volume > 0.19 && d.props.volume < 0.21);
|
spa_assert_se(d.props.volume > 0.19 && d.props.volume < 0.21);
|
||||||
spa_assert(d.props.mute == true);
|
spa_assert_se(d.props.mute == true);
|
||||||
|
|
||||||
/* stop exporting and expect to see that reflected on the registry */
|
/* stop exporting and expect to see that reflected on the registry */
|
||||||
pw_proxy_destroy(d.export_proxy);
|
pw_proxy_destroy(d.export_proxy);
|
||||||
pw_main_loop_run(d.loop);
|
pw_main_loop_run(d.loop);
|
||||||
spa_assert(!d.bound_proxy);
|
spa_assert_se(!d.bound_proxy);
|
||||||
|
|
||||||
endpoint_clear(&d.endpoint);
|
endpoint_clear(&d.endpoint);
|
||||||
pw_proxy_destroy((struct pw_proxy*)d.registry);
|
pw_proxy_destroy((struct pw_proxy*)d.registry);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#define TEST_FUNC(a,b,func) \
|
#define TEST_FUNC(a,b,func) \
|
||||||
do { \
|
do { \
|
||||||
a.func = b.func; \
|
a.func = b.func; \
|
||||||
spa_assert(SPA_PTRDIFF(&a.func, &a) == SPA_PTRDIFF(&b.func, &b)); \
|
spa_assert_se(SPA_PTRDIFF(&a.func, &a) == SPA_PTRDIFF(&b.func, &b)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
static void test_core_abi(void)
|
static void test_core_abi(void)
|
||||||
|
|
@ -76,8 +76,8 @@ static void test_core_abi(void)
|
||||||
TEST_FUNC(m, methods, get_registry);
|
TEST_FUNC(m, methods, get_registry);
|
||||||
TEST_FUNC(m, methods, create_object);
|
TEST_FUNC(m, methods, create_object);
|
||||||
TEST_FUNC(m, methods, destroy);
|
TEST_FUNC(m, methods, destroy);
|
||||||
spa_assert(PW_VERSION_CORE_METHODS == 0);
|
spa_assert_se(PW_VERSION_CORE_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
|
|
@ -88,8 +88,8 @@ static void test_core_abi(void)
|
||||||
TEST_FUNC(e, events, bound_id);
|
TEST_FUNC(e, events, bound_id);
|
||||||
TEST_FUNC(e, events, add_mem);
|
TEST_FUNC(e, events, add_mem);
|
||||||
TEST_FUNC(e, events, remove_mem);
|
TEST_FUNC(e, events, remove_mem);
|
||||||
spa_assert(PW_VERSION_CORE_EVENTS == 0);
|
spa_assert_se(PW_VERSION_CORE_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_registry_abi(void)
|
static void test_registry_abi(void)
|
||||||
|
|
@ -118,14 +118,14 @@ static void test_registry_abi(void)
|
||||||
TEST_FUNC(m, methods, add_listener);
|
TEST_FUNC(m, methods, add_listener);
|
||||||
TEST_FUNC(m, methods, bind);
|
TEST_FUNC(m, methods, bind);
|
||||||
TEST_FUNC(m, methods, destroy);
|
TEST_FUNC(m, methods, destroy);
|
||||||
spa_assert(PW_VERSION_REGISTRY_METHODS == 0);
|
spa_assert_se(PW_VERSION_REGISTRY_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, global);
|
TEST_FUNC(e, events, global);
|
||||||
TEST_FUNC(e, events, global_remove);
|
TEST_FUNC(e, events, global_remove);
|
||||||
spa_assert(PW_VERSION_REGISTRY_EVENTS == 0);
|
spa_assert_se(PW_VERSION_REGISTRY_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_module_abi(void)
|
static void test_module_abi(void)
|
||||||
|
|
@ -146,13 +146,13 @@ static void test_module_abi(void)
|
||||||
|
|
||||||
TEST_FUNC(m, methods, version);
|
TEST_FUNC(m, methods, version);
|
||||||
TEST_FUNC(m, methods, add_listener);
|
TEST_FUNC(m, methods, add_listener);
|
||||||
spa_assert(PW_VERSION_MODULE_METHODS == 0);
|
spa_assert_se(PW_VERSION_MODULE_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
spa_assert(PW_VERSION_MODULE_EVENTS == 0);
|
spa_assert_se(PW_VERSION_MODULE_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_device_abi(void)
|
static void test_device_abi(void)
|
||||||
|
|
@ -185,14 +185,14 @@ static void test_device_abi(void)
|
||||||
TEST_FUNC(m, methods, subscribe_params);
|
TEST_FUNC(m, methods, subscribe_params);
|
||||||
TEST_FUNC(m, methods, enum_params);
|
TEST_FUNC(m, methods, enum_params);
|
||||||
TEST_FUNC(m, methods, set_param);
|
TEST_FUNC(m, methods, set_param);
|
||||||
spa_assert(PW_VERSION_DEVICE_METHODS == 0);
|
spa_assert_se(PW_VERSION_DEVICE_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
TEST_FUNC(e, events, param);
|
TEST_FUNC(e, events, param);
|
||||||
spa_assert(PW_VERSION_DEVICE_EVENTS == 0);
|
spa_assert_se(PW_VERSION_DEVICE_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_node_abi(void)
|
static void test_node_abi(void)
|
||||||
|
|
@ -226,14 +226,14 @@ static void test_node_abi(void)
|
||||||
TEST_FUNC(m, methods, enum_params);
|
TEST_FUNC(m, methods, enum_params);
|
||||||
TEST_FUNC(m, methods, set_param);
|
TEST_FUNC(m, methods, set_param);
|
||||||
TEST_FUNC(m, methods, send_command);
|
TEST_FUNC(m, methods, send_command);
|
||||||
spa_assert(PW_VERSION_NODE_METHODS == 0);
|
spa_assert_se(PW_VERSION_NODE_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
TEST_FUNC(e, events, param);
|
TEST_FUNC(e, events, param);
|
||||||
spa_assert(PW_VERSION_NODE_EVENTS == 0);
|
spa_assert_se(PW_VERSION_NODE_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_port_abi(void)
|
static void test_port_abi(void)
|
||||||
|
|
@ -261,14 +261,14 @@ static void test_port_abi(void)
|
||||||
TEST_FUNC(m, methods, version);
|
TEST_FUNC(m, methods, version);
|
||||||
TEST_FUNC(m, methods, add_listener);
|
TEST_FUNC(m, methods, add_listener);
|
||||||
TEST_FUNC(m, methods, enum_params);
|
TEST_FUNC(m, methods, enum_params);
|
||||||
spa_assert(PW_VERSION_PORT_METHODS == 0);
|
spa_assert_se(PW_VERSION_PORT_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
TEST_FUNC(e, events, param);
|
TEST_FUNC(e, events, param);
|
||||||
spa_assert(PW_VERSION_PORT_EVENTS == 0);
|
spa_assert_se(PW_VERSION_PORT_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_factory_abi(void)
|
static void test_factory_abi(void)
|
||||||
|
|
@ -289,13 +289,13 @@ static void test_factory_abi(void)
|
||||||
|
|
||||||
TEST_FUNC(m, methods, version);
|
TEST_FUNC(m, methods, version);
|
||||||
TEST_FUNC(m, methods, add_listener);
|
TEST_FUNC(m, methods, add_listener);
|
||||||
spa_assert(PW_VERSION_FACTORY_METHODS == 0);
|
spa_assert_se(PW_VERSION_FACTORY_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
spa_assert(PW_VERSION_FACTORY_EVENTS == 0);
|
spa_assert_se(PW_VERSION_FACTORY_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_client_abi(void)
|
static void test_client_abi(void)
|
||||||
|
|
@ -327,14 +327,14 @@ static void test_client_abi(void)
|
||||||
TEST_FUNC(m, methods, update_properties);
|
TEST_FUNC(m, methods, update_properties);
|
||||||
TEST_FUNC(m, methods, get_permissions);
|
TEST_FUNC(m, methods, get_permissions);
|
||||||
TEST_FUNC(m, methods, update_permissions);
|
TEST_FUNC(m, methods, update_permissions);
|
||||||
spa_assert(PW_VERSION_CLIENT_METHODS == 0);
|
spa_assert_se(PW_VERSION_CLIENT_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
TEST_FUNC(e, events, permissions);
|
TEST_FUNC(e, events, permissions);
|
||||||
spa_assert(PW_VERSION_CLIENT_EVENTS == 0);
|
spa_assert_se(PW_VERSION_CLIENT_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_link_abi(void)
|
static void test_link_abi(void)
|
||||||
|
|
@ -355,13 +355,13 @@ static void test_link_abi(void)
|
||||||
|
|
||||||
TEST_FUNC(m, methods, version);
|
TEST_FUNC(m, methods, version);
|
||||||
TEST_FUNC(m, methods, add_listener);
|
TEST_FUNC(m, methods, add_listener);
|
||||||
spa_assert(PW_VERSION_LINK_METHODS == 0);
|
spa_assert_se(PW_VERSION_LINK_METHODS == 0);
|
||||||
spa_assert(sizeof(m) == sizeof(methods));
|
spa_assert_se(sizeof(m) == sizeof(methods));
|
||||||
|
|
||||||
TEST_FUNC(e, events, version);
|
TEST_FUNC(e, events, version);
|
||||||
TEST_FUNC(e, events, info);
|
TEST_FUNC(e, events, info);
|
||||||
spa_assert(PW_VERSION_LINK_EVENTS == 0);
|
spa_assert_se(PW_VERSION_LINK_EVENTS == 0);
|
||||||
spa_assert(sizeof(e) == sizeof(events));
|
spa_assert_se(sizeof(e) == sizeof(events));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#define TEST_FUNC(a,b,func) \
|
#define TEST_FUNC(a,b,func) \
|
||||||
do { \
|
do { \
|
||||||
a.func = b.func; \
|
a.func = b.func; \
|
||||||
spa_assert(SPA_PTRDIFF(&a.func, &a) == SPA_PTRDIFF(&b.func, &b)); \
|
spa_assert_se(SPA_PTRDIFF(&a.func, &a) == SPA_PTRDIFF(&b.func, &b)); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
static void test_abi(void)
|
static void test_abi(void)
|
||||||
|
|
@ -63,27 +63,27 @@ static void test_abi(void)
|
||||||
TEST_FUNC(ev, test, drained);
|
TEST_FUNC(ev, test, drained);
|
||||||
|
|
||||||
#if defined(__x86_64__) && defined(__LP64__)
|
#if defined(__x86_64__) && defined(__LP64__)
|
||||||
spa_assert(sizeof(struct pw_buffer) == 24);
|
spa_assert_se(sizeof(struct pw_buffer) == 24);
|
||||||
spa_assert(sizeof(struct pw_time) == 40);
|
spa_assert_se(sizeof(struct pw_time) == 40);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "%zd\n", sizeof(struct pw_buffer));
|
fprintf(stderr, "%zd\n", sizeof(struct pw_buffer));
|
||||||
fprintf(stderr, "%zd\n", sizeof(struct pw_time));
|
fprintf(stderr, "%zd\n", sizeof(struct pw_time));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spa_assert(PW_VERSION_STREAM_EVENTS == 0);
|
spa_assert_se(PW_VERSION_STREAM_EVENTS == 0);
|
||||||
spa_assert(sizeof(ev) == sizeof(test));
|
spa_assert_se(sizeof(ev) == sizeof(test));
|
||||||
|
|
||||||
spa_assert(PW_STREAM_STATE_ERROR == -1);
|
spa_assert_se(PW_STREAM_STATE_ERROR == -1);
|
||||||
spa_assert(PW_STREAM_STATE_UNCONNECTED == 0);
|
spa_assert_se(PW_STREAM_STATE_UNCONNECTED == 0);
|
||||||
spa_assert(PW_STREAM_STATE_CONNECTING == 1);
|
spa_assert_se(PW_STREAM_STATE_CONNECTING == 1);
|
||||||
spa_assert(PW_STREAM_STATE_PAUSED == 2);
|
spa_assert_se(PW_STREAM_STATE_PAUSED == 2);
|
||||||
spa_assert(PW_STREAM_STATE_STREAMING == 3);
|
spa_assert_se(PW_STREAM_STATE_STREAMING == 3);
|
||||||
|
|
||||||
spa_assert(pw_stream_state_as_string(PW_STREAM_STATE_ERROR) != NULL);
|
spa_assert_se(pw_stream_state_as_string(PW_STREAM_STATE_ERROR) != NULL);
|
||||||
spa_assert(pw_stream_state_as_string(PW_STREAM_STATE_UNCONNECTED) != NULL);
|
spa_assert_se(pw_stream_state_as_string(PW_STREAM_STATE_UNCONNECTED) != NULL);
|
||||||
spa_assert(pw_stream_state_as_string(PW_STREAM_STATE_CONNECTING) != NULL);
|
spa_assert_se(pw_stream_state_as_string(PW_STREAM_STATE_CONNECTING) != NULL);
|
||||||
spa_assert(pw_stream_state_as_string(PW_STREAM_STATE_PAUSED) != NULL);
|
spa_assert_se(pw_stream_state_as_string(PW_STREAM_STATE_PAUSED) != NULL);
|
||||||
spa_assert(pw_stream_state_as_string(PW_STREAM_STATE_STREAMING) != NULL);
|
spa_assert_se(pw_stream_state_as_string(PW_STREAM_STATE_STREAMING) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stream_destroy_error(void *data)
|
static void stream_destroy_error(void *data)
|
||||||
|
|
@ -151,37 +151,37 @@ static void test_create(void)
|
||||||
|
|
||||||
loop = pw_main_loop_new(NULL);
|
loop = pw_main_loop_new(NULL);
|
||||||
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 12);
|
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 12);
|
||||||
spa_assert(context != NULL);
|
spa_assert_se(context != NULL);
|
||||||
core = pw_context_connect_self(context, NULL, 0);
|
core = pw_context_connect_self(context, NULL, 0);
|
||||||
spa_assert(core != NULL);
|
spa_assert_se(core != NULL);
|
||||||
stream = pw_stream_new(core, "test", NULL);
|
stream = pw_stream_new(core, "test", NULL);
|
||||||
spa_assert(stream != NULL);
|
spa_assert_se(stream != NULL);
|
||||||
pw_stream_add_listener(stream, &listener, &stream_events, stream);
|
pw_stream_add_listener(stream, &listener, &stream_events, stream);
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
spa_assert(pw_stream_get_state(stream, &error) == PW_STREAM_STATE_UNCONNECTED);
|
spa_assert_se(pw_stream_get_state(stream, &error) == PW_STREAM_STATE_UNCONNECTED);
|
||||||
spa_assert(error == NULL);
|
spa_assert_se(error == NULL);
|
||||||
/* check name */
|
/* check name */
|
||||||
spa_assert(spa_streq(pw_stream_get_name(stream), "test"));
|
spa_assert_se(spa_streq(pw_stream_get_name(stream), "test"));
|
||||||
|
|
||||||
/* check id, only when connected */
|
/* check id, only when connected */
|
||||||
spa_assert(pw_stream_get_node_id(stream) == SPA_ID_INVALID);
|
spa_assert_se(pw_stream_get_node_id(stream) == SPA_ID_INVALID);
|
||||||
|
|
||||||
spa_assert(pw_stream_get_time(stream, &tm) == 0);
|
spa_assert_se(pw_stream_get_time(stream, &tm) == 0);
|
||||||
spa_assert(tm.now == 0);
|
spa_assert_se(tm.now == 0);
|
||||||
spa_assert(tm.rate.num == 0);
|
spa_assert_se(tm.rate.num == 0);
|
||||||
spa_assert(tm.rate.denom == 0);
|
spa_assert_se(tm.rate.denom == 0);
|
||||||
spa_assert(tm.ticks == 0);
|
spa_assert_se(tm.ticks == 0);
|
||||||
spa_assert(tm.delay == 0);
|
spa_assert_se(tm.delay == 0);
|
||||||
spa_assert(tm.queued == 0);
|
spa_assert_se(tm.queued == 0);
|
||||||
|
|
||||||
spa_assert(pw_stream_dequeue_buffer(stream) == NULL);
|
spa_assert_se(pw_stream_dequeue_buffer(stream) == NULL);
|
||||||
|
|
||||||
/* check destroy */
|
/* check destroy */
|
||||||
destroy_count = 0;
|
destroy_count = 0;
|
||||||
stream_events.destroy = stream_destroy_count;
|
stream_events.destroy = stream_destroy_count;
|
||||||
pw_stream_destroy(stream);
|
pw_stream_destroy(stream);
|
||||||
spa_assert(destroy_count == 1);
|
spa_assert_se(destroy_count == 1);
|
||||||
|
|
||||||
pw_context_destroy(context);
|
pw_context_destroy(context);
|
||||||
pw_main_loop_destroy(loop);
|
pw_main_loop_destroy(loop);
|
||||||
|
|
@ -200,21 +200,21 @@ static void test_properties(void)
|
||||||
|
|
||||||
loop = pw_main_loop_new(NULL);
|
loop = pw_main_loop_new(NULL);
|
||||||
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 12);
|
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 12);
|
||||||
spa_assert(context != NULL);
|
spa_assert_se(context != NULL);
|
||||||
core = pw_context_connect_self(context, NULL, 0);
|
core = pw_context_connect_self(context, NULL, 0);
|
||||||
spa_assert(core != NULL);
|
spa_assert_se(core != NULL);
|
||||||
stream = pw_stream_new(core, "test",
|
stream = pw_stream_new(core, "test",
|
||||||
pw_properties_new("foo", "bar",
|
pw_properties_new("foo", "bar",
|
||||||
"biz", "fuzz",
|
"biz", "fuzz",
|
||||||
NULL));
|
NULL));
|
||||||
spa_assert(stream != NULL);
|
spa_assert_se(stream != NULL);
|
||||||
pw_stream_add_listener(stream, &listener, &stream_events, stream);
|
pw_stream_add_listener(stream, &listener, &stream_events, stream);
|
||||||
|
|
||||||
props = pw_stream_get_properties(stream);
|
props = pw_stream_get_properties(stream);
|
||||||
spa_assert(props != NULL);
|
spa_assert_se(props != NULL);
|
||||||
spa_assert(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
spa_assert_se(spa_streq(pw_properties_get(props, "foo"), "bar"));
|
||||||
spa_assert(spa_streq(pw_properties_get(props, "biz"), "fuzz"));
|
spa_assert_se(spa_streq(pw_properties_get(props, "biz"), "fuzz"));
|
||||||
spa_assert(pw_properties_get(props, "buzz") == NULL);
|
spa_assert_se(pw_properties_get(props, "buzz") == NULL);
|
||||||
|
|
||||||
/* remove foo */
|
/* remove foo */
|
||||||
items[0] = SPA_DICT_ITEM_INIT("foo", NULL);
|
items[0] = SPA_DICT_ITEM_INIT("foo", NULL);
|
||||||
|
|
@ -224,16 +224,16 @@ static void test_properties(void)
|
||||||
items[2] = SPA_DICT_ITEM_INIT("buzz", "frizz");
|
items[2] = SPA_DICT_ITEM_INIT("buzz", "frizz");
|
||||||
pw_stream_update_properties(stream, &SPA_DICT_INIT(items, 3));
|
pw_stream_update_properties(stream, &SPA_DICT_INIT(items, 3));
|
||||||
|
|
||||||
spa_assert(props == pw_stream_get_properties(stream));
|
spa_assert_se(props == pw_stream_get_properties(stream));
|
||||||
spa_assert(pw_properties_get(props, "foo") == NULL);
|
spa_assert_se(pw_properties_get(props, "foo") == NULL);
|
||||||
spa_assert(spa_streq(pw_properties_get(props, "biz"), "buzz"));
|
spa_assert_se(spa_streq(pw_properties_get(props, "biz"), "buzz"));
|
||||||
spa_assert(spa_streq(pw_properties_get(props, "buzz"), "frizz"));
|
spa_assert_se(spa_streq(pw_properties_get(props, "buzz"), "frizz"));
|
||||||
|
|
||||||
/* check destroy */
|
/* check destroy */
|
||||||
destroy_count = 0;
|
destroy_count = 0;
|
||||||
stream_events.destroy = stream_destroy_count;
|
stream_events.destroy = stream_destroy_count;
|
||||||
pw_context_destroy(context);
|
pw_context_destroy(context);
|
||||||
spa_assert(destroy_count == 1);
|
spa_assert_se(destroy_count == 1);
|
||||||
|
|
||||||
pw_main_loop_destroy(loop);
|
pw_main_loop_destroy(loop);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ static void test_abi(void)
|
||||||
{
|
{
|
||||||
pw_destroy_t f;
|
pw_destroy_t f;
|
||||||
f = test_destroy;
|
f = test_destroy;
|
||||||
spa_assert(f == test_destroy);
|
spa_assert_se(f == test_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test__pw_split_walk(void)
|
static void test__pw_split_walk(void)
|
||||||
|
|
@ -177,13 +177,13 @@ static void test__pw_split_walk(void)
|
||||||
size_t j = 0, len;
|
size_t j = 0, len;
|
||||||
|
|
||||||
while ((s = pw_split_walk(str, tc->delim, &len, &state)) != NULL && tc->expected[j] != NULL) {
|
while ((s = pw_split_walk(str, tc->delim, &len, &state)) != NULL && tc->expected[j] != NULL) {
|
||||||
spa_assert(strlen(tc->expected[j]) == len);
|
spa_assert_se(strlen(tc->expected[j]) == len);
|
||||||
spa_assert(strncmp(s, tc->expected[j], len) == 0);
|
spa_assert_se(strncmp(s, tc->expected[j], len) == 0);
|
||||||
|
|
||||||
j += 1;
|
j += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_assert(s == NULL && tc->expected[j] == NULL);
|
spa_assert_se(s == NULL && tc->expected[j] == NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,20 +195,20 @@ static void test__pw_split_strv(void)
|
||||||
char **res;
|
char **res;
|
||||||
|
|
||||||
res = pw_split_strv(test1, del, INT_MAX, &n_tokens);
|
res = pw_split_strv(test1, del, INT_MAX, &n_tokens);
|
||||||
spa_assert(res != NULL);
|
spa_assert_se(res != NULL);
|
||||||
spa_assert(n_tokens == 3);
|
spa_assert_se(n_tokens == 3);
|
||||||
spa_assert(spa_streq(res[0], "a"));
|
spa_assert_se(spa_streq(res[0], "a"));
|
||||||
spa_assert(spa_streq(res[1], "test"));
|
spa_assert_se(spa_streq(res[1], "test"));
|
||||||
spa_assert(spa_streq(res[2], "string"));
|
spa_assert_se(spa_streq(res[2], "string"));
|
||||||
spa_assert(res[3] == NULL);
|
spa_assert_se(res[3] == NULL);
|
||||||
pw_free_strv(res);
|
pw_free_strv(res);
|
||||||
|
|
||||||
res = pw_split_strv(test1, del, 2, &n_tokens);
|
res = pw_split_strv(test1, del, 2, &n_tokens);
|
||||||
spa_assert(res != NULL);
|
spa_assert_se(res != NULL);
|
||||||
spa_assert(n_tokens == 2);
|
spa_assert_se(n_tokens == 2);
|
||||||
spa_assert(spa_streq(res[0], "a"));
|
spa_assert_se(spa_streq(res[0], "a"));
|
||||||
spa_assert(spa_streq(res[1], "test string \n \r "));
|
spa_assert_se(spa_streq(res[1], "test string \n \r "));
|
||||||
spa_assert(res[2] == NULL);
|
spa_assert_se(res[2] == NULL);
|
||||||
pw_free_strv(res);
|
pw_free_strv(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,9 +223,9 @@ static void test_strip(void)
|
||||||
char test1[] = " \n\r \n a test string \n \r ";
|
char test1[] = " \n\r \n a test string \n \r ";
|
||||||
char test2[] = " \n\r \n \n \r ";
|
char test2[] = " \n\r \n \n \r ";
|
||||||
char test3[] = "a test string";
|
char test3[] = "a test string";
|
||||||
spa_assert(spa_streq(pw_strip(test1, "\n\r "), "a test string"));
|
spa_assert_se(spa_streq(pw_strip(test1, "\n\r "), "a test string"));
|
||||||
spa_assert(spa_streq(pw_strip(test2, "\n\r "), ""));
|
spa_assert_se(spa_streq(pw_strip(test2, "\n\r "), ""));
|
||||||
spa_assert(spa_streq(pw_strip(test3, "\n\r "), "a test string"));
|
spa_assert_se(spa_streq(pw_strip(test3, "\n\r "), "a test string"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ pwtest_spa_plugin_try_load_interface(struct pwtest_spa_plugin *plugin,
|
||||||
bool found = false;
|
bool found = false;
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle;
|
||||||
|
|
||||||
spa_assert(libdir != NULL);
|
spa_assert_se(libdir != NULL);
|
||||||
spa_scnprintf(path, sizeof(path), "%s/%s.so", libdir, libname);
|
spa_scnprintf(path, sizeof(path), "%s/%s.so", libdir, libname);
|
||||||
|
|
||||||
hnd = dlopen(path, RTLD_NOW);
|
hnd = dlopen(path, RTLD_NOW);
|
||||||
|
|
@ -516,7 +516,7 @@ static void add_tests(struct pwtest_context *ctx)
|
||||||
|
|
||||||
spa_list_for_each(c, &ctx->suites, link) {
|
spa_list_for_each(c, &ctx->suites, link) {
|
||||||
c->result = c->decl->setup(ctx, c);
|
c->result = c->decl->setup(ctx, c);
|
||||||
spa_assert(c->result >= PWTEST_PASS && c->result <= PWTEST_SYSTEM_ERROR);
|
spa_assert_se(c->result >= PWTEST_PASS && c->result <= PWTEST_SYSTEM_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -526,7 +526,7 @@ static int remove_file(const char *fpath, const struct stat *sb, int typeflag, s
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* Safety check: bail out if somehow we left TMPDIR */
|
/* Safety check: bail out if somehow we left TMPDIR */
|
||||||
spa_assert(spa_strneq(fpath, tmpdir, strlen(tmpdir)));
|
spa_assert_se(spa_strneq(fpath, tmpdir, strlen(tmpdir)));
|
||||||
|
|
||||||
r = remove(fpath);
|
r = remove(fpath);
|
||||||
if (r)
|
if (r)
|
||||||
|
|
@ -546,9 +546,9 @@ static void remove_xdg_runtime_dir(const char *xdg_dir)
|
||||||
|
|
||||||
/* Safety checks, we really don't want to recursively remove a
|
/* Safety checks, we really don't want to recursively remove a
|
||||||
* random directory due to a bug */
|
* random directory due to a bug */
|
||||||
spa_assert(spa_strneq(xdg_dir, tmpdir, strlen(tmpdir)));
|
spa_assert_se(spa_strneq(xdg_dir, tmpdir, strlen(tmpdir)));
|
||||||
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", xdg_dir);
|
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", xdg_dir);
|
||||||
spa_assert((size_t)r == strlen(xdg_dir) + 11);
|
spa_assert_se((size_t)r == strlen(xdg_dir) + 11);
|
||||||
if (access(path, F_OK) != 0) {
|
if (access(path, F_OK) != 0) {
|
||||||
fprintf(stderr, "XDG_RUNTIME_DIR changed, cannot clean up\n");
|
fprintf(stderr, "XDG_RUNTIME_DIR changed, cannot clean up\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -588,7 +588,7 @@ static inline void log_append(struct pw_array *buffer, int fd)
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
r = pw_array_ensure_size(buffer, sz);
|
r = pw_array_ensure_size(buffer, sz);
|
||||||
spa_assert(r == 0);
|
spa_assert_se(r == 0);
|
||||||
r = read(fd, pw_array_end(buffer), sz);
|
r = read(fd, pw_array_end(buffer), sz);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
@ -617,7 +617,7 @@ static bool collect_child(struct pwtest_test *t, pid_t pid)
|
||||||
case PWTEST_SYSTEM_ERROR:
|
case PWTEST_SYSTEM_ERROR:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
spa_assert(!"Invalid test result");
|
spa_assert_se(!"Invalid test result");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -677,11 +677,11 @@ static void make_xdg_runtime_test_dir(char dir[PATH_MAX], const char *prefix)
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = spa_scnprintf(dir, PATH_MAX, "%s/%zd", prefix, counter++);
|
r = spa_scnprintf(dir, PATH_MAX, "%s/%zd", prefix, counter++);
|
||||||
spa_assert(r >= (int)(strlen(prefix) + 2));
|
spa_assert_se(r >= (int)(strlen(prefix) + 2));
|
||||||
r = mkdir(dir, 0777);
|
r = mkdir(dir, 0777);
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
fprintf(stderr, "Failed to make XDG_RUNTIME_DIR %s (%m)\n", dir);
|
fprintf(stderr, "Failed to make XDG_RUNTIME_DIR %s (%m)\n", dir);
|
||||||
spa_assert(r != -1);
|
spa_assert_se(r != -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -787,10 +787,10 @@ static int start_test_forked(struct pwtest_test *t, int read_fds[_FD_LAST], int
|
||||||
sigaction(SIGALRM, &act, NULL);
|
sigaction(SIGALRM, &act, NULL);
|
||||||
|
|
||||||
r = dup2(write_fds[FD_STDERR], STDERR_FILENO);
|
r = dup2(write_fds[FD_STDERR], STDERR_FILENO);
|
||||||
spa_assert(r != -1);
|
spa_assert_se(r != -1);
|
||||||
setlinebuf(stderr);
|
setlinebuf(stderr);
|
||||||
r = dup2(write_fds[FD_STDOUT], STDOUT_FILENO);
|
r = dup2(write_fds[FD_STDOUT], STDOUT_FILENO);
|
||||||
spa_assert(r != -1);
|
spa_assert_se(r != -1);
|
||||||
setlinebuf(stdout);
|
setlinebuf(stdout);
|
||||||
|
|
||||||
/* For convenience in the tests, let this be a global variable. */
|
/* For convenience in the tests, let this be a global variable. */
|
||||||
|
|
@ -1019,8 +1019,8 @@ static void log_test_result(struct pwtest_test *t)
|
||||||
{ "ERROR", SPA_ANSI_BOLD_MAGENTA },
|
{ "ERROR", SPA_ANSI_BOLD_MAGENTA },
|
||||||
};
|
};
|
||||||
|
|
||||||
spa_assert(t->result >= PWTEST_PASS);
|
spa_assert_se(t->result >= PWTEST_PASS);
|
||||||
spa_assert(t->result <= PWTEST_SYSTEM_ERROR);
|
spa_assert_se(t->result <= PWTEST_SYSTEM_ERROR);
|
||||||
s = &statuses[t->result - PWTEST_PASS];
|
s = &statuses[t->result - PWTEST_PASS];
|
||||||
|
|
||||||
fprintf(stderr, " status: %s%s%s\n",
|
fprintf(stderr, " status: %s%s%s\n",
|
||||||
|
|
@ -1075,14 +1075,14 @@ static char* make_xdg_runtime_dir(void)
|
||||||
tmpdir = "/tmp";
|
tmpdir = "/tmp";
|
||||||
|
|
||||||
int r = asprintf(&dir, "%s/pwtest-%02d:%02d-XXXXXX", tmpdir, tm->tm_hour, tm->tm_min);
|
int r = asprintf(&dir, "%s/pwtest-%02d:%02d-XXXXXX", tmpdir, tm->tm_hour, tm->tm_min);
|
||||||
spa_assert((size_t)r == strlen(tmpdir) + 20); /* rough estimate */
|
spa_assert_se((size_t)r == strlen(tmpdir) + 20); /* rough estimate */
|
||||||
spa_assert(mkdtemp(dir) != NULL);
|
spa_assert_se(mkdtemp(dir) != NULL);
|
||||||
|
|
||||||
/* Marker file to avoid removing a random directory during cleanup */
|
/* Marker file to avoid removing a random directory during cleanup */
|
||||||
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", dir);
|
r = spa_scnprintf(path, sizeof(path), "%s/pwtest.dir", dir);
|
||||||
spa_assert((size_t)r == strlen(dir) + 11);
|
spa_assert_se((size_t)r == strlen(dir) + 11);
|
||||||
fp = fopen(path, "w");
|
fp = fopen(path, "w");
|
||||||
spa_assert(fp);
|
spa_assert_se(fp);
|
||||||
fprintf(fp, "pwtest\n");
|
fprintf(fp, "pwtest\n");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ PWTEST(node_io_abi_sizes)
|
||||||
pwtest_int_eq(sizeof(struct spa_io_position), 1688U);
|
pwtest_int_eq(sizeof(struct spa_io_position), 1688U);
|
||||||
pwtest_int_eq(sizeof(struct spa_io_rate_match), 48U);
|
pwtest_int_eq(sizeof(struct spa_io_rate_match), 48U);
|
||||||
|
|
||||||
spa_assert(sizeof(struct spa_node_info) == 48);
|
spa_assert_se(sizeof(struct spa_node_info) == 48);
|
||||||
spa_assert(sizeof(struct spa_port_info) == 48);
|
spa_assert_se(sizeof(struct spa_port_info) == 48);
|
||||||
|
|
||||||
spa_assert(sizeof(struct spa_result_node_error) == 8);
|
spa_assert_se(sizeof(struct spa_result_node_error) == 8);
|
||||||
spa_assert(sizeof(struct spa_result_node_params) == 24);
|
spa_assert_se(sizeof(struct spa_result_node_params) == 24);
|
||||||
|
|
||||||
return PWTEST_PASS;
|
return PWTEST_PASS;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
1506
test/test-spa-pod.c
1506
test/test-spa-pod.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue