rf_file: fix check for number of channels and cleanup after test

master
Robert Falkenberg 3 years ago
parent f3d144dd59
commit c26f2b2041

@ -172,7 +172,7 @@ int rf_file_open_multi(char* args, void** h, uint32_t nof_channels)
FILE* rx_files[SRSRAN_MAX_CHANNELS] = {NULL}; FILE* rx_files[SRSRAN_MAX_CHANNELS] = {NULL};
FILE* tx_files[SRSRAN_MAX_CHANNELS] = {NULL}; FILE* tx_files[SRSRAN_MAX_CHANNELS] = {NULL};
if (h && nof_channels < SRSRAN_MAX_CHANNELS) { if (h && nof_channels <= SRSRAN_MAX_CHANNELS) {
uint32_t base_srate = FILE_BASERATE_DEFAULT_HZ; uint32_t base_srate = FILE_BASERATE_DEFAULT_HZ;
// parse args // parse args

@ -228,6 +228,11 @@ void create_file(const char* filename)
fclose(f); fclose(f);
} }
void remove_file(const char* filename)
{
remove(filename);
}
int main() int main()
{ {
// create files for testing // create files for testing
@ -306,6 +311,16 @@ int main()
return -1; return -1;
} }
// clean workspace
remove_file("rx_file0");
remove_file("rx_file1");
remove_file("rx_file2");
remove_file("rx_file3");
remove_file("tx_file0");
remove_file("tx_file1");
remove_file("tx_file2");
remove_file("tx_file3");
fprintf(stdout, "Test passed!\n"); fprintf(stdout, "Test passed!\n");
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;

Loading…
Cancel
Save