- Timestamp:
- Jun 22, 2021 3:36:51 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145296
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89769 r89839 591 591 * @param idxTest Index of failing test (zero-based). 592 592 * @param rc Result code of entry to add. 593 * @param psz DescError description format string to add.594 * @param argsOptional format arguments of \a pszDesc to add.595 */ 596 static int audioTestErrorDescAddV(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, int rc, const char *psz Desc, va_list args)593 * @param pszFormat Error description format string to add. 594 * @param va Optional format arguments of \a pszDesc to add. 595 */ 596 static int audioTestErrorDescAddV(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, int rc, const char *pszFormat, va_list va) 597 597 { 598 598 PAUDIOTESTERRORENTRY pEntry = (PAUDIOTESTERRORENTRY)RTMemAlloc(sizeof(AUDIOTESTERRORENTRY)); … … 600 600 601 601 char *pszDescTmp; 602 if (RTStrAPrintf (&pszDescTmp, pszDesc, args) < 0)602 if (RTStrAPrintfV(&pszDescTmp, pszFormat, va) < 0) 603 603 AssertFailedReturn(VERR_NO_MEMORY); 604 604 … … 622 622 * @param pErr Test error description to add entry for. 623 623 * @param idxTest Index of failing test (zero-based). 624 * @param psz DescError description format string to add.624 * @param pszFormat Error description format string to add. 625 625 * @param ... Optional format arguments of \a pszDesc to add. 626 626 */ 627 static int audioTestErrorDescAdd(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, const char *psz Desc, ...)627 static int audioTestErrorDescAdd(PAUDIOTESTERRORDESC pErr, uint32_t idxTest, const char *pszFormat, ...) 628 628 { 629 629 va_list va; 630 va_start(va, psz Desc);631 632 int rc = audioTestErrorDescAddV(pErr, idxTest, VERR_GENERAL_FAILURE /** @todo Fudge! */, psz Desc, va);630 va_start(va, pszFormat); 631 632 int rc = audioTestErrorDescAddV(pErr, idxTest, VERR_GENERAL_FAILURE /** @todo Fudge! */, pszFormat, va); 633 633 634 634 va_end(va); … … 1637 1637 } 1638 1638 1639 #define CHECK_RC_MAYBE_RET(a_rc, a_pVerJob) \ 1640 if (RT_FAILURE(a_rc)) \ 1641 { \ 1642 if (!a_pVerJob->fKeepGoing) \ 1643 return VINF_SUCCESS; \ 1644 } 1645 1646 #define CHECK_RC_MSG_MAYBE_RET(a_rc, a_pVerJob, a_Msg) \ 1647 if (RT_FAILURE(a_rc)) \ 1648 { \ 1649 int rc3 = audioTestErrorDescAdd(a_pVerJob->pErr, a_pVerJob->idxTest, (a_Msg)); \ 1650 AssertRC(rc3); \ 1651 if (!a_pVerJob->fKeepGoing) \ 1652 return VINF_SUCCESS; \ 1653 } 1654 1639 1655 /** 1640 1656 * Does the actual PCM data verification of a test tone. 1641 1657 * 1642 1658 * @returns VBox status code. 1643 * @param pVer ifyVerification job to verify PCM data for.1659 * @param pVerJob Verification job to verify PCM data for. 1644 1660 * @param phTest Test handle of test to verify PCM data for. 1645 1661 */ 1646 static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVer ify, PAUDIOTESTOBJHANDLE phTest)1662 static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerJob, PAUDIOTESTOBJHANDLE phTest) 1647 1663 { 1648 1664 int rc; … … 1651 1667 1652 1668 char szObjA[128]; 1653 rc = audioTestGetValueStr(pVerify->pSetA, phTest, "obj0_uuid", szObjA, sizeof(szObjA)); 1654 AssertRCReturn(rc, rc); 1669 rc = audioTestGetValueStr(pVerJob->pSetA, phTest, "obj0_uuid", szObjA, sizeof(szObjA)); 1655 1670 PAUDIOTESTOBJ pObjA; 1656 rc = audioTestSetObjOpen(pVer ify->pSetA, szObjA, &pObjA);1657 AssertRCReturn(rc, rc);1671 rc = audioTestSetObjOpen(pVerJob->pSetA, szObjA, &pObjA); 1672 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Unable to open object A '%s'", szObjA)); 1658 1673 1659 1674 char szObjB[128]; 1660 rc = audioTestGetValueStr(pVerify->pSetB, phTest, "obj0_uuid", szObjB, sizeof(szObjB)); 1661 AssertRCReturn(rc, rc); 1675 rc = audioTestGetValueStr(pVerJob->pSetB, phTest, "obj0_uuid", szObjB, sizeof(szObjB)); 1662 1676 PAUDIOTESTOBJ pObjB; 1663 rc = audioTestSetObjOpen(pVer ify->pSetB, szObjB, &pObjB);1664 AssertRCReturn(rc, rc);1677 rc = audioTestSetObjOpen(pVerJob->pSetB, szObjB, &pObjB); 1678 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Unable to open object B '%s'", szObjB)); 1665 1679 1666 1680 AssertReturn(pObjA->enmType == AUDIOTESTOBJTYPE_FILE, VERR_NOT_SUPPORTED); … … 1680 1694 /** @todo Add more sophisticated stuff here. */ 1681 1695 1682 int rc2 = audioTestErrorDescAdd(pVer ify->pErr, pVerify->idxTest, "Files '%s' and '%s' don't match\n", szObjA, szObjB);1696 int rc2 = audioTestErrorDescAdd(pVerJob->pErr, pVerJob->idxTest, "Files '%s' and '%s' don't match\n", szObjA, szObjB); 1683 1697 AssertRC(rc2); 1684 1698 } … … 1775 1789 VerJob.fKeepGoing = true; 1776 1790 1791 PAUDIOTESTVERIFYJOB pVerJob = &VerJob; 1792 1777 1793 int rc; 1778 1794 … … 1784 1800 1785 1801 rc = audioTestVerifyValue(&VerJob, &hHdr, "magic", "vkat_ini", "Manifest magic wrong"); 1786 AssertRCReturn(rc, rc);1802 CHECK_RC_MAYBE_RET(rc, pVerJob); 1787 1803 rc = audioTestVerifyValue(&VerJob, &hHdr, "ver", "1" , "Manifest version wrong"); 1788 AssertRCReturn(rc, rc);1804 CHECK_RC_MAYBE_RET(rc, pVerJob); 1789 1805 rc = audioTestVerifyValue(&VerJob, &hHdr, "tag", NULL, "Manifest tags don't match"); 1790 AssertRCReturn(rc, rc);1806 CHECK_RC_MAYBE_RET(rc, pVerJob); 1791 1807 rc = audioTestVerifyValue(&VerJob, &hHdr, "test_count", NULL, "Test counts don't match"); 1792 AssertRCReturn(rc, rc);1808 CHECK_RC_MAYBE_RET(rc, pVerJob); 1793 1809 rc = audioTestVerifyValue(&VerJob, &hHdr, "obj_count", NULL, "Object counts don't match"); 1794 AssertRCReturn(rc, rc); 1795 1796 if ( pErrDesc->cErrors 1797 && !VerJob.fKeepGoing) 1798 return VINF_SUCCESS; 1810 CHECK_RC_MAYBE_RET(rc, pVerJob); 1799 1811 1800 1812 /* … … 1814 1826 AUDIOTESTTYPE enmTestTypeA; 1815 1827 rc = audioTestGetValueUInt32(VerJob.pSetA, &hTest, "test_type", (uint32_t *)&enmTestTypeA); 1816 AssertRCReturn(rc, rc); 1828 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Test type A not found")); 1829 1817 1830 AUDIOTESTTYPE enmTestTypeB; 1818 1831 rc = audioTestGetValueUInt32(VerJob.pSetB, &hTest, "test_type", (uint32_t *)&enmTestTypeB); 1819 AssertRCReturn(rc, rc);1832 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, ("Test type B not found")); 1820 1833 1821 1834 switch (enmTestTypeA) … … 1857 1870 } 1858 1871 1859 #undef VERIFY_VALUE1860 1861 1872 /* Only return critical stuff not related to actual testing here. */ 1862 1873 return VINF_SUCCESS; 1863 1874 } 1875 1876 #undef CHECK_RC_MAYBE_RET 1877 #undef CHECK_RC_MSG_MAYBE_RET 1864 1878 1865 1879
Note:
See TracChangeset
for help on using the changeset viewer.