VirtualBox

Changeset 21793 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jul 25, 2009 11:14:38 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50396
Message:

tstSSM: updates and fixes (bug in old SSMR3Seek causes test failure atm, a fix is underway).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/testcase/tstSSM.cpp

    r21787 r21793  
    4545
    4646
    47 const uint8_t gabPage[PAGE_SIZE] = {0};
    48 
    49 const char gachMem1[] = "sdfg\1asdfa\177hjkl;sdfghjkl;dfghjkl;dfghjkl;\0\0asdf;kjasdf;lkjasd;flkjasd;lfkjasd\0;lfk";
    50 
    51 uint8_t gabBigMem[8*1024*1024];
     47/*******************************************************************************
     48*   Defined Constants And Macros                                               *
     49*******************************************************************************/
     50#define TSTSSM_BIG_CONFIG   1
     51
     52#ifdef TSTSSM_BIG_CONFIG
     53# define TSTSSM_ITEM_SIZE    (512*_1M)
     54#else
     55# define TSTSSM_ITEM_SIZE    (5*_1M)
     56#endif
     57
     58
     59/*******************************************************************************
     60*   Global Variables                                                           *
     61*******************************************************************************/
     62const uint8_t   gabPage[PAGE_SIZE] = {0};
     63const char      gachMem1[] = "sdfg\1asdfa\177hjkl;sdfghjkl;dfghjkl;dfghjkl;\0\0asdf;kjasdf;lkjasd;flkjasd;lfkjasd\0;lfk";
     64#ifdef TSTSSM_BIG_CONFIG
     65uint8_t         gabBigMem[_1M];
     66#else
     67uint8_t         gabBigMem[8*_1M];
     68#endif
     69
    5270
    5371/** initializes gabBigMem with some non zero stuff. */
     
    167185DECLCALLBACK(int) Item01Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
    168186{
     187    if (u32Version != 0)
     188    {
     189        RTPrintf("Item01: u32Version=%#x, expected 0\n", u32Version);
     190        return VERR_GENERAL_FAILURE;
     191    }
     192
    169193    /*
    170194     * Load the memory block.
     
    315339DECLCALLBACK(int) Item02Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
    316340{
     341    if (u32Version != 0)
     342    {
     343        RTPrintf("Item02: u32Version=%#x, expected 0\n", u32Version);
     344        return VERR_GENERAL_FAILURE;
     345    }
     346
    317347    /*
    318348     * Load the size.
     
    379409     * Put the size.
    380410     */
    381     uint32_t cb = 512*_1M;
     411    uint32_t cb = TSTSSM_ITEM_SIZE;
    382412    int rc = SSMR3PutU32(pSSM, cb);
    383413    if (RT_FAILURE(rc))
     
    421451DECLCALLBACK(int) Item03Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
    422452{
     453    if (u32Version != 123)
     454    {
     455        RTPrintf("Item03: u32Version=%#x, expected 123\n", u32Version);
     456        return VERR_GENERAL_FAILURE;
     457    }
     458
    423459    /*
    424460     * Load the size.
     
    431467        return rc;
    432468    }
    433     if (cb != 512*_1M)
    434     {
    435         RTPrintf("Item03: loaded size doesn't match the real thing. %#x != %#x\n", cb, 512*_1M);
     469    if (cb != TSTSSM_ITEM_SIZE)
     470    {
     471        RTPrintf("Item03: loaded size doesn't match the real thing. %#x != %#x\n", cb, TSTSSM_ITEM_SIZE);
    436472        return VERR_GENERAL_FAILURE;
    437473    }
     
    447483        if (RT_FAILURE(rc))
    448484        {
    449             RTPrintf("Item03: SSMR3GetMem(,,%#x) -> %Rrc offset %#x\n", PAGE_SIZE, rc, 512*_1M - cb);
     485            RTPrintf("Item03: SSMR3GetMem(,,%#x) -> %Rrc offset %#x\n", PAGE_SIZE, rc, TSTSSM_ITEM_SIZE - cb);
    450486            return rc;
    451487        }
    452488        if (memcmp(achPage, pu8Org, PAGE_SIZE))
    453489        {
    454             RTPrintf("Item03: compare failed. mem offset=%#x\n", 512*_1M - cb);
     490            RTPrintf("Item03: compare failed. mem offset=%#x\n", TSTSSM_ITEM_SIZE - cb);
    455491            return VERR_GENERAL_FAILURE;
    456492        }
     
    519555DECLCALLBACK(int) Item04Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version)
    520556{
     557    if (u32Version != 42)
     558    {
     559        RTPrintf("Item04: u32Version=%#x, expected 42\n", u32Version);
     560        return VERR_GENERAL_FAILURE;
     561    }
     562
    521563    /*
    522564     * Load the size.
     
    707749        return 1;
    708750    }
    709     RTPrintf("tstSSM: file size %RI64 bytes\n", Info.cbObject);
     751    RTPrintf("tstSSM: file size %'RI64 bytes\n", Info.cbObject);
    710752
    711753    /*
     
    770812    RTPrintf("tstSSM: Failed seek in %'RI64 ns\n", u64Elapsed);
    771813
     814    /* another negative, now only the instance number isn't matching. */
     815    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 0, NULL);
     816    if (rc != VERR_SSM_UNIT_NOT_FOUND)
     817    {
     818        RTPrintf("SSMR3Seek #1 unit 2 -> %Rrc\n", rc);
     819        return 1;
     820    }
     821
    772822    /* 2nd unit */
    773     rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 0, NULL);
    774     if (RT_FAILURE(rc))
    775     {
    776         RTPrintf("SSMR3Seek #1 unit 2-> %Rrc\n", rc);
     823    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 2, NULL);
     824    if (RT_FAILURE(rc))
     825    {
     826        RTPrintf("SSMR3Seek #1 unit 2 -> %Rrc [2]\n", rc);
    777827        return 1;
    778828    }
    779829    uint32_t u32Version = 0xbadc0ded;
    780     rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 0, &u32Version);
    781     if (RT_FAILURE(rc))
    782     {
    783         RTPrintf("SSMR3Seek #1 unit 2-> %Rrc\n", rc);
     830    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 2, &u32Version);
     831    if (RT_FAILURE(rc))
     832    {
     833        RTPrintf("SSMR3Seek #1 unit 2 -> %Rrc [3]\n", rc);
    784834        return 1;
    785835    }
     
    796846    /* 1st unit */
    797847    u32Version = 0xbadc0ded;
    798     rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.1 (all types)", 0, &u32Version);
     848    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.1 (all types)", 1, &u32Version);
    799849    if (RT_FAILURE(rc))
    800850    {
     
    814864    /* 3st unit */
    815865    u32Version = 0xbadc0ded;
    816     rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.3 (big mem)", 123, &u32Version);
     866    rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.3 (big mem)", 0, &u32Version);
    817867    if (RT_FAILURE(rc))
    818868    {
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