Changeset 387b605 for tests


Ignore:
Timestamp:
Dec 19, 2018, 2:49:22 PM (12 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/timestretch, master
Children:
43ea60d
Parents:
7b5e1a5
Message:

[tests] avoid test-sink crash on missing input file

Location:
tests/src/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/src/io/base-sink_custom.h

    r7b5e1a5 r387b605  
    2626  char_t *sink_path = argv[2];
    2727
     28  aubio_source_t *i = NULL;
     29  aubio_sink_custom_t *o = NULL;
     30
    2831  if ( argc >= 4 ) samplerate = atoi(argv[3]);
    2932  if ( argc >= 5 ) hop_size = atoi(argv[4]);
    3033
    3134  fvec_t *vec = new_fvec(hop_size);
     35  if (!vec) { err = 1; goto failure; }
    3236
    33   aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
     37  i = new_aubio_source(source_path, samplerate, hop_size);
     38  if (!i) { err = 1; goto failure; }
    3439  if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
    3540
    36   aubio_sink_custom_t *o = new_aubio_sink_custom(sink_path, samplerate);
    37 
    38   if (!vec || !i || !o) { err = 1; goto failure; }
     41  o = new_aubio_sink_custom(sink_path, samplerate);
     42  if (!o) { err = 1; goto failure; }
    3943
    4044  do {
  • tests/src/io/test-sink.c

    r7b5e1a5 r387b605  
    2222  char_t *sink_path = argv[2];
    2323
     24  aubio_source_t *i = NULL;
     25  aubio_sink_t *o = NULL;
     26
    2427  if ( argc >= 4 ) samplerate = atoi(argv[3]);
    2528  if ( argc >= 5 ) hop_size = atoi(argv[4]);
    2629
    2730  fvec_t *vec = new_fvec(hop_size);
     31  if (!vec) { err = 1; goto failure; }
    2832
    29   aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
     33  i = new_aubio_source(source_path, samplerate, hop_size);
     34  if (!i) { err = 1; goto failure; }
    3035  if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
    3136
    32   aubio_sink_t *o = new_aubio_sink(sink_path, samplerate);
    33 
    34   if (!vec || !i || !o) { err = 1; goto failure; }
     37  o = new_aubio_sink(sink_path, samplerate);
     38  if (!o) { err = 1; goto failure; }
    3539
    3640  do {
Note: See TracChangeset for help on using the changeset viewer.