VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp@ 104622

Last change on this file since 104622 was 104622, checked in by vboxsync, 7 months ago

ValidationKit/VKAT: Fixed issues / nits. bugref:3409

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 60.9 KB
Line 
1/* $Id: vkat.cpp 104622 2024-05-14 11:21:57Z vboxsync $ */
2/** @file
3 * Validation Kit Audio Test (VKAT) utility for testing and validating the audio stack.
4 */
5
6/*
7 * Copyright (C) 2021-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * The contents of this file may alternatively be used under the terms
26 * of the Common Development and Distribution License Version 1.0
27 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
28 * in the VirtualBox distribution, in which case the provisions of the
29 * CDDL are applicable instead of those of the GPL.
30 *
31 * You may elect to license modified versions of this file under the
32 * terms and conditions of either the GPL or the CDDL or both.
33 *
34 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
35 */
36
37
38/*********************************************************************************************************************************
39* Header Files *
40*********************************************************************************************************************************/
41#define LOG_GROUP LOG_GROUP_AUDIO_TEST
42
43#include <iprt/buildconfig.h>
44#include <iprt/ctype.h>
45#include <iprt/dir.h>
46#include <iprt/errcore.h>
47#include <iprt/file.h>
48#include <iprt/initterm.h>
49#include <iprt/getopt.h>
50#include <iprt/message.h>
51#include <iprt/path.h>
52#include <iprt/process.h>
53#include <iprt/rand.h>
54#include <iprt/stream.h>
55#include <iprt/string.h>
56#include <iprt/test.h>
57
58#include <package-generated.h>
59#include "product-generated.h"
60
61#include <VBox/version.h>
62#include <VBox/log.h>
63
64#ifdef RT_OS_WINDOWS
65# include <iprt/win/windows.h> /* for CoInitializeEx and SetConsoleCtrlHandler */
66#else
67# include <signal.h>
68#endif
69
70#include "vkatInternal.h"
71
72
73/*********************************************************************************************************************************
74* Internal Functions *
75*********************************************************************************************************************************/
76static int audioVerifyOne(const char *pszPathSetA, const char *pszPathSetB, PAUDIOTESTVERIFYOPTS pOpts);
77
78
79/*********************************************************************************************************************************
80* Global Variables *
81*********************************************************************************************************************************/
82/**
83 * Backends description table.
84 *
85 * @note The first backend in the array is the default one for the platform.
86 */
87AUDIOTESTBACKENDDESC const g_aBackends[] =
88{
89#ifdef VBOX_WITH_AUDIO_PULSE
90 { &g_DrvHostPulseAudio, "pulseaudio" },
91 { &g_DrvHostPulseAudio, "pulse" },
92 { &g_DrvHostPulseAudio, "pa" },
93#endif
94/*
95 * Note: ALSA has to come second so that PulseAudio above always is the default on Linux-y OSes
96 * -- most distros are using an ALSA plugin for PulseAudio nowadays.
97 * However, some of these configurations do not seem to work by default (can't create audio streams).
98 *
99 * If PulseAudio is not available, the (optional) probing ("--probe-backends") will choose the "pure" ALSA stack instead then.
100 */
101#if defined(VBOX_WITH_AUDIO_ALSA) && defined(RT_OS_LINUX)
102 { &g_DrvHostALSAAudio, "alsa" },
103#endif
104#ifdef VBOX_WITH_AUDIO_OSS
105 { &g_DrvHostOSSAudio, "oss" },
106#endif
107#if defined(RT_OS_DARWIN)
108 { &g_DrvHostCoreAudio, "coreaudio" },
109 { &g_DrvHostCoreAudio, "core" },
110 { &g_DrvHostCoreAudio, "ca" },
111#endif
112#if defined(RT_OS_WINDOWS)
113 { &g_DrvHostAudioWas, "wasapi" },
114 { &g_DrvHostAudioWas, "was" },
115 { &g_DrvHostDSound, "directsound" },
116 { &g_DrvHostDSound, "dsound" },
117 { &g_DrvHostDSound, "ds" },
118#endif
119#ifdef VBOX_WITH_AUDIO_DEBUG
120 { &g_DrvHostDebugAudio, "debug" },
121#endif
122 { &g_DrvHostValidationKitAudio, "valkit" }
123};
124AssertCompile(sizeof(g_aBackends) > 0 /* port me */);
125/** Number of backends defined. */
126unsigned g_cBackends = RT_ELEMENTS(g_aBackends);
127
128/**
129 * Long option values for the 'test' command.
130 */
131enum
132{
133 VKAT_TEST_OPT_COUNT = 900,
134 VKAT_TEST_OPT_DEV,
135 VKAT_TEST_OPT_MODE,
136 VKAT_TEST_OPT_NO_AUDIO_OK,
137 VKAT_TEST_OPT_NO_VERIFY,
138 VKAT_TEST_OPT_OUTDIR,
139 VKAT_TEST_OPT_PAUSE,
140 VKAT_TEST_OPT_PCM_HZ,
141 VKAT_TEST_OPT_PCM_BIT,
142 VKAT_TEST_OPT_PCM_CHAN,
143 VKAT_TEST_OPT_PCM_SIGNED,
144 VKAT_TEST_OPT_PROBE_BACKENDS,
145 VKAT_TEST_OPT_TAG,
146 VKAT_TEST_OPT_TIMEOUT,
147 VKAT_TEST_OPT_TEMPDIR,
148 VKAT_TEST_OPT_VOL,
149 VKAT_TEST_OPT_TCP_BIND_ADDRESS,
150 VKAT_TEST_OPT_TCP_BIND_PORT,
151 VKAT_TEST_OPT_TCP_CONNECT_ADDRESS,
152 VKAT_TEST_OPT_TCP_CONNECT_PORT,
153 VKAT_TEST_OPT_TONE_DURATION_MS,
154 VKAT_TEST_OPT_TONE_VOL_PERCENT
155};
156
157/**
158 * Long option values for the 'verify' command.
159 */
160enum
161{
162 VKAT_VERIFY_OPT_MAX_DIFF_COUNT = 900,
163 VKAT_VERIFY_OPT_MAX_DIFF_PERCENT,
164 VKAT_VERIFY_OPT_MAX_SIZE_PERCENT,
165 VKAT_VERIFY_OPT_NORMALIZE
166};
167
168/**
169 * Common command line parameters.
170 */
171static const RTGETOPTDEF g_aCmdCommonOptions[] =
172{
173 { "--quiet", 'q', RTGETOPT_REQ_NOTHING },
174 { "--verbose", 'v', RTGETOPT_REQ_NOTHING },
175 { "--daemonize", AUDIO_TEST_OPT_CMN_DAEMONIZE, RTGETOPT_REQ_NOTHING },
176 { "--daemonized", AUDIO_TEST_OPT_CMN_DAEMONIZED, RTGETOPT_REQ_NOTHING },
177 { "--debug-audio", AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_ENABLE, RTGETOPT_REQ_NOTHING },
178 { "--debug-audio-path", AUDIO_TEST_OPT_CMN_DEBUG_AUDIO_PATH, RTGETOPT_REQ_STRING },
179};
180
181/**
182 * Command line parameters for test mode.
183 */
184static const RTGETOPTDEF g_aCmdTestOptions[] =
185{
186 { "--backend", 'b', RTGETOPT_REQ_STRING },
187 { "--drvaudio", 'd', RTGETOPT_REQ_NOTHING },
188 { "--exclude", 'e', RTGETOPT_REQ_UINT32 },
189 { "--exclude-all", 'a', RTGETOPT_REQ_NOTHING },
190 { "--include", 'i', RTGETOPT_REQ_UINT32 },
191 { "--outdir", VKAT_TEST_OPT_OUTDIR, RTGETOPT_REQ_STRING },
192 { "--count", VKAT_TEST_OPT_COUNT, RTGETOPT_REQ_UINT32 },
193 { "--device", VKAT_TEST_OPT_DEV, RTGETOPT_REQ_STRING },
194 { "--pause", VKAT_TEST_OPT_PAUSE, RTGETOPT_REQ_UINT32 },
195 { "--pcm-bit", VKAT_TEST_OPT_PCM_BIT, RTGETOPT_REQ_UINT8 },
196 { "--pcm-chan", VKAT_TEST_OPT_PCM_CHAN, RTGETOPT_REQ_UINT8 },
197 { "--pcm-hz", VKAT_TEST_OPT_PCM_HZ, RTGETOPT_REQ_UINT16 },
198 { "--pcm-signed", VKAT_TEST_OPT_PCM_SIGNED, RTGETOPT_REQ_BOOL },
199 { "--probe-backends", VKAT_TEST_OPT_PROBE_BACKENDS, RTGETOPT_REQ_NOTHING },
200 { "--mode", VKAT_TEST_OPT_MODE, RTGETOPT_REQ_STRING },
201 { "--no-audio-ok", VKAT_TEST_OPT_NO_AUDIO_OK, RTGETOPT_REQ_NOTHING },
202 { "--no-verify", VKAT_TEST_OPT_NO_VERIFY, RTGETOPT_REQ_NOTHING },
203 { "--tag", VKAT_TEST_OPT_TAG, RTGETOPT_REQ_STRING },
204 { "--tempdir", VKAT_TEST_OPT_TEMPDIR, RTGETOPT_REQ_STRING },
205 { "--timeout", VKAT_TEST_OPT_TIMEOUT, RTGETOPT_REQ_UINT32 },
206 { "--vol", VKAT_TEST_OPT_VOL, RTGETOPT_REQ_UINT8 },
207 { "--tcp-bind-addr", VKAT_TEST_OPT_TCP_BIND_ADDRESS, RTGETOPT_REQ_STRING },
208 { "--tcp-bind-port", VKAT_TEST_OPT_TCP_BIND_PORT, RTGETOPT_REQ_UINT16 },
209 { "--tcp-connect-addr", VKAT_TEST_OPT_TCP_CONNECT_ADDRESS, RTGETOPT_REQ_STRING },
210 { "--tcp-connect-port", VKAT_TEST_OPT_TCP_CONNECT_PORT, RTGETOPT_REQ_UINT16 },
211 { "--tone-duration", VKAT_TEST_OPT_TONE_DURATION_MS, RTGETOPT_REQ_UINT32 },
212 { "--tone-vol", VKAT_TEST_OPT_TONE_VOL_PERCENT, RTGETOPT_REQ_UINT8 }
213};
214
215/**
216 * Command line parameters for verification mode.
217 */
218static const RTGETOPTDEF g_aCmdVerifyOptions[] =
219{
220 { "--max-diff-count", VKAT_VERIFY_OPT_MAX_DIFF_COUNT, RTGETOPT_REQ_UINT32 },
221 { "--max-diff-percent", VKAT_VERIFY_OPT_MAX_DIFF_PERCENT, RTGETOPT_REQ_UINT8 },
222 { "--max-size-percent", VKAT_VERIFY_OPT_MAX_SIZE_PERCENT, RTGETOPT_REQ_UINT8 },
223 { "--normalize", VKAT_VERIFY_OPT_NORMALIZE, RTGETOPT_REQ_BOOL }
224};
225
226/** Terminate ASAP if set. Set on Ctrl-C. */
227bool volatile g_fTerminate = false;
228/** The release logger. */
229PRTLOGGER g_pRelLogger = NULL;
230/** The test handle. */
231RTTEST g_hTest;
232/** The current verbosity level. */
233unsigned g_uVerbosity = 0;
234/** DrvAudio: Enable debug (or not). */
235bool g_fDrvAudioDebug = false;
236/** DrvAudio: The debug output path. */
237const char *g_pszDrvAudioDebug = NULL;
238
239
240/**
241 * Get default backend.
242 */
243PCPDMDRVREG AudioTestGetDefaultBackend(void)
244{
245 return g_aBackends[0].pDrvReg;
246}
247
248
249/**
250 * Helper for handling --backend options.
251 *
252 * @returns Pointer to the specified backend, NULL if not found (error
253 * displayed).
254 * @param pszBackend The backend option value.
255 */
256PCPDMDRVREG AudioTestFindBackendOpt(const char *pszBackend)
257{
258 for (uintptr_t i = 0; i < RT_ELEMENTS(g_aBackends); i++)
259 if ( strcmp(pszBackend, g_aBackends[i].pszName) == 0
260 || strcmp(pszBackend, g_aBackends[i].pDrvReg->szName) == 0)
261 return g_aBackends[i].pDrvReg;
262 RTMsgError("Unknown backend: '%s'\n\n", pszBackend);
263 RTPrintf("Supported backend values are: ");
264 for (uintptr_t i = 0; i < RT_ELEMENTS(g_aBackends); i++)
265 {
266 if (i > 0)
267 RTPrintf(", ");
268 RTPrintf(g_aBackends[i].pszName);
269 }
270 RTPrintf("\n");
271 return NULL;
272}
273
274
275/*********************************************************************************************************************************
276* Test callbacks *
277*********************************************************************************************************************************/
278
279/**
280 * @copydoc FNAUDIOTESTSETUP
281 */
282static DECLCALLBACK(int) audioTestPlayToneSetup(PAUDIOTESTENV pTstEnv, PAUDIOTESTDESC pTstDesc, PAUDIOTESTPARMS pTstParmsAcq, void **ppvCtx)
283{
284 RT_NOREF(pTstDesc, ppvCtx);
285
286 int rc = VINF_SUCCESS;
287
288 if (strlen(pTstEnv->szDev))
289 {
290 rc = audioTestDriverStackSetDevice(pTstEnv->pDrvStack, PDMAUDIODIR_OUT, pTstEnv->szDev);
291 if (RT_FAILURE(rc))
292 return rc;
293 }
294
295 pTstParmsAcq->enmType = AUDIOTESTTYPE_TESTTONE_PLAY;
296 pTstParmsAcq->enmDir = PDMAUDIODIR_OUT;
297
298 pTstParmsAcq->TestTone = pTstEnv->ToneParms;
299
300 pTstParmsAcq->TestTone.Hdr.idxTest = pTstEnv->idxTest; /* Assign unique test ID. */
301
302 return rc;
303}
304
305/**
306 * @copydoc FNAUDIOTESTEXEC
307 */
308static DECLCALLBACK(int) audioTestPlayToneExec(PAUDIOTESTENV pTstEnv, void *pvCtx, PAUDIOTESTPARMS pTstParms)
309{
310 RT_NOREF(pvCtx);
311
312 int rc = VINF_SUCCESS;
313
314 PAUDIOTESTTONEPARMS const pToneParms = &pTstParms->TestTone;
315
316 uint32_t const idxTest = pToneParms->Hdr.idxTest;
317
318 RTTIMESPEC NowTimeSpec;
319 RTTimeExplode(&pToneParms->Hdr.tsCreated, RTTimeNow(&NowTimeSpec));
320
321 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test #%RU32: Playing test tone (%RU16Hz, %RU32ms)\n",
322 idxTest, (uint16_t)pToneParms->dbFreqHz, pToneParms->msDuration);
323
324 /*
325 * 1. Arm the (host) ValKit ATS with the recording parameters.
326 */
327 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
328 "Test #%RU32: Telling ValKit audio driver on host to record new tone ...\n", idxTest);
329
330 rc = AudioTestSvcClientToneRecord(&pTstEnv->u.Host.AtsClValKit, pToneParms);
331 if (RT_SUCCESS(rc))
332 {
333 /* Give the Validaiton Kit audio driver on the host a bit of time to register / arming the new test. */
334 RTThreadSleep(5000); /* Fudge factor. */
335
336 /*
337 * 2. Tell VKAT on guest to start playback.
338 */
339 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test #%RU32: Telling VKAT on guest to play tone ...\n", idxTest);
340
341 rc = AudioTestSvcClientTonePlay(&pTstEnv->u.Host.AtsClGuest, pToneParms);
342 if (RT_FAILURE(rc))
343 RTTestFailed(g_hTest, "Test #%RU32: AudioTestSvcClientTonePlay() failed with %Rrc\n", idxTest, rc);
344 }
345 else
346 RTTestFailed(g_hTest, "Test #%RU32: AudioTestSvcClientToneRecord() failed with %Rrc\n", idxTest, rc);
347
348 if (RT_SUCCESS(rc))
349 {
350 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test #%RU32: Playing tone done\n", idxTest);
351
352 /* Give the audio stack a random amount of time for draining data before the next iteration. */
353 if (pTstEnv->cIterations > 1)
354 RTThreadSleep(RTRandU32Ex(2000, 5000)); /** @todo Implement some dedicated ATS command for this? */
355 }
356
357 if (RT_FAILURE(rc))
358 RTTestFailed(g_hTest, "Test #%RU32: Playing test tone failed with %Rrc\n", idxTest, rc);
359
360 return rc;
361}
362
363/**
364 * @copydoc FNAUDIOTESTDESTROY
365 */
366static DECLCALLBACK(int) audioTestPlayToneDestroy(PAUDIOTESTENV pTstEnv, void *pvCtx)
367{
368 RT_NOREF(pTstEnv, pvCtx);
369
370 return VINF_SUCCESS;
371}
372
373/**
374 * @copydoc FNAUDIOTESTSETUP
375 */
376static DECLCALLBACK(int) audioTestRecordToneSetup(PAUDIOTESTENV pTstEnv, PAUDIOTESTDESC pTstDesc, PAUDIOTESTPARMS pTstParmsAcq, void **ppvCtx)
377{
378 RT_NOREF(pTstDesc, ppvCtx);
379
380 int rc = VINF_SUCCESS;
381
382 if (strlen(pTstEnv->szDev))
383 {
384 rc = audioTestDriverStackSetDevice(pTstEnv->pDrvStack, PDMAUDIODIR_IN, pTstEnv->szDev);
385 if (RT_FAILURE(rc))
386 return rc;
387 }
388
389 pTstParmsAcq->enmType = AUDIOTESTTYPE_TESTTONE_RECORD;
390 pTstParmsAcq->enmDir = PDMAUDIODIR_IN;
391
392 pTstParmsAcq->TestTone = pTstEnv->ToneParms;
393
394 pTstParmsAcq->TestTone.Hdr.idxTest = pTstEnv->idxTest; /* Assign unique test ID. */
395
396 return rc;
397}
398
399/**
400 * @copydoc FNAUDIOTESTEXEC
401 */
402static DECLCALLBACK(int) audioTestRecordToneExec(PAUDIOTESTENV pTstEnv, void *pvCtx, PAUDIOTESTPARMS pTstParms)
403{
404 RT_NOREF(pvCtx);
405
406 int rc = VINF_SUCCESS;
407
408 PAUDIOTESTTONEPARMS const pToneParms = &pTstParms->TestTone;
409
410 uint32_t const idxTest = pToneParms->Hdr.idxTest;
411
412 RTTIMESPEC NowTimeSpec;
413 RTTimeExplode(&pToneParms->Hdr.tsCreated, RTTimeNow(&NowTimeSpec));
414
415 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test #%RU32: Recording test tone (%RU16Hz, %RU32ms)\n",
416 idxTest, (uint16_t)pToneParms->dbFreqHz, pToneParms->msDuration);
417
418 /*
419 * 1. Arm the (host) ValKit ATS with the playback parameters.
420 */
421 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
422 "Test #%RU32: Telling ValKit audio driver on host to inject recording data ...\n", idxTest);
423
424 rc = AudioTestSvcClientTonePlay(&pTstEnv->u.Host.AtsClValKit, &pTstParms->TestTone);
425 if (RT_SUCCESS(rc))
426 {
427 /*
428 * 2. Tell the guest ATS to start recording.
429 */
430 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test #%RU32: Telling VKAT on guest to record audio ...\n", idxTest);
431
432 rc = AudioTestSvcClientToneRecord(&pTstEnv->u.Host.AtsClGuest, &pTstParms->TestTone);
433 if (RT_FAILURE(rc))
434 RTTestFailed(g_hTest, "Test #%RU32: AudioTestSvcClientToneRecord() failed with %Rrc\n", idxTest, rc);
435 }
436 else
437 RTTestFailed(g_hTest, "Test #%RU32: AudioTestSvcClientTonePlay() failed with %Rrc\n", idxTest, rc);
438
439 if (RT_SUCCESS(rc))
440 {
441 /* Wait a bit to let the left over audio bits being processed. */
442 if (pTstEnv->cIterations > 1)
443 RTThreadSleep(RTRandU32Ex(2000, 5000)); /** @todo Implement some dedicated ATS command for this? */
444 }
445
446 if (RT_FAILURE(rc))
447 RTTestFailed(g_hTest, "Test #%RU32: Recording test tone failed with %Rrc\n", idxTest, rc);
448
449 return rc;
450}
451
452/**
453 * @copydoc FNAUDIOTESTDESTROY
454 */
455static DECLCALLBACK(int) audioTestRecordToneDestroy(PAUDIOTESTENV pTstEnv, void *pvCtx)
456{
457 RT_NOREF(pTstEnv, pvCtx);
458
459 return VINF_SUCCESS;
460}
461
462
463/*********************************************************************************************************************************
464* Test execution *
465*********************************************************************************************************************************/
466
467/** Test definition table. */
468AUDIOTESTDESC g_aTests[] =
469{
470 /* pszTest fExcluded pfnSetup */
471 { "PlayTone", false, audioTestPlayToneSetup, audioTestPlayToneExec, audioTestPlayToneDestroy },
472 { "RecordTone", false, audioTestRecordToneSetup, audioTestRecordToneExec, audioTestRecordToneDestroy }
473};
474/** Number of tests defined. */
475unsigned g_cTests = RT_ELEMENTS(g_aTests);
476
477/**
478 * Runs one specific audio test.
479 *
480 * @returns VBox status code.
481 * @param pTstEnv Test environment to use for running the test.
482 * @param pTstDesc Test to run.
483 */
484static int audioTestOne(PAUDIOTESTENV pTstEnv, PAUDIOTESTDESC pTstDesc)
485{
486 int rc = VINF_SUCCESS;
487
488 AUDIOTESTPARMS TstParms;
489 audioTestParmsInit(&TstParms);
490
491 RTTestSub(g_hTest, pTstDesc->pszName);
492
493 if (pTstDesc->fExcluded)
494 {
495 RTTestSkipped(g_hTest, "Test #%RU32 is excluded from list, skipping", pTstEnv->idxTest);
496 return VINF_SUCCESS;
497 }
498
499 pTstEnv->cIterations = pTstEnv->cIterations == 0 ? RTRandU32Ex(1, 10) : pTstEnv->cIterations;
500
501 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test #%RU32 (%RU32 iterations total)\n", pTstEnv->idxTest, pTstEnv->cIterations);
502
503 void *pvCtx = NULL; /* Test-specific opaque context. Optional and can be NULL. */
504
505 AssertPtr(pTstDesc->pfnExec);
506 for (uint32_t i = 0; i < pTstEnv->cIterations; i++)
507 {
508 int rc2;
509
510 if (pTstDesc->pfnSetup)
511 {
512 rc2 = pTstDesc->pfnSetup(pTstEnv, pTstDesc, &TstParms, &pvCtx);
513 if (RT_FAILURE(rc2))
514 RTTestFailed(g_hTest, "Test #%RU32 setup failed with %Rrc\n", pTstEnv->idxTest, rc2);
515 }
516 else
517 rc2 = VINF_SUCCESS;
518
519 if (RT_SUCCESS(rc2))
520 {
521 AssertPtrBreakStmt(pTstDesc->pfnExec, rc = VERR_INVALID_POINTER);
522 rc2 = pTstDesc->pfnExec(pTstEnv, pvCtx, &TstParms);
523 if (RT_FAILURE(rc2))
524 RTTestFailed(g_hTest, "Test #%RU32 execution failed with %Rrc\n", pTstEnv->idxTest, rc2);
525 }
526
527 if (pTstDesc->pfnDestroy)
528 {
529 rc2 = pTstDesc->pfnDestroy(pTstEnv, pvCtx);
530 if (RT_FAILURE(rc2))
531 RTTestFailed(g_hTest, "Test #%RU32 destruction failed with %Rrc\n", pTstEnv->idxTest, rc2);
532 }
533
534 if (RT_SUCCESS(rc))
535 rc = rc2;
536
537 /* Keep going. */
538 pTstEnv->idxTest++;
539 }
540
541 RTTestSubDone(g_hTest);
542
543 audioTestParmsDestroy(&TstParms);
544
545 return rc;
546}
547
548/**
549 * Runs all specified tests in a row.
550 *
551 * @returns VBox status code.
552 * @param pTstEnv Test environment to use for running all tests.
553 */
554int audioTestWorker(PAUDIOTESTENV pTstEnv)
555{
556 int rc = VINF_SUCCESS;
557
558 if (pTstEnv->enmMode == AUDIOTESTMODE_GUEST)
559 {
560 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Guest ATS running\n");
561
562 while (!g_fTerminate)
563 RTThreadSleep(100);
564
565 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Shutting down guest ATS ...\n");
566
567 int rc2 = AudioTestSvcStop(pTstEnv->pSrv);
568 if (RT_SUCCESS(rc))
569 rc = rc2;
570
571 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Guest ATS shutdown complete\n");
572 }
573 else if (pTstEnv->enmMode == AUDIOTESTMODE_HOST)
574 {
575 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using tag '%s'\n", pTstEnv->szTag);
576
577 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Telling ValKit audio driver on host to begin a new test set ...\n");
578 rc = AudioTestSvcClientTestSetBegin(&pTstEnv->u.Host.AtsClValKit, pTstEnv->szTag);
579 if (RT_SUCCESS(rc))
580 {
581 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Telling VKAT on guest to begin a new test set ...\n");
582 rc = AudioTestSvcClientTestSetBegin(&pTstEnv->u.Host.AtsClGuest, pTstEnv->szTag);
583 if (RT_FAILURE(rc))
584 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
585 "Beginning test set on guest failed with %Rrc\n", rc);
586 }
587 else
588 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
589 "Beginning test set on host (Validation Kit audio driver) failed with %Rrc\n", rc);
590
591 if (RT_SUCCESS(rc))
592 {
593 for (unsigned i = 0; i < RT_ELEMENTS(g_aTests); i++)
594 {
595 int rc2 = audioTestOne(pTstEnv, &g_aTests[i]);
596 if (RT_SUCCESS(rc))
597 rc = rc2;
598
599 if (g_fTerminate)
600 break;
601 }
602
603 if (RT_SUCCESS(rc))
604 {
605 /** @todo Fudge! */
606 RTMSINTERVAL const msWait = RTRandU32Ex(RT_MS_1SEC, RT_MS_5SEC);
607 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
608 "Waiting %RU32ms to let guest and the audio stack process remaining data ...\n", msWait);
609 RTThreadSleep(msWait);
610 }
611
612 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Ending test set on guest ...\n");
613 int rc2 = AudioTestSvcClientTestSetEnd(&pTstEnv->u.Host.AtsClGuest, pTstEnv->szTag);
614 if (RT_FAILURE(rc2))
615 {
616 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Ending test set on guest failed with %Rrc\n", rc2);
617 if (RT_SUCCESS(rc))
618 rc = rc2;
619 }
620
621 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Ending test set on host (Validation Kit audio driver) ...\n");
622 rc2 = AudioTestSvcClientTestSetEnd(&pTstEnv->u.Host.AtsClValKit, pTstEnv->szTag);
623 if (RT_FAILURE(rc2))
624 {
625 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
626 "Ending test set on host (Validation Kit audio driver) failed with %Rrc\n", rc2);
627 if (RT_SUCCESS(rc))
628 rc = rc2;
629 }
630
631 if ( !g_fTerminate
632 && RT_SUCCESS(rc))
633 {
634 /*
635 * Download guest + Validation Kit audio driver test sets to our output directory.
636 */
637 char szFileName[RTPATH_MAX];
638 if (RTStrPrintf2(szFileName, sizeof(szFileName), "%s-guest.tar.gz", pTstEnv->szTag))
639 {
640 rc = RTPathJoin(pTstEnv->u.Host.szPathTestSetGuest, sizeof(pTstEnv->u.Host.szPathTestSetGuest),
641 pTstEnv->szPathOut, szFileName);
642 if (RT_SUCCESS(rc))
643 {
644 if (RTStrPrintf2(szFileName, sizeof(szFileName), "%s-host.tar.gz", pTstEnv->szTag))
645 {
646 rc = RTPathJoin(pTstEnv->u.Host.szPathTestSetValKit, sizeof(pTstEnv->u.Host.szPathTestSetValKit),
647 pTstEnv->szPathOut, szFileName);
648 }
649 else
650 rc = VERR_BUFFER_OVERFLOW;
651 }
652 else
653 rc = VERR_BUFFER_OVERFLOW;
654
655 if (RT_SUCCESS(rc))
656 {
657 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Downloading guest test set to '%s'\n",
658 pTstEnv->u.Host.szPathTestSetGuest);
659 rc = AudioTestSvcClientTestSetDownload(&pTstEnv->u.Host.AtsClGuest,
660 pTstEnv->szTag, pTstEnv->u.Host.szPathTestSetGuest);
661 }
662
663 if (RT_SUCCESS(rc))
664 {
665 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Downloading host test set to '%s'\n",
666 pTstEnv->u.Host.szPathTestSetValKit);
667 rc = AudioTestSvcClientTestSetDownload(&pTstEnv->u.Host.AtsClValKit,
668 pTstEnv->szTag, pTstEnv->u.Host.szPathTestSetValKit);
669 }
670 }
671 else
672 rc = VERR_BUFFER_OVERFLOW;
673
674 if ( RT_SUCCESS(rc)
675 && !pTstEnv->fSkipVerify)
676 {
677 rc = audioVerifyOne(pTstEnv->u.Host.szPathTestSetGuest, pTstEnv->u.Host.szPathTestSetValKit, NULL /* pOpts */);
678 }
679 else
680 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verification skipped\n");
681
682 if (!pTstEnv->fSkipVerify)
683 {
684 RTFileDelete(pTstEnv->u.Host.szPathTestSetGuest);
685 RTFileDelete(pTstEnv->u.Host.szPathTestSetValKit);
686 }
687 else
688 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Leaving test set files behind\n");
689 }
690 }
691 }
692 else
693 rc = VERR_NOT_IMPLEMENTED;
694
695 /* Clean up. */
696 RTDirRemove(pTstEnv->szPathTemp);
697 RTDirRemove(pTstEnv->szPathOut);
698
699 if (RT_FAILURE(rc))
700 RTTestFailed(g_hTest, "Test worker failed with %Rrc", rc);
701
702 return rc;
703}
704
705/** Option help for the 'test' command. */
706static DECLCALLBACK(const char *) audioTestCmdTestHelp(PCRTGETOPTDEF pOpt)
707{
708 switch (pOpt->iShort)
709 {
710 case 'a': return "Exclude all tests from the list (useful to enable single tests later with --include)";
711 case 'b': return "The audio backend to use";
712 case 'd': return "Go via DrvAudio instead of directly interfacing with the backend";
713 case 'e': return "Exclude the given test id from the list";
714 case 'i': return "Include the given test id in the list";
715 case VKAT_TEST_OPT_COUNT: return "Number of test iterations to perform for selected tests\n"
716 " Default: random number";
717 case VKAT_TEST_OPT_DEV: return "Name of the input/output device to use\n"
718 " Default: default device";
719 case VKAT_TEST_OPT_TONE_DURATION_MS: return "Test tone duration to play / record (ms)\n"
720 " Default: random duration";
721 case VKAT_TEST_OPT_TONE_VOL_PERCENT: return "Test tone volume (percent)\n"
722 " Default: 100";
723 case VKAT_TEST_OPT_MODE: return "Test mode to use when running the tests\n"
724 " Available modes:\n"
725 " guest: Run as a guest-side ATS\n"
726 " host: Run as a host-side ATS";
727 case VKAT_TEST_OPT_NO_AUDIO_OK: return "Enables running without any found audio hardware (e.g. servers)";
728 case VKAT_TEST_OPT_NO_VERIFY: return "Skips the verification step";
729 case VKAT_TEST_OPT_OUTDIR: return "Output directory to use";
730 case VKAT_TEST_OPT_PAUSE: return "Not yet implemented";
731 case VKAT_TEST_OPT_PCM_HZ: return "PCM Hertz (Hz) rate to use\n"
732 " Default: 44100";
733 case VKAT_TEST_OPT_PCM_BIT: return "PCM sample bits (i.e. 16) to use\n"
734 " Default: 16";
735 case VKAT_TEST_OPT_PCM_CHAN: return "PCM channels to use\n"
736 " Default: 2";
737 case VKAT_TEST_OPT_PCM_SIGNED: return "PCM samples to use (signed = true, unsigned = false)\n"
738 " Default: true";
739 case VKAT_TEST_OPT_PROBE_BACKENDS: return "Probes all (available) backends until a working one is found";
740 case VKAT_TEST_OPT_TAG: return "Test set tag to use";
741 case VKAT_TEST_OPT_TEMPDIR: return "Temporary directory to use";
742 case VKAT_TEST_OPT_TIMEOUT: return "Timeout to use (in ms)\";"
743 " Default: 5 minutes (300000)";
744 case VKAT_TEST_OPT_VOL: return "Audio volume (percent) to use";
745 case VKAT_TEST_OPT_TCP_BIND_ADDRESS: return "TCP address listening to (server mode)";
746 case VKAT_TEST_OPT_TCP_BIND_PORT: return "TCP port listening to (server mode)";
747 case VKAT_TEST_OPT_TCP_CONNECT_ADDRESS: return "TCP address to connect to (client mode)";
748 case VKAT_TEST_OPT_TCP_CONNECT_PORT: return "TCP port to connect to (client mode)";
749 default:
750 break;
751 }
752 return NULL;
753}
754
755/**
756 * Main (entry) function for the testing functionality of VKAT.
757 *
758 * @returns Program exit code.
759 * @param pGetState RTGetOpt state.
760 */
761static DECLCALLBACK(RTEXITCODE) audioTestMain(PRTGETOPTSTATE pGetState)
762{
763 AUDIOTESTENV TstEnv;
764 audioTestEnvInit(&TstEnv);
765
766 int rc;
767
768 PCPDMDRVREG pDrvReg = AudioTestGetDefaultBackend();
769 uint8_t cPcmSampleBit = 0;
770 uint8_t cPcmChannels = 0;
771 uint32_t uPcmHz = 0;
772 bool fPcmSigned = true;
773 bool fProbeBackends = false;
774 bool fNoAudioOk = false;
775
776 int ch;
777 RTGETOPTUNION ValueUnion;
778 while ((ch = RTGetOpt(pGetState, &ValueUnion)))
779 {
780 switch (ch)
781 {
782 case 'a':
783 for (unsigned i = 0; i < RT_ELEMENTS(g_aTests); i++)
784 g_aTests[i].fExcluded = true;
785 break;
786
787 case 'b':
788 pDrvReg = AudioTestFindBackendOpt(ValueUnion.psz);
789 if (pDrvReg == NULL)
790 return RTEXITCODE_SYNTAX;
791 break;
792
793 case 'd':
794 TstEnv.IoOpts.fWithDrvAudio = true;
795 break;
796
797 case 'e':
798 if (ValueUnion.u32 >= RT_ELEMENTS(g_aTests))
799 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid test number %u passed to --exclude", ValueUnion.u32);
800 g_aTests[ValueUnion.u32].fExcluded = true;
801 break;
802
803 case VKAT_TEST_OPT_MODE:
804 if (TstEnv.enmMode != AUDIOTESTMODE_UNKNOWN)
805 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Test mode (guest / host) already specified");
806 TstEnv.enmMode = RTStrICmp(ValueUnion.psz, "guest") == 0 ? AUDIOTESTMODE_GUEST : AUDIOTESTMODE_HOST;
807 break;
808
809 case VKAT_TEST_OPT_NO_AUDIO_OK:
810 fNoAudioOk = true;
811 break;
812
813 case VKAT_TEST_OPT_NO_VERIFY:
814 TstEnv.fSkipVerify = true;
815 break;
816
817 case 'i':
818 if (ValueUnion.u32 >= RT_ELEMENTS(g_aTests))
819 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Invalid test number %u passed to --include", ValueUnion.u32);
820 g_aTests[ValueUnion.u32].fExcluded = false;
821 break;
822
823 case VKAT_TEST_OPT_COUNT:
824 TstEnv.cIterations = ValueUnion.u32;
825 break;
826
827 case VKAT_TEST_OPT_DEV:
828 rc = RTStrCopy(TstEnv.szDev, sizeof(TstEnv.szDev), ValueUnion.psz);
829 if (RT_FAILURE(rc))
830 return RTMsgErrorExitFailure("Failed to copy out device: %Rrc", rc);
831 break;
832
833 case VKAT_TEST_OPT_TONE_DURATION_MS:
834 TstEnv.ToneParms.msDuration = ValueUnion.u32;
835 break;
836
837 case VKAT_TEST_OPT_TONE_VOL_PERCENT:
838 TstEnv.ToneParms.uVolumePercent = ValueUnion.u8;
839 break;
840
841 case VKAT_TEST_OPT_PAUSE:
842 return RTMsgErrorExitFailure("Not yet implemented!");
843
844 case VKAT_TEST_OPT_OUTDIR:
845 rc = RTStrCopy(TstEnv.szPathOut, sizeof(TstEnv.szPathOut), ValueUnion.psz);
846 if (RT_FAILURE(rc))
847 return RTMsgErrorExitFailure("Failed to copy out directory: %Rrc", rc);
848 break;
849
850 case VKAT_TEST_OPT_PCM_BIT:
851 cPcmSampleBit = ValueUnion.u8;
852 break;
853
854 case VKAT_TEST_OPT_PCM_CHAN:
855 cPcmChannels = ValueUnion.u8;
856 break;
857
858 case VKAT_TEST_OPT_PCM_HZ:
859 uPcmHz = ValueUnion.u32;
860 break;
861
862 case VKAT_TEST_OPT_PCM_SIGNED:
863 fPcmSigned = ValueUnion.f;
864 break;
865
866 case VKAT_TEST_OPT_PROBE_BACKENDS:
867 fProbeBackends = true;
868 break;
869
870 case VKAT_TEST_OPT_TAG:
871 rc = RTStrCopy(TstEnv.szTag, sizeof(TstEnv.szTag), ValueUnion.psz);
872 if (RT_FAILURE(rc))
873 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Tag invalid, rc=%Rrc", rc);
874 break;
875
876 case VKAT_TEST_OPT_TEMPDIR:
877 rc = RTStrCopy(TstEnv.szPathTemp, sizeof(TstEnv.szPathTemp), ValueUnion.psz);
878 if (RT_FAILURE(rc))
879 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Temp dir invalid, rc=%Rrc", rc);
880 break;
881
882 case VKAT_TEST_OPT_TIMEOUT:
883 if (!ValueUnion.u32)
884 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Invalid timeout value given!");
885 TstEnv.msTimeout = ValueUnion.u32;
886 break;
887
888 case VKAT_TEST_OPT_VOL:
889 TstEnv.IoOpts.uVolumePercent = ValueUnion.u8;
890 break;
891
892 case VKAT_TEST_OPT_TCP_BIND_ADDRESS:
893 rc = RTStrCopy(TstEnv.TcpOpts.szBindAddr, sizeof(TstEnv.TcpOpts.szBindAddr), ValueUnion.psz);
894 if (RT_FAILURE(rc))
895 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Bind address invalid, rc=%Rrc", rc);
896 break;
897
898 case VKAT_TEST_OPT_TCP_BIND_PORT:
899 TstEnv.TcpOpts.uBindPort = ValueUnion.u16;
900 break;
901
902 case VKAT_TEST_OPT_TCP_CONNECT_ADDRESS:
903 rc = RTStrCopy(TstEnv.TcpOpts.szConnectAddr, sizeof(TstEnv.TcpOpts.szConnectAddr), ValueUnion.psz);
904 if (RT_FAILURE(rc))
905 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Connect address invalid, rc=%Rrc", rc);
906 break;
907
908 case VKAT_TEST_OPT_TCP_CONNECT_PORT:
909 TstEnv.TcpOpts.uConnectPort = ValueUnion.u16;
910 break;
911
912 AUDIO_TEST_COMMON_OPTION_CASES(ValueUnion, &g_CmdTest);
913
914 default:
915 return RTGetOptPrintError(ch, &ValueUnion);
916 }
917 }
918
919 /*
920 * Start testing.
921 */
922 RTTestBanner(g_hTest);
923
924 if (TstEnv.enmMode == AUDIOTESTMODE_UNKNOWN)
925 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "No test mode (--mode) specified!\n");
926
927 /* Validate TCP options. */
928 if ( TstEnv.TcpOpts.szBindAddr[0]
929 && TstEnv.TcpOpts.szConnectAddr[0])
930 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Only one TCP connection mode (connect as client *or* bind as server) can be specified) at a time!\n");
931
932 /* Set new (override standard) I/O PCM properties if set by the user. */
933 if ( cPcmSampleBit
934 || cPcmChannels
935 || uPcmHz)
936 {
937 PDMAudioPropsInit(&TstEnv.IoOpts.Props,
938 cPcmSampleBit ? cPcmSampleBit / 2 : 2 /* 16-bit */, fPcmSigned /* fSigned */,
939 cPcmChannels ? cPcmChannels : 2 /* Stereo */, uPcmHz ? uPcmHz : 44100);
940 }
941
942 /* Do this first before everything else below. */
943 rc = AudioTestDriverStackPerformSelftest();
944 if (RT_FAILURE(rc))
945 {
946 if (!fNoAudioOk)
947 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Testing driver stack failed: %Rrc\n", rc);
948 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
949 "Warning: Testing driver stack not possible (%Rrc), but --no-audio-ok was specified. Running on a server without audio hardware?\n", rc);
950 }
951
952 AUDIOTESTDRVSTACK DrvStack;
953 if (fProbeBackends)
954 rc = audioTestDriverStackProbe(&DrvStack,
955 true /* fEnabledIn */, true /* fEnabledOut */, TstEnv.IoOpts.fWithDrvAudio); /** @todo Make in/out configurable, too. */
956 else
957 rc = audioTestDriverStackInitEx(&DrvStack, pDrvReg,
958 true /* fEnabledIn */, true /* fEnabledOut */, TstEnv.IoOpts.fWithDrvAudio); /** @todo Make in/out configurable, too. */
959 if (RT_FAILURE(rc))
960 {
961 if (!fNoAudioOk)
962 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Unable to init driver stack: %Rrc\n", rc);
963 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
964 "Warning: Initializing driver stack not possible (%Rrc), but --no-audio-ok was specified. Running on a server without audio hardware?\n", rc);
965 }
966
967 PPDMAUDIOHOSTDEV pDev;
968 rc = audioTestDevicesEnumerateAndCheck(&DrvStack, TstEnv.szDev, &pDev);
969 if (RT_FAILURE(rc))
970 {
971 if (!fNoAudioOk)
972 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Enumerating device(s) failed: %Rrc\n", rc);
973 }
974
975 /* For now all tests have the same test environment and driver stack. */
976 rc = audioTestEnvCreate(&TstEnv, &DrvStack);
977 if (RT_SUCCESS(rc))
978 rc = audioTestWorker(&TstEnv);
979
980 audioTestEnvDestroy(&TstEnv);
981 audioTestDriverStackDelete(&DrvStack);
982
983 if (RT_FAILURE(rc)) /* Let us know that something went wrong in case we forgot to mention it. */
984 RTTestFailed(g_hTest, "Testing failed with %Rrc\n", rc);
985
986 /*
987 * Print summary and exit.
988 */
989 return RTTestSummaryAndDestroy(g_hTest);
990}
991
992
993const VKATCMD g_CmdTest =
994{
995 "test",
996 audioTestMain,
997 "Runs audio tests and creates an audio test set.",
998 g_aCmdTestOptions,
999 RT_ELEMENTS(g_aCmdTestOptions),
1000 audioTestCmdTestHelp,
1001 true /* fNeedsTransport */
1002};
1003
1004
1005/*********************************************************************************************************************************
1006* Command: verify *
1007*********************************************************************************************************************************/
1008
1009static int audioVerifyOpenTestSet(const char *pszPathSet, PAUDIOTESTSET pSet)
1010{
1011 int rc;
1012
1013 char szPathExtracted[RTPATH_MAX];
1014
1015 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Opening test set '%s'\n", pszPathSet);
1016
1017 const bool fPacked = AudioTestSetIsPacked(pszPathSet);
1018
1019 if (fPacked)
1020 {
1021 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test set is an archive and needs to be unpacked\n");
1022
1023 if (!RTFileExists(pszPathSet))
1024 {
1025 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Test set '%s' does not exist\n", pszPathSet);
1026 rc = VERR_FILE_NOT_FOUND;
1027 }
1028 else
1029 rc = VINF_SUCCESS;
1030
1031 if (RT_SUCCESS(rc))
1032 {
1033 char szPathTemp[RTPATH_MAX];
1034 rc = RTPathTemp(szPathTemp, sizeof(szPathTemp));
1035 if (RT_SUCCESS(rc))
1036 {
1037 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Using temporary directory '%s'\n", szPathTemp);
1038
1039 rc = RTPathJoin(szPathExtracted, sizeof(szPathExtracted), szPathTemp, "vkat-testset-XXXX");
1040 if (RT_SUCCESS(rc))
1041 {
1042 rc = RTDirCreateTemp(szPathExtracted, 0755);
1043 if (RT_SUCCESS(rc))
1044 {
1045 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Unpacking archive to '%s'\n", szPathExtracted);
1046 rc = AudioTestSetUnpack(pszPathSet, szPathExtracted);
1047 if (RT_SUCCESS(rc))
1048 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Archive successfully unpacked\n");
1049 }
1050 }
1051 }
1052 }
1053 }
1054 else
1055 rc = VINF_SUCCESS;
1056
1057 if (RT_SUCCESS(rc))
1058 rc = AudioTestSetOpen(pSet, fPacked ? szPathExtracted : pszPathSet);
1059
1060 if (RT_FAILURE(rc))
1061 RTTestFailed(g_hTest, "Unable to open / unpack test set archive: %Rrc", rc);
1062
1063 return rc;
1064}
1065
1066/**
1067 * Verifies one test set pair.
1068 *
1069 * @returns VBox status code.
1070 * @param pszPathSetA Absolute path to test set A.
1071 * @param pszPathSetB Absolute path to test set B.
1072 * @param pOpts Verification options to use. Optional.
1073 * When NULL, the (very strict) defaults will be used.
1074 */
1075static int audioVerifyOne(const char *pszPathSetA, const char *pszPathSetB, PAUDIOTESTVERIFYOPTS pOpts)
1076{
1077 RTTestSubF(g_hTest, "Verifying");
1078 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verifying test set '%s' with test set '%s'\n", pszPathSetA, pszPathSetB);
1079
1080 AUDIOTESTSET SetA, SetB;
1081 int rc = audioVerifyOpenTestSet(pszPathSetA, &SetA);
1082 if (RT_SUCCESS(rc))
1083 {
1084 rc = audioVerifyOpenTestSet(pszPathSetB, &SetB);
1085 if (RT_SUCCESS(rc))
1086 {
1087 AUDIOTESTERRORDESC errDesc;
1088 if (pOpts)
1089 rc = AudioTestSetVerifyEx(&SetA, &SetB, pOpts, &errDesc);
1090 else
1091 rc = AudioTestSetVerify(&SetA, &SetB, &errDesc);
1092 if (RT_SUCCESS(rc))
1093 {
1094 uint32_t const cErr = AudioTestErrorDescCount(&errDesc);
1095 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "%RU32 errors occurred while verifying\n", cErr);
1096
1097 /** @todo Use some AudioTestErrorXXX API for enumeration here later. */
1098 PAUDIOTESTERRORENTRY pErrEntry;
1099 RTListForEach(&errDesc.List, pErrEntry, AUDIOTESTERRORENTRY, Node)
1100 {
1101 if (RT_FAILURE(pErrEntry->rc))
1102 RTTestFailed(g_hTest, "%s\n", pErrEntry->szDesc);
1103 else
1104 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "%s\n", pErrEntry->szDesc);
1105 }
1106
1107 if (cErr == 0)
1108 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "Verification successful\n");
1109
1110 AudioTestErrorDescDestroy(&errDesc);
1111 }
1112 else
1113 RTTestFailed(g_hTest, "Verification failed with %Rrc", rc);
1114
1115#ifdef DEBUG
1116 if (g_fDrvAudioDebug)
1117 RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS,
1118 "\n"
1119 "Use the following command line to re-run verification in the debugger:\n"
1120 "gdb --args ./VBoxAudioTest -vvvv --debug-audio verify \"%s\" \"%s\"\n",
1121 SetA.szPathAbs, SetB.szPathAbs);
1122#endif
1123 if (!g_fDrvAudioDebug) /* Don't wipe stuff when debugging. Can be useful for introspecting data. */
1124 AudioTestSetWipe(&SetB);
1125 AudioTestSetClose(&SetB);
1126 }
1127
1128 if (!g_fDrvAudioDebug) /* Ditto. */
1129 AudioTestSetWipe(&SetA);
1130 AudioTestSetClose(&SetA);
1131 }
1132
1133 RTTestSubDone(g_hTest);
1134
1135 return rc;
1136}
1137
1138/** Option help for the 'verify' command. */
1139static DECLCALLBACK(const char *) audioTestCmdVerifyHelp(PCRTGETOPTDEF pOpt)
1140{
1141 switch (pOpt->iShort)
1142 {
1143 case VKAT_VERIFY_OPT_MAX_DIFF_COUNT: return "Specifies the maximum number of differences\n"
1144 " Default: 0 (strict)";
1145 case VKAT_VERIFY_OPT_MAX_DIFF_PERCENT: return "Specifies the maximum difference (percent)\n"
1146 " Default: 0 (strict)";
1147 case VKAT_VERIFY_OPT_MAX_SIZE_PERCENT: return "Specifies the maximum size difference (percent)\n"
1148 " Default: 1 (strict)";
1149 case VKAT_VERIFY_OPT_NORMALIZE: return "Enables / disables audio data normalization\n"
1150 " Default: false";
1151 default:
1152 break;
1153 }
1154 return NULL;
1155}
1156
1157/**
1158 * Main (entry) function for the verification functionality of VKAT.
1159 *
1160 * @returns Program exit code.
1161 * @param pGetState RTGetOpt state.
1162 */
1163static DECLCALLBACK(RTEXITCODE) audioVerifyMain(PRTGETOPTSTATE pGetState)
1164{
1165 /*
1166 * Parse options and process arguments.
1167 */
1168 const char *apszSets[2] = { NULL, NULL };
1169 unsigned iTestSet = 0;
1170
1171 AUDIOTESTVERIFYOPTS Opts;
1172 AudioTestSetVerifyOptsInit(&Opts);
1173
1174 int ch;
1175 RTGETOPTUNION ValueUnion;
1176 while ((ch = RTGetOpt(pGetState, &ValueUnion)))
1177 {
1178 switch (ch)
1179 {
1180 case VKAT_VERIFY_OPT_MAX_DIFF_COUNT:
1181 Opts.cMaxDiff = ValueUnion.u32;
1182 break;
1183
1184 case VKAT_VERIFY_OPT_MAX_DIFF_PERCENT:
1185 Opts.uMaxDiffPercent = ValueUnion.u8;
1186 break;
1187
1188 case VKAT_VERIFY_OPT_MAX_SIZE_PERCENT:
1189 Opts.uMaxSizePercent = ValueUnion.u8;
1190 break;
1191
1192 case VKAT_VERIFY_OPT_NORMALIZE:
1193 Opts.fNormalize = ValueUnion.f;
1194 break;
1195
1196 case VINF_GETOPT_NOT_OPTION:
1197 if (iTestSet == 0)
1198 RTTestBanner(g_hTest);
1199 if (iTestSet >= RT_ELEMENTS(apszSets))
1200 return RTMsgErrorExitFailure("Only two test sets can be verified at one time");
1201 apszSets[iTestSet++] = ValueUnion.psz;
1202 break;
1203
1204 AUDIO_TEST_COMMON_OPTION_CASES(ValueUnion, &g_CmdVerify);
1205
1206 default:
1207 return RTGetOptPrintError(ch, &ValueUnion);
1208 }
1209 }
1210
1211 if (!iTestSet)
1212 return RTMsgErrorExitFailure("At least one test set must be specified");
1213
1214 int rc = VINF_SUCCESS;
1215
1216 /*
1217 * If only test set A is given, default to the current directory
1218 * for test set B.
1219 */
1220 char szDirCur[RTPATH_MAX];
1221 if (iTestSet == 1)
1222 {
1223 rc = RTPathGetCurrent(szDirCur, sizeof(szDirCur));
1224 if (RT_SUCCESS(rc))
1225 apszSets[1] = szDirCur;
1226 else
1227 RTTestFailed(g_hTest, "Failed to retrieve current directory: %Rrc", rc);
1228 }
1229
1230 if (RT_SUCCESS(rc))
1231 audioVerifyOne(apszSets[0], apszSets[1], &Opts);
1232
1233 /*
1234 * Print summary and exit.
1235 */
1236 return RTTestSummaryAndDestroy(g_hTest);
1237}
1238
1239
1240const VKATCMD g_CmdVerify =
1241{
1242 "verify",
1243 audioVerifyMain,
1244 "Verifies a formerly created audio test set.",
1245 g_aCmdVerifyOptions,
1246 RT_ELEMENTS(g_aCmdVerifyOptions),
1247 audioTestCmdVerifyHelp,
1248 false /* fNeedsTransport */
1249};
1250
1251
1252/*********************************************************************************************************************************
1253* Main *
1254*********************************************************************************************************************************/
1255
1256/**
1257 * Ctrl-C signal handler.
1258 *
1259 * This just sets g_fTerminate and hope it will be noticed soon.
1260 *
1261 * On non-Windows it restores the SIGINT action to default, so that a second
1262 * Ctrl-C will have the normal effect (just in case the code doesn't respond to
1263 * g_fTerminate).
1264 */
1265#ifdef RT_OS_WINDOWS
1266static BOOL CALLBACK audioTestConsoleCtrlHandler(DWORD dwCtrlType) RT_NOEXCEPT
1267{
1268 if (dwCtrlType != CTRL_C_EVENT && dwCtrlType != CTRL_BREAK_EVENT)
1269 return false;
1270 RTPrintf(dwCtrlType == CTRL_C_EVENT ? "Ctrl-C!\n" : "Ctrl-Break!\n");
1271
1272 ASMAtomicWriteBool(&g_fTerminate, true);
1273
1274 return true;
1275}
1276#else
1277static void audioTestSignalHandler(int iSig) RT_NOEXCEPT
1278{
1279 Assert(iSig == SIGINT); RT_NOREF(iSig);
1280 RTPrintf("Ctrl-C!\n");
1281
1282 ASMAtomicWriteBool(&g_fTerminate, true);
1283
1284 signal(SIGINT, SIG_DFL);
1285}
1286#endif
1287
1288/**
1289 * Commands.
1290 */
1291static const VKATCMD * const g_apCommands[] =
1292{
1293 &g_CmdTest,
1294 &g_CmdVerify,
1295 &g_CmdBackends,
1296 &g_CmdEnum,
1297 &g_CmdPlay,
1298 &g_CmdRec,
1299 &g_CmdSelfTest
1300};
1301
1302/**
1303 * Shows tool usage text.
1304 */
1305RTEXITCODE audioTestUsage(PRTSTREAM pStrm, PCVKATCMD pOnlyCmd)
1306{
1307 RTStrmPrintf(pStrm, "usage: %s [global options] <command> [command-options]\n", RTProcShortName());
1308 RTStrmPrintf(pStrm,
1309 "\n"
1310 "Global Options:\n"
1311 " --debug-audio\n"
1312 " Enables (DrvAudio) debugging\n"
1313 " --debug-audio-path=<path>\n"
1314 " Tells DrvAudio where to put its debug output (wav-files)\n"
1315 " -q, --quiet\n"
1316 " Sets verbosity to zero\n"
1317 " -v, --verbose\n"
1318 " Increase verbosity\n"
1319 " -V, --version\n"
1320 " Displays version\n"
1321 " -h, -?, --help\n"
1322 " Displays help\n"
1323 );
1324
1325 for (uintptr_t iCmd = 0; iCmd < RT_ELEMENTS(g_apCommands); iCmd++)
1326 {
1327 PCVKATCMD const pCmd = g_apCommands[iCmd];
1328 if (!pOnlyCmd || pCmd == pOnlyCmd)
1329 {
1330 RTStrmPrintf(pStrm,
1331 "\n"
1332 "Command '%s':\n"
1333 " %s\n"
1334 "Options for '%s':\n",
1335 pCmd->pszCommand, pCmd->pszDesc, pCmd->pszCommand);
1336 PCRTGETOPTDEF const paOptions = pCmd->paOptions;
1337 for (unsigned i = 0; i < pCmd->cOptions; i++)
1338 {
1339 if (RT_C_IS_PRINT(paOptions[i].iShort))
1340 RTStrmPrintf(pStrm, " -%c, %s\n", paOptions[i].iShort, paOptions[i].pszLong);
1341 else
1342 RTStrmPrintf(pStrm, " %s\n", paOptions[i].pszLong);
1343
1344 const char *pszHelp = NULL;
1345 if (pCmd->pfnOptionHelp)
1346 pszHelp = pCmd->pfnOptionHelp(&paOptions[i]);
1347 if (pszHelp)
1348 RTStrmPrintf(pStrm, " %s\n", pszHelp);
1349 }
1350
1351 if (pCmd->fNeedsTransport)
1352 for (uintptr_t iTx = 0; iTx < g_cTransports; iTx++)
1353 g_apTransports[iTx]->pfnUsage(pStrm);
1354 }
1355 }
1356
1357 return RTEXITCODE_SUCCESS;
1358}
1359
1360/**
1361 * Lists the commands and their descriptions.
1362 */
1363static RTEXITCODE audioTestListCommands(PRTSTREAM pStrm)
1364{
1365 RTStrmPrintf(pStrm, "Commands:\n");
1366 for (uintptr_t iCmd = 0; iCmd < RT_ELEMENTS(g_apCommands); iCmd++)
1367 RTStrmPrintf(pStrm, "%8s - %s\n", g_apCommands[iCmd]->pszCommand, g_apCommands[iCmd]->pszDesc);
1368 return RTEXITCODE_SUCCESS;
1369}
1370
1371/**
1372 * Shows tool version.
1373 */
1374RTEXITCODE audioTestVersion(void)
1375{
1376 RTPrintf("%s\n", RTBldCfgRevisionStr());
1377 return RTEXITCODE_SUCCESS;
1378}
1379
1380/**
1381 * Shows the logo.
1382 *
1383 * @param pStream Output stream to show logo on.
1384 */
1385void audioTestShowLogo(PRTSTREAM pStream)
1386{
1387 RTStrmPrintf(pStream, VBOX_PRODUCT " VKAT (Validation Kit Audio Test) Version " VBOX_VERSION_STRING " - r%s\n"
1388 "Copyright (C) " VBOX_C_YEAR " " VBOX_VENDOR "\n\n", RTBldCfgRevisionStr());
1389}
1390
1391int main(int argc, char **argv)
1392{
1393 /*
1394 * Init IPRT.
1395 */
1396 int rc = RTR3InitExe(argc, &argv, 0);
1397 if (RT_FAILURE(rc))
1398 return RTMsgInitFailure(rc);
1399
1400 /*
1401 * Handle special command line options which need parsing before
1402 * everything else.
1403 */
1404 /** @todo r=bird: this isn't at all syntactically sane, because you don't know
1405 * how to parse past the command (can almost be done safely thought, since
1406 * you've got the option definitions for every command at hand). So, if someone
1407 * wants to play a file named "-v.wav", you'll incorrectly take that as two 'v'
1408 * options. The parsing has to stop when you get to the command, i.e. first
1409 * VINF_GETOPT_NOT_OPTION or anything that isn't a common option. Daemonizing
1410 * when for instance encountering an invalid command, is not correct.
1411 *
1412 * Btw. you MUST however process the 'q' option in parallel to 'v' here, they
1413 * are oposites. For instance '-vqvvv' is supposed to give you level 3 logging,
1414 * not quiet! So, either you process both 'v' and 'q' here, or you pospone them
1415 * (better option).
1416 */
1417 /** @todo r=bird: Is the daemonizing needed? The testcase doesn't seem to use
1418 * it... If you don't need it, drop it as it make the parsing complex
1419 * and illogical. The --daemonized / --damonize options should be
1420 * required to before the command, then okay. */
1421 bool fDaemonize = false;
1422 bool fDaemonized = false;
1423
1424 RTGETOPTSTATE GetState;
1425 rc = RTGetOptInit(&GetState, argc, argv, g_aCmdCommonOptions,
1426 RT_ELEMENTS(g_aCmdCommonOptions), 1 /*idxFirst*/, 0 /*fFlags - must not sort! */);
1427 AssertRCReturn(rc, RTEXITCODE_INIT);
1428
1429 int ch;
1430 RTGETOPTUNION ValueUnion;
1431 while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
1432 {
1433 switch (ch)
1434 {
1435 case AUDIO_TEST_OPT_CMN_DAEMONIZE:
1436 fDaemonize = true;
1437 break;
1438
1439 case AUDIO_TEST_OPT_CMN_DAEMONIZED:
1440 fDaemonized = true;
1441 break;
1442
1443 /* Has to be defined here and not in AUDIO_TEST_COMMON_OPTION_CASES, to get the logger
1444 * configured before the specific command handlers down below come into play. */
1445 case 'v':
1446 g_uVerbosity++;
1447 break;
1448
1449 default:
1450 break;
1451 }
1452 }
1453
1454 /** @todo add something to suppress this stuff. */
1455 audioTestShowLogo(g_pStdOut);
1456
1457 if (fDaemonize)
1458 {
1459 if (!fDaemonized)
1460 {
1461 rc = RTProcDaemonize(argv, "--daemonized");
1462 if (RT_FAILURE(rc))
1463 return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTProcDaemonize() failed with %Rrc\n", rc);
1464
1465 RTMsgInfo("Starting in background (daemonizing) ...");
1466 return RTEXITCODE_SUCCESS;
1467 }
1468 /* else continue running in background. */
1469 }
1470
1471 /*
1472 * Init test and globals.
1473 * Note: Needs to be done *after* daemonizing, otherwise the child will fail!
1474 */
1475 rc = RTTestCreate("AudioTest", &g_hTest);
1476 if (RT_FAILURE(rc))
1477 return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTTestCreate() failed with %Rrc\n", rc);
1478
1479#ifdef RT_OS_WINDOWS
1480 HRESULT hrc = CoInitializeEx(NULL /*pReserved*/, COINIT_MULTITHREADED | COINIT_SPEED_OVER_MEMORY | COINIT_DISABLE_OLE1DDE);
1481 if (FAILED(hrc))
1482 RTMsgWarning("CoInitializeEx failed: %#x", hrc);
1483#endif
1484
1485 /*
1486 * Configure release logging to go to stdout.
1487 */
1488 RTUINT fFlags = RTLOGFLAGS_PREFIX_THREAD | RTLOGFLAGS_PREFIX_TIME_PROG;
1489#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
1490 fFlags |= RTLOGFLAGS_USECRLF;
1491#endif
1492 static const char * const s_apszLogGroups[] = VBOX_LOGGROUP_NAMES;
1493 rc = RTLogCreate(&g_pRelLogger, fFlags, "all.e.l", "VKAT_RELEASE_LOG",
1494 RT_ELEMENTS(s_apszLogGroups), s_apszLogGroups, RTLOGDEST_STDOUT, NULL /*"vkat-release.log"*/);
1495 if (RT_SUCCESS(rc))
1496 {
1497 RTLogRelSetDefaultInstance(g_pRelLogger);
1498 if (g_uVerbosity)
1499 {
1500 RTMsgInfo("Setting verbosity logging to level %u\n", g_uVerbosity);
1501 switch (g_uVerbosity) /* Not very elegant, but has to do it for now. */
1502 {
1503 case 1:
1504 rc = RTLogGroupSettings(g_pRelLogger,
1505 "drv_audio.e.l+drv_host_audio.e.l+"
1506 "audio_mixer.e.l+audio_test.e.l");
1507 break;
1508
1509 case 2:
1510 rc = RTLogGroupSettings(g_pRelLogger,
1511 "drv_audio.e.l.l2+drv_host_audio.e.l.l2+"
1512 "audio_mixer.e.l.l2+audio_test.e.l.l2");
1513 break;
1514
1515 case 3:
1516 rc = RTLogGroupSettings(g_pRelLogger,
1517 "drv_audio.e.l.l2.l3+drv_host_audio.e.l.l2.l3+"
1518 "audio_mixer.e.l.l2.l3+audio_test.e.l.l2.l3");
1519 break;
1520
1521 case 4:
1522 RT_FALL_THROUGH();
1523 default:
1524 rc = RTLogGroupSettings(g_pRelLogger,
1525 "drv_audio.e.l.l2.l3.l4.f+drv_host_audio.e.l.l2.l3.l4.f+"
1526 "audio_mixer.e.l.l2.l3.l4.f+audio_test.e.l.l2.l3.l4.f");
1527 break;
1528 }
1529 if (RT_FAILURE(rc))
1530 RTMsgError("Setting debug logging failed, rc=%Rrc\n", rc);
1531 }
1532 }
1533 else
1534 RTMsgWarning("Failed to create release logger: %Rrc", rc);
1535
1536 /*
1537 * Install a Ctrl-C signal handler.
1538 */
1539#ifdef RT_OS_WINDOWS
1540 SetConsoleCtrlHandler(audioTestConsoleCtrlHandler, TRUE);
1541#else
1542 struct sigaction sa;
1543 RT_ZERO(sa);
1544 sa.sa_handler = audioTestSignalHandler;
1545 sigaction(SIGINT, &sa, NULL);
1546#endif
1547
1548 /*
1549 * Process common options.
1550 */
1551 RT_ZERO(GetState);
1552 rc = RTGetOptInit(&GetState, argc, argv, g_aCmdCommonOptions,
1553 RT_ELEMENTS(g_aCmdCommonOptions), 1 /*idxFirst*/, 0 /*fFlags - must not sort! */);
1554 AssertRCReturn(rc, RTEXITCODE_INIT);
1555
1556 while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
1557 {
1558 switch (ch)
1559 {
1560 AUDIO_TEST_COMMON_OPTION_CASES(ValueUnion, NULL);
1561
1562 case VINF_GETOPT_NOT_OPTION:
1563 {
1564 for (uintptr_t iCmd = 0; iCmd < RT_ELEMENTS(g_apCommands); iCmd++)
1565 {
1566 PCVKATCMD const pCmd = g_apCommands[iCmd];
1567 if (strcmp(ValueUnion.psz, pCmd->pszCommand) == 0)
1568 {
1569 /* Count the combined option definitions: */
1570 size_t cCombinedOptions = pCmd->cOptions + RT_ELEMENTS(g_aCmdCommonOptions);
1571 if (pCmd->fNeedsTransport)
1572 for (uintptr_t iTx = 0; iTx < g_cTransports; iTx++)
1573 cCombinedOptions += g_apTransports[iTx]->cOpts;
1574
1575 /* Combine the option definitions: */
1576 PRTGETOPTDEF paCombinedOptions = (PRTGETOPTDEF)RTMemAlloc(cCombinedOptions * sizeof(RTGETOPTDEF));
1577 if (paCombinedOptions)
1578 {
1579 uint32_t idxOpts = 0;
1580 memcpy(paCombinedOptions, g_aCmdCommonOptions, sizeof(g_aCmdCommonOptions));
1581 idxOpts += RT_ELEMENTS(g_aCmdCommonOptions);
1582
1583 memcpy(&paCombinedOptions[idxOpts], pCmd->paOptions, pCmd->cOptions * sizeof(RTGETOPTDEF));
1584 idxOpts += (uint32_t)pCmd->cOptions;
1585
1586 if (pCmd->fNeedsTransport)
1587 for (uintptr_t iTx = 0; iTx < g_cTransports; iTx++)
1588 {
1589 memcpy(&paCombinedOptions[idxOpts],
1590 g_apTransports[iTx]->paOpts, g_apTransports[iTx]->cOpts * sizeof(RTGETOPTDEF));
1591 idxOpts += (uint32_t)g_apTransports[iTx]->cOpts;
1592 }
1593
1594 /* Re-initialize the option getter state and pass it to the command handler. */
1595 rc = RTGetOptInit(&GetState, argc, argv, paCombinedOptions, cCombinedOptions,
1596 GetState.iNext /*idxFirst*/, RTGETOPTINIT_FLAGS_OPTS_FIRST);
1597 if (RT_SUCCESS(rc))
1598 {
1599 RTEXITCODE rcExit = pCmd->pfnHandler(&GetState);
1600 RTMemFree(paCombinedOptions);
1601 return rcExit;
1602 }
1603 RTMemFree(paCombinedOptions);
1604 return RTMsgErrorExitFailure("RTGetOptInit failed for '%s': %Rrc", ValueUnion.psz, rc);
1605 }
1606 return RTMsgErrorExitFailure("Out of memory!");
1607 }
1608 }
1609 RTMsgError("Unknown command '%s'!\n", ValueUnion.psz);
1610 audioTestListCommands(g_pStdErr);
1611 return RTEXITCODE_SYNTAX;
1612 }
1613
1614 default:
1615 return RTGetOptPrintError(ch, &ValueUnion);
1616 }
1617 }
1618
1619 RTMsgError("No command specified!\n");
1620 audioTestListCommands(g_pStdErr);
1621 return RTEXITCODE_SYNTAX;
1622}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette