Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: internal: stream_processor: fix when test path is too long. #7869

Merged
merged 2 commits into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions tests/internal/stream_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ static void test_window()
int t;
int checks;
int ret;
char datafile[100];
char datafile[PATH_MAX];
struct sp_buffer data_buf;
struct sp_buffer out_buf;
struct task_check *check;
Expand Down Expand Up @@ -529,8 +529,11 @@ static void test_window()
task->window.fd_hop = 1;
double record_timestamp = 1.0;
for (t = 0; t < check->window_size_sec + check->window_hop_sec; t++) {
sprintf(datafile, "%s%d.mp",
ret = snprintf(datafile, sizeof(datafile)-1, "%s%d.mp",
DATA_SAMPLES_HOPPING_WINDOW_PATH, t + 1);
if (!TEST_CHECK(ret <= sizeof(datafile)-1)) {
exit(1);
}
ret = file_to_buf(datafile, &data_buf);
if (ret == -1) {
flb_error("[sp test] cannot open DATA_SAMPLES file %s", datafile);
Expand Down Expand Up @@ -592,7 +595,7 @@ static void test_snapshot()
int t;
int checks;
int ret;
char datafile[100];
char datafile[PATH_MAX];
char stream_name[100];
char window_val[3];
struct sp_buffer data_buf;
Expand Down Expand Up @@ -666,8 +669,12 @@ static void test_snapshot()

/* Read 1.mp -> 5.mp message pack buffers created for window tests */
for (t = 0; t < 5; t++) {
sprintf(datafile, "%s%d.mp",

ret = snprintf(datafile, sizeof(datafile)-1, "%s%d.mp",
DATA_SAMPLES_HOPPING_WINDOW_PATH, t + 1);
if (!TEST_CHECK(ret <= sizeof(datafile)-1)) {
exit(1);
}

if (data_buf.buffer) {
flb_free(data_buf.buffer);
Expand Down
Loading