VirtualBox

Changeset 20499 in vbox for trunk/src/VBox/Main/generic


Ignore:
Timestamp:
Jun 12, 2009 11:27:00 AM (15 years ago)
Author:
vboxsync
Message:

OpenGLTest.cpp: Fixed RTProcCreate argument list and executable name construction. Use monotonic time instead of wall time for timeout. (fixes compile but are otherwise untested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/generic/OpenGLTest.cpp

    r20300 r20499  
    11/* $Id$ */
    2 
    32/** @file
    4  * VBox host opengl support test
     3 * VBox host opengl support test - generic implementation.
    54 */
    65
     
    1312
    1413#include <VBox/err.h>
     14#include <iprt/assert.h>
     15#include <iprt/env.h>
     16#include <iprt/param.h>
     17#include <iprt/path.h>
    1518#include <iprt/process.h>
    16 #include <iprt/path.h>
    17 #include <iprt/param.h>
    18 #include <iprt/env.h>
    19 #include <iprt/thread.h>
    20 #include <string.h>
    21 #include <stdio.h>
     19#include <iprt/string.h>
     20#include <iprt/time.h>
    2221
    2322bool is3DAccelerationSupported()
    2423{
    2524    static char pszVBoxPath[RTPATH_MAX];
    26     const char *pArgs[2] = {"-test", NULL};
     25    const char *papszArgs[3] = { NULL, "-test", NULL};
    2726    int rc;
    2827    RTPROCESS Process;
    2928    RTPROCSTATUS ProcStatus;
    30     RTTIMESPEC Start;
    31     RTTIMESPEC Now;
     29    uint64_t StartTS;
    3230
    33     RTProcGetExecutableName(pszVBoxPath, RTPATH_MAX);
    34     RTPathStripFilename(pszVBoxPath);
    35     strcat(pszVBoxPath,"/VBoxTestOGL");
    36 #ifdef RT_OS_WINDOWS
    37     strcat(pszVBoxPath,".exe");
     31    rc = RTPathExecDir(pszVBoxPath, RTPATH_MAX); AssertRCReturn(rc, false);
     32#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     33    rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL");
     34#else
     35    rc = RTPathAppend(pszVBoxPath, RTPATH_MAX, "VBoxTestOGL.exe");
    3836#endif
     37    AssertRCReturn(rc, false);
     38    papszArgs[0] = pszVBoxPath;         /* argv[0] */
    3939
    40     rc = RTProcCreate(pszVBoxPath, pArgs, RTENV_DEFAULT, 0, &Process);
    41     if (RT_FAILURE(rc)) return false;
     40    rc = RTProcCreate(pszVBoxPath, papszArgs, RTENV_DEFAULT, 0, &Process);
     41    if (RT_FAILURE(rc))
     42        return false;
    4243
    43     RTTimeNow(&Start);
     44    StartTS = RTTimeMilliTS();
    4445
    4546    while (1)
     
    4950            break;
    5051
    51         if (RTTimeSpecGetMilli(RTTimeSpecSub(RTTimeNow(&Now), &Start)) > 30*1000 /* 30 sec */)
     52        if (RTTimeMilliTS() - StartTS > 30*1000 /* 30 sec */)
    5253        {
    5354            RTProcTerminate(Process);
     
    6970    return false;
    7071}
     72
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