shithub: aubio

Download patch

ref: 8386dbe98c90c0f9b009c4e015ffd47e2397effb
parent: eba0cc4f03e5cc19050f6ca7602613a9bc3b03b9
author: Paul Brossier <piem@piem.org>
date: Thu Nov 29 11:26:04 EST 2018

[tests] add run_on_default_source_and_sink helper

--- a/tests/utils_tests.h
+++ b/tests/utils_tests.h
@@ -168,3 +168,22 @@
   if (argv) free(argv);
   return err;
 }
+
+int run_on_default_source_and_sink( int main(int, char**) )
+{
+  const int argc = 3;
+  int err = 0;
+  char** argv = (char**)calloc(argc, sizeof(char*));
+  char sink_path[PATH_MAX] = "tmp_aubio_XXXXXX";
+  int fd = create_temp_sink(sink_path);
+  if (!fd) return 1;
+  argv[0] = __FILE__;
+  argv[1] = DEFINEDSTRING(AUBIO_TESTS_SOURCE);
+  argv[2] = sink_path;
+  // check if the file can be read
+  if ( check_source(argv[1]) ) return 1;
+  err = main(argc, argv);
+  close_temp_sink(sink_path, fd);
+  if (argv) free(argv);
+  return err;
+}