VirtualBox

Changeset 16162 in vbox


Ignore:
Timestamp:
Jan 22, 2009 1:18:12 PM (16 years ago)
Author:
vboxsync
Message:

tstSSM: make it work again.

File:
1 edited

Legend:

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

    r13818 r16162  
    2525*******************************************************************************/
    2626#include <VBox/ssm.h>
     27#include "../VMInternal.h" /* createFakeVM */
    2728#include <VBox/vm.h>
    2829#include <VBox/uvm.h>
     
    4041#include <iprt/string.h>
    4142#include <iprt/time.h>
     43#include <iprt/thread.h>
     44#include <iprt/path.h>
    4245
    4346
     
    563566 * @returns 0 on success, 1 on failure.
    564567 * @param   ppVM    Where to store the VM handle.
     568 *
     569 * @todo    Move this to VMM/VM since it's stuff done by several testcases.
    565570 */
    566571static int createFakeVM(PVM *ppVM)
     
    572577    AssertReturn(pUVM, 1);
    573578    pUVM->u32Magic = UVM_MAGIC;
    574 
    575     int rc = STAMR3InitUVM(pUVM);
     579    pUVM->vm.s.idxTLS = RTTlsAlloc();
     580    int rc = RTTlsSet(pUVM->vm.s.idxTLS, &pUVM->aCpus[0]);
    576581    if (RT_SUCCESS(rc))
    577582    {
    578         rc = MMR3InitUVM(pUVM);
     583        pUVM->aCpus[0].pUVM = pUVM;
     584        pUVM->aCpus[0].vm.s.NativeThreadEMT = RTThreadNativeSelf();
     585
     586        rc = STAMR3InitUVM(pUVM);
    579587        if (RT_SUCCESS(rc))
    580588        {
    581             /*
    582              * Allocate and init the VM structure.
    583              */
    584             PVM pVM;
    585             rc = SUPPageAlloc((sizeof(*pVM) + PAGE_SIZE - 1) >> PAGE_SHIFT, (void **)&pVM);
     589            rc = MMR3InitUVM(pUVM);
    586590            if (RT_SUCCESS(rc))
    587591            {
    588                 pVM->enmVMState = VMSTATE_CREATED;
    589                 pVM->pVMR3 = pVM;
    590                 pVM->pUVM = pUVM;
    591 
    592                 pUVM->pVM = pVM;
    593                 *ppVM = pVM;
    594                 return 0;
     592                /*
     593                 * Allocate and init the VM structure.
     594                 */
     595                PVM pVM;
     596                rc = SUPPageAlloc((sizeof(*pVM) + PAGE_SIZE - 1) >> PAGE_SHIFT, (void **)&pVM);
     597                if (RT_SUCCESS(rc))
     598                {
     599                    pVM->enmVMState = VMSTATE_CREATED;
     600                    pVM->pVMR3 = pVM;
     601                    pVM->pUVM = pUVM;
     602                    pVM->cCPUs = 1;
     603                    pVM->aCpus[0].pVMR3 = pVM;
     604                    pVM->aCpus[0].hNativeThread = RTThreadNativeSelf();
     605
     606                    pUVM->pVM = pVM;
     607                    *ppVM = pVM;
     608                    return 0;
     609                }
     610
     611                RTPrintf("Fatal error: failed to allocated pages for the VM structure, rc=%Rrc\n", rc);
    595612            }
    596 
    597             RTPrintf("Fatal error: failed to allocated pages for the VM structure, rc=%Rrc\n", rc);
     613            else
     614                RTPrintf("Fatal error: MMR3InitUVM failed, rc=%Rrc\n", rc);
    598615        }
    599616        else
    600             RTPrintf("Fatal error: MMR3InitUVM failed, rc=%Rrc\n", rc);
     617            RTPrintf("Fatal error: SSMR3InitUVM failed, rc=%Rrc\n", rc);
    601618    }
    602619    else
    603         RTPrintf("Fatal error: SSMR3InitUVM failed, rc=%Rrc\n", rc);
     620        RTPrintf("Fatal error: RTTlsSet failed, rc=%Rrc\n", rc);
    604621
    605622    *ppVM = NULL;
     
    683700    RTPrintf("tstSSM: Saved in %RI64 ns\n", u64Elapsed);
    684701
     702    RTFSOBJINFO Info;
     703    rc = RTPathQueryInfo(pszFilename, &Info, RTFSOBJATTRADD_NOTHING);
     704    if (RT_FAILURE(rc))
     705    {
     706        RTPrintf("tstSSM: failed to query file size: %Rrc\n", rc);
     707        return 1;
     708    }
     709    RTPrintf("tstSSM: file size %RI64 bytes\n", Info.cbObject);
     710
    685711    /*
    686712     * Attempt a load.
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