ast_free(tree);
}
+static int ineligible_configuration(void)
+{
+ struct ast_config *config;
+ struct ast_flags flags = {0,};
+ const char *value;
+
+ config = ast_config_load("sorcery.conf", flags);
+ if (!config) {
+ return 1;
+ }
+
+ value = ast_variable_retrieve(config, "res_pjsip_pubsub", "resource_list");
+ if (ast_strlen_zero(value)) {
+ ast_config_destroy(config);
+ return 1;
+ }
+
+ if (strcasecmp(value, "memory") && strcasecmp(value, "astdb")) {
+ ast_config_destroy(config);
+ return 1;
+ }
+
+ return 0;
+}
+
AST_TEST_DEFINE(resource_tree)
{
RAII_VAR(struct resource_list *, list, NULL, cleanup_resource_list);
break;
}
+ if (ineligible_configuration()) {
+ ast_test_status_update(test, "Ineligible configuration for this test. Please add a "
+ "'res_pjsip_pubsub' section to sorcery.conf, and set 'resource_list=memory'\n");
+ return AST_TEST_NOT_RUN;
+ }
+
list = create_resource_list(test, "foo", "test", resources, ARRAY_LEN(resources));
if (!list) {
return AST_TEST_FAIL;
break;
}
+ if (ineligible_configuration()) {
+ ast_test_status_update(test, "Ineligible configuration for this test. Please add a "
+ "'res_pjsip_pubsub' section to sorcery.conf, and set 'resource_list=memory'\n");
+ return AST_TEST_NOT_RUN;
+ }
+
list_1 = create_resource_list(test, "foo", "test", resources_1, ARRAY_LEN(resources_1));
if (!list_1) {
return AST_TEST_FAIL;
break;
}
+ if (ineligible_configuration()) {
+ ast_test_status_update(test, "Ineligible configuration for this test. Please add a "
+ "'res_pjsip_pubsub' section to sorcery.conf, and set 'resource_list=memory'\n");
+ return AST_TEST_NOT_RUN;
+ }
+
list = create_resource_list(test, "foo", "test", resources, ARRAY_LEN(resources));
if (!list) {
return AST_TEST_FAIL;
break;
}
+ if (ineligible_configuration()) {
+ ast_test_status_update(test, "Ineligible configuration for this test. Please add a "
+ "'res_pjsip_pubsub' section to sorcery.conf, and set 'resource_list=memory'\n");
+ return AST_TEST_NOT_RUN;
+ }
+
list_1 = create_resource_list(test, "foo", "test", resources_1, ARRAY_LEN(resources_1));
if (!list_1) {
return AST_TEST_FAIL;
break;
}
+ if (ineligible_configuration()) {
+ ast_test_status_update(test, "Ineligible configuration for this test. Please add a "
+ "'res_pjsip_pubsub' section to sorcery.conf, and set 'resource_list=memory'\n");
+ return AST_TEST_NOT_RUN;
+ }
+
list_1 = create_resource_list(test, "foo", "test", resources_1, ARRAY_LEN(resources_1));
if (!list_1) {
return AST_TEST_FAIL;
break;
}
+ if (ineligible_configuration()) {
+ ast_test_status_update(test, "Ineligible configuration for this test. Please add a "
+ "'res_pjsip_pubsub' section to sorcery.conf, and set 'resource_list=memory'\n");
+ return AST_TEST_NOT_RUN;
+ }
+
list_1 = create_resource_list(test, "herp", "test", resources_1, ARRAY_LEN(resources_1));
if (!list_1) {
return AST_TEST_FAIL;
break;
}
+ if (ineligible_configuration()) {
+ ast_test_status_update(test, "Ineligible configuration for this test. Please add a "
+ "'res_pjsip_pubsub' section to sorcery.conf, and set 'resource_list=memory'\n");
+ return AST_TEST_NOT_RUN;
+ }
+
list = create_resource_list(test, "foo", "tsetse", resources, ARRAY_LEN(resources));
if (!list) {
return AST_TEST_FAIL;