Ignore:
Timestamp:
Nov 28, 2018, 10:41:10 PM (2 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.