VirtualBox

Changeset 72029 in vbox


Ignore:
Timestamp:
Apr 26, 2018 8:32:47 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122325
Message:

ValidationKit/tests/serial: Add verbose flag to avoid flooding the log with error messages by default

Location:
trunk/src/VBox/ValidationKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/serial/tdSerial1.py

    r70796 r72029  
    6767        self.oLoopback        = None;
    6868        self.sLocation        = None;
     69        self.fVerboseTest     = False;
    6970
    7071    #
     
    7980        reporter.log('  --serial-tests    <t1[:t2[:]]');
    8081        reporter.log('      Default: %s' % (':'.join(self.asSerialTestsDef)));
     82        reporter.log('  --verbose-test');
     83        reporter.log('      Whether to enable verbose output when running the');
     84        reporter.log('      test utility inside the VM');
    8185        return rc;
    8286
     
    98102                if s not in self.asSerialTestsDef:
    99103                    reporter.log('warning: The "--serial-tests" value "%s" is not a valid serial port test.' % (s));
     104        elif asArgs[iArg] == '--verbose-test':
     105            iArg += 1;
     106            self.fVerboseTest = True;
    100107        else:
    101108            return vbox.TestDriver.parseOption(self, asArgs, iArg);
     
    190197
    191198        reporter.testStart('Write');
    192         tupCmdLine = ('SerialTest', '--tests', 'write', '--txbytes', '1048576', '--device');
     199        tupCmdLine = ('SerialTest', '--tests', 'write', '--txbytes', '1048576',);
     200        if self.fVerboseTest:
     201            tupCmdLine += ('--verbose');
    193202        if oTestVm.isWindows():
    194             tupCmdLine += (r'\\.\COM1',);
     203            tupCmdLine += ('--device', r'\\.\COM1',);
    195204        elif oTestVm.isLinux():
    196             tupCmdLine += (r'/dev/ttyS0',);
     205            tupCmdLine += ('--device', r'/dev/ttyS0',);
    197206
    198207        fRc = self.txsRunTest(oTxsSession, 'SerialTest', 3600 * 1000, \
     
    218227                oFile.close();
    219228            except:
     229                reporter.logXcpt();
    220230                reporter.testFailure('Verifying the written data failed');
    221231        reporter.testDone();
     
    229239
    230240        reporter.testStart('ReadWrite');
    231         tupCmdLine = ('SerialTest', '--tests', 'readwrite', '--txbytes', '1048576', '--device');
     241        tupCmdLine = ('SerialTest', '--tests', 'readwrite', '--txbytes', '1048576');
     242        if self.fVerboseTest:
     243            tupCmdLine += ('--verbose');
    232244        if oTestVm.isWindows():
    233             tupCmdLine += (r'\\.\COM1',);
     245            tupCmdLine += ('--device', r'\\.\COM1',);
    234246        elif oTestVm.isLinux():
    235             tupCmdLine += (r'/dev/ttyS0',);
     247            tupCmdLine += ('--device', r'/dev/ttyS0',);
    236248
    237249        fRc = self.txsRunTest(oTxsSession, 'SerialTest', 600 * 1000, \
  • trunk/src/VBox/ValidationKit/utils/serial/SerialTest.cpp

    r71957 r72029  
    157157    {"--tests",            't', RTGETOPT_REQ_STRING },
    158158    {"--txbytes",          'x', RTGETOPT_REQ_UINT32 },
     159    {"--verbose",          'v', RTGETOPT_REQ_NOTHING},
    159160    {"--help",             'h', RTGETOPT_REQ_NOTHING}
    160161};
     
    173174};
    174175
     176/** Verbosity value. */
     177static unsigned        g_cVerbosity           = 0;
    175178/** The test handle. */
    176179static RTTEST          g_hTest                = NIL_RTTEST;
     
    330333{
    331334    uint32_t offRx = 0;
     335    bool fFailed = false;
    332336
    333337    while (offRx + sizeof(uint32_t) < pSerBuf->offBuf)
     
    337341
    338342        if (RT_UNLIKELY(u32Val != ++pSerBuf->iCnt))
    339             RTTestFailed(hTest, "Data corruption/loss detected, expected counter value %u got %u\n",
    340                          pSerBuf->iCnt, u32Val);
    341     }
     343        {
     344            fFailed = true;
     345            if (g_cVerbosity > 0)
     346                RTTestFailed(hTest, "Data corruption/loss detected, expected counter value %u got %u\n",
     347                             pSerBuf->iCnt, u32Val);
     348        }
     349    }
     350
     351    if (fFailed)
     352        RTTestFailed(hTest, "Data corruption/loss detected\n");
    342353
    343354    if (RT_UNLIKELY(pSerBuf->iCnt > iCntTx))
     
    757768                serialTestUsage(g_pStdOut);
    758769                return RTEXITCODE_SUCCESS;
     770            case 'v':
     771                g_cVerbosity++;
     772                break;
    759773            case 'd':
    760774                pszDevice = ValueUnion.psz;
Note: See TracChangeset for help on using the changeset viewer.

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