VirtualBox

Changeset 78367 in vbox


Ignore:
Timestamp:
May 3, 2019 1:55:45 AM (6 years ago)
Author:
vboxsync
Message:

FsPerf: More tests of host<->guest interaction. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp

    r78362 r78367  
    54825482    RTTESTI_CHECK_RC_RETV(FsPerfCommsSend("reset\n"
    54835483                                          "open         0 'file30' 'w' 'ca'\n"
    5484                                           "writepattern 0 0 0 4096\n" FSPERF_EOF_STR), VINF_SUCCESS);
     5484                                          "writepattern 0 0 0 4096" FSPERF_EOF_STR), VINF_SUCCESS);
    54855485
    54865486    RTFILEACTION enmActuallyTaken = RTFILEACTION_END;
     
    54975497     * Append a little to it on the host and see that we can read it.
    54985498     */
    5499     RTTESTI_CHECK_RC(FsPerfCommsSend("writepattern 0 4096 1 1024\n" FSPERF_EOF_STR), VINF_SUCCESS);
     5499    RTTESTI_CHECK_RC(FsPerfCommsSend("writepattern 0 4096 1 1024" FSPERF_EOF_STR), VINF_SUCCESS);
    55005500    AssertCompile(RT_ELEMENTS(g_abPattern1) == 1);
    55015501    RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1024, NULL), VINF_SUCCESS);
     
    55145514    RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF);
    55155515
     5516    /*
     5517     * Write a bunch of stuff to the file here, then truncate it to a given size,
     5518     * then have the host add more, finally test that we can successfully chop off
     5519     * what the host added by reissuing the same truncate call as before (issue of
     5520     * RDBSS using cached size to noop out set-eof-to-same-size).
     5521     */
     5522    memset(abBuf, 0xe9, sizeof(abBuf));
     5523    RTTESTI_CHECK_RC(RTFileSeek(hFile0, 0, RTFILE_SEEK_BEGIN, NULL), VINF_SUCCESS);
     5524    RTTESTI_CHECK_RC(RTFileWrite(hFile0, abBuf, 16384, NULL), VINF_SUCCESS);
     5525    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 8000), VINF_SUCCESS);
     5526    RTTESTI_CHECK_RC(FsPerfCommsSend("writepattern 0 8000 0 1000" FSPERF_EOF_STR), VINF_SUCCESS);
     5527    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 8000), VINF_SUCCESS);
     5528    uint64_t cbFile = 0;
     5529    RTTESTI_CHECK_RC(RTFileGetSize(hFile0, &cbFile), VINF_SUCCESS);
     5530    RTTESTI_CHECK_MSG(cbFile == 8000, ("cbFile=%u\n", cbFile));
     5531    RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF);
     5532
     5533    /* Same, but using RTFileRead to find out and RTFileWrite to define the size. */
     5534    RTTESTI_CHECK_RC(RTFileSeek(hFile0, 0, RTFILE_SEEK_BEGIN, NULL), VINF_SUCCESS);
     5535    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 0), VINF_SUCCESS);
     5536    RTTESTI_CHECK_RC(RTFileWrite(hFile0, abBuf, 5000, NULL), VINF_SUCCESS);
     5537    RTTESTI_CHECK_RC(FsPerfCommsSend("writepattern 0 5000 0 1000" FSPERF_EOF_STR), VINF_SUCCESS);
     5538    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 5000), VINF_SUCCESS);
     5539    RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF);
     5540    RTTESTI_CHECK_RC(RTFileGetSize(hFile0, &cbFile), VINF_SUCCESS);
     5541    RTTESTI_CHECK_MSG(cbFile == 5000, ("cbFile=%u\n", cbFile));
     5542
     5543    /* Same, but host truncates rather than adding stuff. */
     5544    RTTESTI_CHECK_RC(RTFileSeek(hFile0, 0, RTFILE_SEEK_BEGIN, NULL), VINF_SUCCESS);
     5545    RTTESTI_CHECK_RC(RTFileWrite(hFile0, abBuf, 16384, NULL), VINF_SUCCESS);
     5546    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 10000), VINF_SUCCESS);
     5547    RTTESTI_CHECK_RC(FsPerfCommsSend("truncate 0 4000" FSPERF_EOF_STR), VINF_SUCCESS);
     5548    RTTESTI_CHECK_RC(RTFileGetSize(hFile0, &cbFile), VINF_SUCCESS);
     5549    RTTESTI_CHECK_MSG(cbFile == 4000, ("cbFile=%u\n", cbFile));
     5550    RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF);
     5551
    55165552    RTTESTI_CHECK_RC(RTFileClose(hFile0), VINF_SUCCESS);
    5517 
    55185553}
    55195554
Note: See TracChangeset for help on using the changeset viewer.

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