VirtualBox

Changeset 32993 in vbox for trunk/src


Ignore:
Timestamp:
Oct 7, 2010 10:59:42 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66504
Message:

byte write test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTPrfIO.cpp

    r32901 r32993  
    153153
    154154
     155static void benchmarkFileWriteByte(void)
     156{
     157    RTTestSub(g_hTest, "RTFileWrite(byte)");
     158
     159    RTFILE hFile;
     160
     161    RTTESTI_CHECK_RC_RETV(RTFileOpen(&hFile, g_szTestFile1,
     162                                     RTFILE_O_WRITE | RTFILE_O_DENY_NONE | RTFILE_O_CREATE_REPLACE
     163                                     | (0655 << RTFILE_O_CREATE_MODE_SHIFT)),
     164                          VINF_SUCCESS);
     165    static const char   s_szContent[] = "0123456789abcdef";
     166    uint32_t            offContent = 0;
     167    int rc;;
     168    RTTESTI_CHECK_RC(rc = RTFileWrite(hFile, &s_szContent[offContent++ % RT_ELEMENTS(s_szContent)], 1, NULL), VINF_SUCCESS);
     169    if (RT_SUCCESS(rc))
     170    {
     171        TIME_OP(RTFileWrite(hFile, &s_szContent[offContent++ % RT_ELEMENTS(s_szContent)], 1, NULL), "RTFileWrite(byte)");
     172    }
     173    RTTESTI_CHECK_RC(RTFileClose(hFile), VINF_SUCCESS);
     174
     175    RTTestSubDone(g_hTest);
     176}
     177
     178
    155179
    156180int main(int argc, char **argv)
     
    169193    };
    170194    bool fFileOpenCloseTest = true;
     195    bool fFileWriteByteTest = true;
    171196    bool fPathQueryInfoTest = true;
    172197    //bool fFileTests = true;
     
    225250    if (RTTestIErrorCount() == 0)
    226251    {
     252#if 1
    227253        if (fPathQueryInfoTest)
    228254            benchmarkPathQueryInfo();
    229255        if (fFileOpenCloseTest)
    230256            benchmarkFileOpenClose();
     257#endif
     258        if (fFileWriteByteTest)
     259            benchmarkFileWriteByte();
    231260        //if (fFileTests)
    232261        //    benchmarkFile();
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