9 #include "test_macros.h"
11 static const arg_t fe_args[] = {
12 waveform_to_cepstral_command_line_macro(),
13 { NULL, 0, NULL, NULL }
17 process(sbthread_t *th)
28 sprintf(outfile, "%03ld.log", (long)sbthread_arg(th));
29 if ((logfh = fopen(outfile, "w")) == NULL)
32 if ((fe = fe_init_auto_r(sbthread_config(th))) == NULL)
34 if ((raw = fopen(TESTDATADIR "/chan3.raw", "rb")) == NULL)
36 fseek(raw, 0, SEEK_END);
38 fseek(raw, 0, SEEK_SET);
39 buf = ckd_malloc(fsize);
40 fread(buf, 1, fsize, raw);
43 fe_process_utt(fe, buf, nsamps, &cepbuf, &nfr);
44 E_INFO("nfr = %d\n", nfr);
55 main(int argc, char *argv[])
57 sbthread_t *threads[10];
61 E_INFO("Processing chan3.raw in 10 threads\n");
62 if ((config = cmd_ln_parse_r(NULL, fe_args, 0, NULL, FALSE)) == NULL)
64 for (i = 0; i < 10; ++i) {
65 config = cmd_ln_retain(config);
66 threads[i] = sbthread_start(config, process, (void *)(long)i);
68 for (i = 0; i < 10; ++i) {
70 rv = sbthread_wait(threads[i]);
71 E_INFO("Thread %d exited with status %d\n", i, rv);
72 sbthread_free(threads[i]);
74 /* Now check to make sure they all created logfiles with the
75 * correct contents. */
76 for (i = 0; i < 10; ++i) {
77 char logfile[16], line[256];
80 sprintf(logfile, "%03d.log", i);
81 TEST_ASSERT(logfh = fopen(logfile, "r"));
82 while (fgets(line, sizeof(line), logfh)) {
83 string_trim(line, STRING_BOTH);
84 printf("%s: |%s|\n", logfile, line);
85 TEST_EQUAL(0, strcmp(line, "INFO: test_tls_log.c(44): nfr = 1436"));
89 cmd_ln_free_r(config);