Changeset abe67e1


Ignore:
Timestamp:
Nov 28, 2018, 10:41:10 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
a6065b9
Parents:
c0ce78f
Message:

[tests] create a temporary sink, use in wavetable test

When called without argument, test-wavetable will invoke the function
run_on_default_sink to create a temporary file and runs the main
function on it.

Location:
tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/src/synth/test-wavetable.c

    rc0ce78f rabe67e1  
    77
    88  if (argc < 2) {
    9     err = 2;
    10     PRINT_ERR("not enough arguments\n");
     9    PRINT_ERR("not enough arguments, running tests\n");
     10    err = run_on_default_sink(main);
    1111    PRINT_MSG("usage: %s <output_path> [freq] [samplerate]\n", argv[0]);
    1212    return err;
  • tests/utils_tests.h

    rc0ce78f rabe67e1  
    55#include <assert.h>
    66#include "config.h"
     7
     8#ifdef HAVE_LIMITS_H
     9#include <limits.h> // PATH_MAX
     10#endif /* HAVE_LIMITS_H */
     11#ifndef PATH_MAX
     12#define PATH_MAX 1024
     13#endif
    714
    815#ifdef HAVE_C99_VARARGS_MACROS
     
    5259  srandom (seed);
    5360}
     61
     62int run_on_default_sink( int main(int, char**) )
     63{
     64  int argc = 2, err;
     65  char* argv[argc];
     66  char sink_path[PATH_MAX] = "tmp_aubio_XXXXXX";
     67  int fd = mkstemp(sink_path);
     68  argv[0] = __FILE__;
     69  if (!fd) return 1;
     70  argv[1] = sink_path;
     71  err = main(argc, argv);
     72  unlink(sink_path);
     73  close(fd);
     74  return err;
     75}
Note: See TracChangeset for help on using the changeset viewer.