summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-10-23 13:42:37 -0400
committerCorey Farrell <git@cfware.com>2017-10-23 12:46:09 -0500
commit6cec3149be3f22fac069cfce89e9cdc8bf37a008 (patch)
treee98ffa56237b45684e9dc0b339b7911ff710fa67 /tests
parent302626c11529cfebcdd63e801ff2ab513eabaede (diff)
test_config: Fix failure and segfault when config_hook is run twice.
On second run the config_hook test was unexpectedly failing to load test_config.conf because it was still unmodified since the last load. This is fixed by not passing CONFIG_FLAG_FILEUNCHANGED for the initial loads, only using it when we are tested that a reload of unmodified files do not initiate the hook. ASTERISK-25960 Change-Id: Ifd679509a23ed163e5cc647490bf7df4ae3cd856
Diffstat (limited to 'tests')
-rw-r--r--tests/test_config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/test_config.c b/tests/test_config.c
index 8fb473535..c58bdc70d 100644
--- a/tests/test_config.c
+++ b/tests/test_config.c
@@ -959,7 +959,8 @@ AST_TEST_DEFINE(config_hook)
{
enum ast_test_result_state res = AST_TEST_FAIL;
enum config_hook_flags hook_flags = { 0, };
- struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
+ struct ast_flags config_flags = { 0 };
+ struct ast_flags reload_flags = { CONFIG_FLAG_FILEUNCHANGED };
struct ast_config *cfg;
switch (cmd) {
@@ -1027,7 +1028,7 @@ AST_TEST_DEFINE(config_hook)
* Hook should not run
*/
hook_run = 0;
- cfg = ast_config_load(CONFIG_FILE, config_flags);
+ cfg = ast_config_load(CONFIG_FILE, reload_flags);
/* Only destroy this cfg conditionally. Otherwise a crash happens. */
if (cfg != CONFIG_STATUS_FILEUNCHANGED) {
ast_config_destroy(cfg);