VirtualBox

Changeset 78379 in vbox for trunk/src


Ignore:
Timestamp:
May 4, 2019 1:55:26 PM (6 years ago)
Author:
vboxsync
Message:

FsPerf: Test noticing remote file changes when opening a file. bugref:9172

File:
1 edited

Legend:

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

    r78367 r78379  
    55505550    RTTESTI_CHECK_RC(RTFileRead(hFile0, abBuf, 1, NULL), VERR_EOF);
    55515551
     5552    /*
     5553     * Test noticing remote size changes when opening a file.  Need to keep hFile0
     5554     * open here so we're sure to have an inode/FCB for the file in question.
     5555     */
     5556    memset(abBuf, 0xe7, sizeof(abBuf));
     5557    RTTESTI_CHECK_RC(RTFileSeek(hFile0, 0, RTFILE_SEEK_BEGIN, NULL), VINF_SUCCESS);
     5558    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 0), VINF_SUCCESS);
     5559    RTTESTI_CHECK_RC(RTFileWrite(hFile0, abBuf, 12288, NULL), VINF_SUCCESS);
     5560    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 12288), VINF_SUCCESS);
     5561
     5562    RTTESTI_CHECK_RC(FsPerfCommsSend("writepattern 0 12288 2 4096" FSPERF_EOF_STR), VINF_SUCCESS);
     5563
     5564    enmActuallyTaken = RTFILEACTION_END;
     5565    RTFILE hFile1 = NIL_RTFILE;
     5566    RTTESTI_CHECK_RC(RTFileOpenEx(InDir(RT_STR_TUPLE("file30")), RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE,
     5567                                  &hFile1, &enmActuallyTaken), VINF_SUCCESS);
     5568    RTTESTI_CHECK(enmActuallyTaken == RTFILEACTION_OPENED);
     5569    AssertCompile(sizeof(abBuf) >= 16384);
     5570    RTTESTI_CHECK_RC(RTFileRead(hFile1, abBuf, 16384, NULL), VINF_SUCCESS);
     5571    RTTESTI_CHECK(ASMMemIsAllU8(abBuf, 12288, 0xe7));
     5572    AssertCompile(RT_ELEMENTS(g_abPattern2) == 1);
     5573    RTTESTI_CHECK(ASMMemIsAllU8(&abBuf[12288], 4096, g_abPattern2[0]));
     5574    RTTESTI_CHECK_RC(RTFileRead(hFile1, abBuf, 1, NULL), VERR_EOF);
     5575    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
     5576
     5577    /* Same, but remote end truncates the file:  */
     5578    memset(abBuf, 0xe6, sizeof(abBuf));
     5579    RTTESTI_CHECK_RC(RTFileSeek(hFile0, 0, RTFILE_SEEK_BEGIN, NULL), VINF_SUCCESS);
     5580    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 0), VINF_SUCCESS);
     5581    RTTESTI_CHECK_RC(RTFileWrite(hFile0, abBuf, 12288, NULL), VINF_SUCCESS);
     5582    RTTESTI_CHECK_RC(RTFileSetSize(hFile0, 12288), VINF_SUCCESS);
     5583
     5584    RTTESTI_CHECK_RC(FsPerfCommsSend("truncate 0 7500" FSPERF_EOF_STR), VINF_SUCCESS);
     5585
     5586    enmActuallyTaken = RTFILEACTION_END;
     5587    hFile1 = NIL_RTFILE;
     5588    RTTESTI_CHECK_RC(RTFileOpenEx(InDir(RT_STR_TUPLE("file30")), RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE,
     5589                                  &hFile1, &enmActuallyTaken), VINF_SUCCESS);
     5590    RTTESTI_CHECK(enmActuallyTaken == RTFILEACTION_OPENED);
     5591    RTTESTI_CHECK_RC(RTFileRead(hFile1, abBuf, 7500, NULL), VINF_SUCCESS);
     5592    RTTESTI_CHECK(ASMMemIsAllU8(abBuf, 7500, 0xe6));
     5593    RTTESTI_CHECK_RC(RTFileRead(hFile1, abBuf, 1, NULL), VERR_EOF);
     5594    RTTESTI_CHECK_RC(RTFileClose(hFile1), VINF_SUCCESS);
     5595
    55525596    RTTESTI_CHECK_RC(RTFileClose(hFile0), VINF_SUCCESS);
    55535597}
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