VirtualBox

Changeset 101035 in vbox for trunk/src/VBox/Main/testcase


Ignore:
Timestamp:
Sep 7, 2023 8:59:15 AM (20 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158992
Message:

Initial commit (based draft v2 / on patch v5) for implementing platform architecture support for x86 and ARM. bugref:10384

Location:
trunk/src/VBox/Main/testcase
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/Makefile.kmk

    r99770 r101035  
    4848        tstMediumLock \
    4949        tstSafeArray \
     50        tstSettings \
    5051        tstBstr \
    5152        tstGuid \
     
    294295tstSafeArray_SOURCES  = tstSafeArray.cpp
    295296
     297
     298#
     299# tstSettings
     300#
     301tstSettings_TEMPLATE = VBoxMainClientTstExe
     302tstSettings_INCS     = \
     303        ../include \
     304        $(VBOX_MAIN_APIWRAPPER_INCS) \
     305        $(dir $(VBOX_XML_SCHEMADEFS_H))
     306tstSettings_SOURCES  = \
     307        tstSettings.cpp \
     308        ../src-all/HashedPw.cpp \
     309        ../xml/Settings.cpp
    296310
    297311#
     
    349363# generate rules.
    350364include $(FILE_KBUILD_SUB_FOOTER)
    351 
  • trunk/src/VBox/Main/testcase/tstVBoxAPI.cpp

    r98103 r101035  
    6565
    6666
    67 static BOOL tstApiIVirtualBox(IVirtualBox *pVBox)
     67static void tstApiIVirtualBox(IVirtualBox *pVBox)
    6868{
    6969    HRESULT hrc;
     
    128128        RTTestFailed(g_hTest, "%d: IVirtualBox::guestOSTypes failed", __LINE__);
    129129
    130     /** Create VM */
     130    /* For now we only test same-same architectures (host == guest). */
     131    PlatformArchitecture_T enmPlatformArch;
     132#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
     133    enmPlatformArch = PlatformArchitecture_x86;
     134#elif defined(RT_ARCH_ARM32) || defined(RT_ARCH_ARM64)
     135    enmPlatformArch = PlatformArchitecture_ARM;
     136#else
     137# error "Port me!"
     138#endif
     139
     140    /*
     141     * Host
     142     */
     143    ComPtr<IHost> host;
     144    RTTestSub(g_hTest, "IVirtualBox::host");
     145    CHECK_ERROR(pVBox, COMGETTER(Host)(host.asOutParam()));
     146    if (SUCCEEDED(hrc))
     147    {
     148        RTTestPassed(g_hTest, "IVirtualBox::host");
     149        CHECK_ERROR(host, COMGETTER(Architecture)(&enmPlatformArch));
     150
     151        switch (enmPlatformArch)
     152        {
     153            case PlatformArchitecture_x86:
     154            {
     155                ComPtr<IHostX86> hostX86;
     156                CHECK_ERROR(host, COMGETTER(X86)(hostX86.asOutParam()));
     157                break;
     158            }
     159
     160            default:
     161                break;
     162        }
     163    }
     164    else
     165        RTTestFailed(g_hTest, "%d: IVirtualBox::host failed", __LINE__);
     166
     167    ComPtr<ISystemProperties> sysprop;
     168    RTTestSub(g_hTest, "IVirtualBox::systemProperties");
     169    CHECK_ERROR(pVBox, COMGETTER(SystemProperties)(sysprop.asOutParam()));
     170    if (SUCCEEDED(hrc))
     171    {
     172        RTTestPassed(g_hTest, "IVirtualBox::systemProperties");
     173
     174        RTTestSub(g_hTest, "IVirtualBox::platform::::platformProperties");
     175        ComPtr<IPlatformProperties> platformprop;
     176        CHECK_ERROR(sysprop, COMGETTER(Platform)(platformprop.asOutParam()));
     177        BOOL fTemp;
     178        CHECK_ERROR(platformprop, COMGETTER(ExclusiveHwVirt)(&fTemp));
     179        ULONG ulTemp;
     180        CHECK_ERROR(platformprop, GetMaxNetworkAdapters(ChipsetType_PIIX3, &ulTemp));
     181    }
     182    else
     183        RTTestFailed(g_hTest, "%d: IVirtualBox::systemProperties failed", __LINE__);
     184
     185    /*
     186     * VM
     187     */
    131188    RTTestSub(g_hTest, "IVirtualBox::CreateMachine");
    132189    ComPtr<IMachine> ptrMachine;
     
    135192    CHECK_ERROR(pVBox, CreateMachine(NULL,                          /** Settings */
    136193                                     tstMachineName.raw(),          /** Name */
     194                                     enmPlatformArch,
    137195                                     ComSafeArrayAsInParam(groups), /** Groups */
    138196                                     NULL,                          /** OS Type */
     
    147205    {
    148206        RTTestFailed(g_hTest, "%d: IVirtualBox::CreateMachine failed", __LINE__);
    149         return FALSE;
     207        return;
    150208    }
    151209
     
    157215    {
    158216        RTTestFailed(g_hTest, "%d: IVirtualBox::RegisterMachine failed", __LINE__);
    159         return FALSE;
    160     }
    161 
    162     ComPtr<IHost> host;
    163     RTTestSub(g_hTest, "IVirtualBox::host");
    164     CHECK_ERROR(pVBox, COMGETTER(Host)(host.asOutParam()));
    165     if (SUCCEEDED(hrc))
    166     {
    167         /** @todo Add IHost testing here. */
    168         RTTestPassed(g_hTest, "IVirtualBox::host");
    169     }
    170     else
    171         RTTestFailed(g_hTest, "%d: IVirtualBox::host failed", __LINE__);
    172 
    173     ComPtr<ISystemProperties> sysprop;
    174     RTTestSub(g_hTest, "IVirtualBox::systemProperties");
    175     CHECK_ERROR(pVBox, COMGETTER(SystemProperties)(sysprop.asOutParam()));
    176     if (SUCCEEDED(hrc))
    177     {
    178         /** @todo Add ISystemProperties testing here. */
    179         RTTestPassed(g_hTest, "IVirtualBox::systemProperties");
    180     }
    181     else
    182         RTTestFailed(g_hTest, "%d: IVirtualBox::systemProperties failed", __LINE__);
     217        return;
     218    }
    183219
    184220    com::SafeIfaceArray<IMachine> machines;
    185     RTTestSub(g_hTest, "IVirtualBox::machines");
     221    RTTestSub(g_hTest, "IVirtualBox::machines2");
    186222    CHECK_ERROR(pVBox, COMGETTER(Machines)(ComSafeArrayAsOutParam(machines)));
    187223    if (SUCCEEDED(hrc))
    188224    {
    189         bool bFound = FALSE;
     225        bool fFound = FALSE;
    190226        for (size_t i = 0; i < machines.size(); ++i)
    191227        {
     
    198234                    if (tmpName == tstMachineName)
    199235                    {
    200                         bFound = TRUE;
     236                        fFound = TRUE;
    201237                        break;
    202238                    }
     
    205241        }
    206242
    207         if (bFound)
     243        if (fFound)
    208244            RTTestPassed(g_hTest, "IVirtualBox::machines");
    209245        else
     
    212248    else
    213249        RTTestFailed(g_hTest, "%d: IVirtualBox::machines failed", __LINE__);
     250
     251    RTTestSub(g_hTest, "IMachine::FirmwareSettings");
     252    ComPtr<IFirmwareSettings> ptrFirmwareSettings;
     253    CHECK_ERROR(ptrMachine, COMGETTER(FirmwareSettings)(ptrFirmwareSettings.asOutParam()));
     254    FirmwareType_T firmwareType;
     255    CHECK_ERROR(ptrFirmwareSettings, COMGETTER(FirmwareType)(&firmwareType));
     256
     257//    CHECK_ERROR(ptrMachine, LockMachine());
     258//    RTTestSub(g_hTest, "IMachine::saveSettings");
     259//    CHECK_ERROR(ptrMachine, SaveSettings());
     260
     261    Bstr bstSettingsFile;
     262    CHECK_ERROR(ptrMachine, COMGETTER(SettingsFilePath)(bstSettingsFile.asOutParam()));
     263    RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Settings file: %ls\n", bstSettingsFile.raw());
     264//    CHECK_ERROR(ptrMachine, UnlockMachine());
    214265
    215266#if 0 /** Not yet implemented */
     
    344395    else
    345396        RTTestFailed(g_hTest, "%d: IVirtualBox::genericNetworkDrivers failed", __LINE__);
    346 
    347     return TRUE;
    348397}
    349398
    350399
    351 static BOOL tstApiClean(IVirtualBox *pVBox)
     400static void tstApiClean(IVirtualBox *pVBox)
    352401{
    353402    HRESULT hrc;
     
    355404    /** Delete created VM and its files */
    356405    ComPtr<IMachine> machine;
    357     CHECK_ERROR_RET(pVBox, FindMachine(Bstr(tstMachineName).raw(), machine.asOutParam()), FALSE);
     406    CHECK_ERROR(pVBox, FindMachine(Bstr(tstMachineName).raw(), machine.asOutParam()));
    358407    SafeIfaceArray<IMedium> media;
    359     CHECK_ERROR_RET(machine, Unregister(CleanupMode_DetachAllReturnHardDisksOnly,
    360                                     ComSafeArrayAsOutParam(media)), FALSE);
     408    CHECK_ERROR(machine, Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(media)));
    361409    ComPtr<IProgress> progress;
    362     CHECK_ERROR_RET(machine, DeleteConfig(ComSafeArrayAsInParam(media), progress.asOutParam()), FALSE);
    363     CHECK_ERROR_RET(progress, WaitForCompletion(-1), FALSE);
    364 
    365     return TRUE;
     410    CHECK_ERROR(machine, DeleteConfig(ComSafeArrayAsInParam(media), progress.asOutParam()));
     411    CHECK_ERROR(progress, WaitForCompletion(-1));
    366412}
    367413
     
    402448                tstApiIVirtualBox(ptrVBox);
    403449
    404 
    405450                /** Clean files/configs */
    406451                tstApiClean(ptrVBox);
  • trunk/src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp

    r99775 r101035  
    198198    rc = virtualBox->CreateMachine(NULL,        /* settings file */
    199199                                   NS_LITERAL_STRING("A brand new name").get(),
     200                                   PlatformArchitecture_x86,
    200201                                   0, nsnull,   /* groups (safearray)*/
    201202                                   nsnull,      /* ostype */
  • trunk/src/VBox/Main/testcase/tstVBoxMultipleVM.cpp

    r98103 r101035  
    334334        /* Default VM settings */
    335335        CHECK_ERROR_L(pVBox, CreateMachine(NULL,                          /* Settings */
    336                                          machineName.raw(),             /* Name */
    337                                          ComSafeArrayAsInParam(groups), /* Groups */
    338                                          NULL,                          /* OS Type */
    339                                          NULL,                          /** Cipher */
    340                                          NULL,                          /** Password id */
    341                                          NULL,                          /** Password */
    342                                          NULL,                          /* Create flags */
    343                                          ptrMachine.asOutParam()));
     336                                           machineName.raw(),             /* Name */
     337                                           PlatformArchitecture_x86,
     338                                           ComSafeArrayAsInParam(groups), /* Groups */
     339                                           NULL,                          /* OS Type */
     340                                           NULL,                          /** Cipher */
     341                                           NULL,                          /** Password id */
     342                                           NULL,                          /** Password */
     343                                           NULL,                          /* Create flags */
     344                                           ptrMachine.asOutParam()));
    344345        if (SUCCEEDED(hrc))
    345346        {
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