mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04: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;
|
||||
size = spa_handle_factory_get_size(factory, NULL);
|
||||
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,
|
||||
ctx->follower_handle,
|
||||
NULL, support, 1);
|
||||
spa_assert(res >= 0);
|
||||
spa_assert_se(res >= 0);
|
||||
|
||||
res = spa_handle_get_interface(ctx->follower_handle,
|
||||
SPA_TYPE_INTERFACE_Node, &iface);
|
||||
spa_assert(res >= 0);
|
||||
spa_assert_se(res >= 0);
|
||||
|
||||
ctx->follower_node = iface;
|
||||
|
||||
/* make adapter */
|
||||
factory = find_factory(SPA_NAME_AUDIO_ADAPT);
|
||||
spa_assert(factory != NULL);
|
||||
spa_assert_se(factory != NULL);
|
||||
|
||||
size = spa_handle_factory_get_size(factory, NULL);
|
||||
|
||||
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);
|
||||
items[0] = SPA_DICT_ITEM_INIT("audio.adapt.follower", value);
|
||||
|
|
@ -109,11 +109,11 @@ static int setup_context(struct context *ctx)
|
|||
ctx->adapter_handle,
|
||||
&SPA_DICT_INIT(items, 1),
|
||||
support, 1);
|
||||
spa_assert(res >= 0);
|
||||
spa_assert_se(res >= 0);
|
||||
|
||||
res = spa_handle_get_interface(ctx->adapter_handle,
|
||||
SPA_TYPE_INTERFACE_Node, &iface);
|
||||
spa_assert(res >= 0);
|
||||
spa_assert_se(res >= 0);
|
||||
ctx->adapter_node = iface;
|
||||
|
||||
return 0;
|
||||
|
|
@ -134,8 +134,8 @@ static void node_info(void *data, const struct spa_node_info *info)
|
|||
info->max_input_ports,
|
||||
info->max_output_ports);
|
||||
|
||||
spa_assert(info->max_input_ports == 0);
|
||||
spa_assert(info->max_output_ports > 0);
|
||||
spa_assert_se(info->max_input_ports == 0);
|
||||
spa_assert_se(info->max_output_ports > 0);
|
||||
}
|
||||
|
||||
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,
|
||||
const struct spa_port_info *info)
|
||||
{
|
||||
spa_assert(direction == SPA_DIRECTION_OUTPUT);
|
||||
spa_assert(port < 6);
|
||||
spa_assert_se(direction == SPA_DIRECTION_OUTPUT);
|
||||
spa_assert_se(port < 6);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
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_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);
|
||||
res = spa_node_set_param(ctx->adapter_node, SPA_PARAM_Format, 0, param);
|
||||
spa_log_debug(&logger.log, "result %d", res);
|
||||
spa_assert(res >= 0);
|
||||
spa_assert_se(res >= 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,22 +79,22 @@ static int setup_context(struct context *ctx)
|
|||
|
||||
/* make 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);
|
||||
|
||||
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,
|
||||
ctx->convert_handle,
|
||||
NULL,
|
||||
support, 1);
|
||||
spa_assert(res >= 0);
|
||||
spa_assert_se(res >= 0);
|
||||
|
||||
res = spa_handle_get_interface(ctx->convert_handle,
|
||||
SPA_TYPE_INTERFACE_Node, &iface);
|
||||
spa_assert(res >= 0);
|
||||
spa_assert_se(res >= 0);
|
||||
ctx->convert_node = iface;
|
||||
|
||||
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_output_ports);
|
||||
|
||||
spa_assert(info->max_input_ports == MAX_PORTS);
|
||||
spa_assert(info->max_output_ports == MAX_PORTS);
|
||||
spa_assert_se(info->max_input_ports == MAX_PORTS);
|
||||
spa_assert_se(info->max_output_ports == MAX_PORTS);
|
||||
|
||||
ctx->got_node_info = true;
|
||||
}
|
||||
|
|
@ -151,11 +151,11 @@ static int test_init_state(struct context *ctx)
|
|||
&listener, &init_events, ctx);
|
||||
spa_hook_remove(&listener);
|
||||
|
||||
spa_assert(ctx->got_node_info);
|
||||
spa_assert(ctx->n_port_info[0] == 1);
|
||||
spa_assert(ctx->n_port_info[1] == 1);
|
||||
spa_assert(ctx->got_port_info[0][0] == true);
|
||||
spa_assert(ctx->got_port_info[1][0] == true);
|
||||
spa_assert_se(ctx->got_node_info);
|
||||
spa_assert_se(ctx->n_port_info[0] == 1);
|
||||
spa_assert_se(ctx->n_port_info[1] == 1);
|
||||
spa_assert_se(ctx->got_port_info[0][0] == true);
|
||||
spa_assert_se(ctx->got_port_info[1][0] == true);
|
||||
|
||||
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,
|
||||
SPA_PARAM_Format, 0, param);
|
||||
spa_assert(res == 0);
|
||||
spa_assert_se(res == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ static int test_split_setup1(struct context *ctx)
|
|||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(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);
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ static int test_split_setup2(struct context *ctx)
|
|||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(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);
|
||||
|
||||
|
|
@ -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));
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -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,
|
||||
SPA_PARAM_Format, 0, param);
|
||||
spa_assert(res == 0);
|
||||
spa_assert_se(res == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -375,7 +375,7 @@ static int test_merge_setup1(struct context *ctx)
|
|||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(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);
|
||||
|
||||
|
|
@ -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,
|
||||
SPA_PARAM_Format, 0, param);
|
||||
spa_assert(res == 0);
|
||||
spa_assert_se(res == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -445,7 +445,7 @@ static int test_merge_setup2(struct context *ctx)
|
|||
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(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);
|
||||
|
||||
|
|
@ -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));
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -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,
|
||||
SPA_PARAM_Format, 0, param);
|
||||
spa_assert(res == 0);
|
||||
spa_assert_se(res == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static void dump_matrix(struct channelmix *mix, float *coeff)
|
|||
for (j = 0; j < mix->src_chan; j++) {
|
||||
float v = mix->matrix_orig[i][j];
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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, m2, size);
|
||||
}
|
||||
// spa_assert(res == 0);
|
||||
// spa_assert_se(res == 0);
|
||||
}
|
||||
|
||||
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,
|
||||
resample_in_len(r, size));
|
||||
|
||||
spa_assert(in_len == pin_len);
|
||||
spa_assert(out_len == pout_len);
|
||||
spa_assert_se(in_len == pin_len);
|
||||
spa_assert_se(out_len == pout_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue