Ignore:
Timestamp:
Nov 29, 2018, 12:34:39 AM (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:
a334368
Parents:
cb288f2
Message:

[tests] fix unmatched parenthesis on windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/utils_tests.h

    rcb288f2 rbab4611  
    2020#define PATH_MAX 1024
    2121#endif
     22
     23#define DEFAULT_TEST_FILE "python/tests/sounds/44100Hz_44100f_sine441.wav"
    2224
    2325#ifdef HAVE_C99_VARARGS_MACROS
     
    6668  int seed = tm_struct->tm_sec + (size_t)tm_address;
    6769  //PRINT_WRN("current seed: %d\n", seed);
    68   srandom (seed);
     70  srandom ((unsigned int)seed);
    6971}
    7072
     
    8587}
    8688
    87 #elif (defined(HAVE_WIN_HACKS) //&& !defined(__GNUC__))
     89#elif defined(HAVE_WIN_HACKS) //&& !defined(__GNUC__)
    8890// windows workaround, where mkstemp does not exist...
    8991int create_temp_sink(char *templ)
     
    113115#endif
    114116
     117// pass progname / default
     118int run_on_default_source( int main(int, char**) )
     119{
     120  int argc = 2;
     121  char* argv[argc];
     122  argv[0] = __FILE__;
     123  // when running from waf build
     124  argv[1] = "../../" DEFAULT_TEST_FILE;
     125  // when running from source root directory
     126  if ( access(argv[1], R_OK) )
     127      argv[1] = DEFAULT_TEST_FILE;
     128  // no file found
     129  if ( access(argv[1], R_OK) != 0 )
     130      return 1;
     131  return main(argc, argv);
     132}
     133
     134int run_on_default_source_and_sink( int main(int, char**) )
     135{
     136  int argc = 3, err;
     137  char* argv[argc];
     138  argv[0] = __FILE__;
     139  // when running from waf build
     140  argv[1] = "../../" DEFAULT_TEST_FILE;
     141  // when running from source root directory
     142  if ( access(argv[1], R_OK) )
     143      argv[1] = DEFAULT_TEST_FILE;
     144  // no file found
     145  if ( access(argv[1], R_OK) != 0 )
     146      return 1;
     147  char sink_path[PATH_MAX] = "tmp_aubio_XXXXXX";
     148  int fd = mkstemp(sink_path);
     149  if (!fd) return 1;
     150  argv[2] = sink_path;
     151  err = main(argc, argv);
     152  unlink(sink_path);
     153  close(fd);
     154  return err;
     155}
    115156
    116157int run_on_default_sink( int main(int, char**) )
Note: See TracChangeset for help on using the changeset viewer.