Changeset bab4611
- Timestamp:
- Nov 29, 2018, 12:34:39 AM (6 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/utils_tests.h
rcb288f2 rbab4611 20 20 #define PATH_MAX 1024 21 21 #endif 22 23 #define DEFAULT_TEST_FILE "python/tests/sounds/44100Hz_44100f_sine441.wav" 22 24 23 25 #ifdef HAVE_C99_VARARGS_MACROS … … 66 68 int seed = tm_struct->tm_sec + (size_t)tm_address; 67 69 //PRINT_WRN("current seed: %d\n", seed); 68 srandom ( seed);70 srandom ((unsigned int)seed); 69 71 } 70 72 … … 85 87 } 86 88 87 #elif (defined(HAVE_WIN_HACKS) //&& !defined(__GNUC__))89 #elif defined(HAVE_WIN_HACKS) //&& !defined(__GNUC__) 88 90 // windows workaround, where mkstemp does not exist... 89 91 int create_temp_sink(char *templ) … … 113 115 #endif 114 116 117 // pass progname / default 118 int 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 134 int 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 } 115 156 116 157 int run_on_default_sink( int main(int, char**) )
Note: See TracChangeset
for help on using the changeset viewer.