Skip to content

Commit

Permalink
tests: internal: cf_fluentbit: add test case for recursion
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
Signed-off-by: Manal Geries <[email protected]>
  • Loading branch information
nokute78 authored and mgeriesa committed Oct 25, 2022
1 parent 467c97f commit a467098
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/config_format/flb_cf_fluentbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ static int read_config(struct flb_cf *cf, struct local_ctx *ctx,
cfg_file = tmp;
}
}
#ifndef _WIN32
/* check if readed file */
for (i=0; i<*ino_num; i++) {
if (st.st_ino == ino_table[i]) {
Expand All @@ -456,6 +457,7 @@ static int read_config(struct flb_cf *cf, struct local_ctx *ctx,
}
ino_table[*ino_num] = st.st_ino;
*ino_num += 1;
#endif
}
#endif

Expand Down
17 changes: 17 additions & 0 deletions tests/internal/config_format_fluentbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define FLB_000 FLB_TESTS_DATA_PATH "/data/config_format/classic/fluent-bit.conf"
#define FLB_001 FLB_TESTS_DATA_PATH "/data/config_format/classic/issue_5880.conf"
#define FLB_002 FLB_TESTS_DATA_PATH "/data/config_format/classic/indent_level_error.conf"
#define FLB_003 FLB_TESTS_DATA_PATH "/data/config_format/classic/recursion.conf"

#define ERROR_LOG "fluentbit_conf_error.log"

Expand Down Expand Up @@ -208,9 +209,25 @@ void indent_level_error()
unlink(ERROR_LOG);
}

void recursion()
{
struct flb_cf *cf;

cf = flb_cf_create();
if (!TEST_CHECK(cf != NULL)) {
TEST_MSG("flb_cf_create failed");
exit(EXIT_FAILURE);
}

cf = flb_cf_fluentbit_create(cf, FLB_003, NULL, 0);

/* No SIGSEGV means success */
}

TEST_LIST = {
{ "basic" , test_basic},
{ "missing_value_issue5880" , missing_value},
{ "indent_level_error" , indent_level_error},
{ "recursion" , recursion},
{ 0 }
};
1 change: 1 addition & 0 deletions tests/internal/data/config_format/classic/recursion.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@INCLUDE rec*

0 comments on commit a467098

Please sign in to comment.