VirtualBox

source: vbox/trunk/src/VBox/Main/generic/OpenGLTest.cpp@ 20440

Last change on this file since 20440 was 20300, checked in by vboxsync, 16 years ago

Windows implementation of RTProcCreate does not like empty argument lists

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1/* $Id: OpenGLTest.cpp 20300 2009-06-05 08:23:27Z vboxsync $ */
2
3/** @file
4 * VBox host opengl support test
5 */
6
7/*
8 * Copyright (C) 2009 Sun Microsystems, Inc.
9 *
10 * Sun Microsystems, Inc. confidential
11 * All rights reserved
12 */
13
14#include <VBox/err.h>
15#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>
22
23bool is3DAccelerationSupported()
24{
25 static char pszVBoxPath[RTPATH_MAX];
26 const char *pArgs[2] = {"-test", NULL};
27 int rc;
28 RTPROCESS Process;
29 RTPROCSTATUS ProcStatus;
30 RTTIMESPEC Start;
31 RTTIMESPEC Now;
32
33 RTProcGetExecutableName(pszVBoxPath, RTPATH_MAX);
34 RTPathStripFilename(pszVBoxPath);
35 strcat(pszVBoxPath,"/VBoxTestOGL");
36#ifdef RT_OS_WINDOWS
37 strcat(pszVBoxPath,".exe");
38#endif
39
40 rc = RTProcCreate(pszVBoxPath, pArgs, RTENV_DEFAULT, 0, &Process);
41 if (RT_FAILURE(rc)) return false;
42
43 RTTimeNow(&Start);
44
45 while (1)
46 {
47 rc = RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
48 if (rc != VERR_PROCESS_RUNNING)
49 break;
50
51 if (RTTimeSpecGetMilli(RTTimeSpecSub(RTTimeNow(&Now), &Start)) > 30*1000 /* 30 sec */)
52 {
53 RTProcTerminate(Process);
54 RTThreadSleep(100);
55 RTProcWait(Process, RTPROCWAIT_FLAGS_NOBLOCK, &ProcStatus);
56 return false;
57 }
58 RTThreadSleep(100);
59 }
60
61 if (RT_SUCCESS(rc))
62 {
63 if ((ProcStatus.enmReason==RTPROCEXITREASON_NORMAL) && (ProcStatus.iStatus==0))
64 {
65 return true;
66 }
67 }
68
69 return false;
70}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette