Changeset 37618 in vbox for trunk/src/VBox/Main/testcase/tstUSBProxyLinux.cpp
- Timestamp:
- Jun 23, 2011 5:16:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstUSBProxyLinux.cpp
r37617 r37618 89 89 /* "sysfs" and valid root in the environment */ 90 90 { "sysfs", "/dev/bus/usb", "/dev/bus/usb", true, NULL, false, VINF_SUCCESS, "/dev/bus/usb", false, VINF_SUCCESS }, 91 /* "sysfs" and valid root in the environment, method-specific init failed */92 { "sysfs", "/dev/bus/usb", "/dev/bus/usb", true, NULL, false, VERR_NO_MEMORY, "/dev/bus/usb", false, VERR_NO_MEMORY },93 91 /* "sysfs" and bad root in the environment */ 94 92 { "sysfs", "/dev/bus/usb", "/dev/vboxusb", false, "/proc/usb/bus", false, VINF_SUCCESS, "", true, VERR_NOT_FOUND }, … … 97 95 /* "usbfs" and valid root in the environment */ 98 96 { "usbfs", "/dev/bus/usb", NULL, false, "/dev/bus/usb", true, VINF_SUCCESS, "/dev/bus/usb", true, VINF_SUCCESS }, 99 /* "usbfs" and valid root in the environment, method-specific init failed */100 { "usbfs", "/dev/bus/usb", NULL, false, "/dev/bus/usb", true, VERR_NO_MEMORY, "/dev/bus/usb", true, VERR_NO_MEMORY },101 97 /* "usbfs" and bad root in the environment */ 102 98 { "usbfs", "/dev/bus/usb", "/dev/vboxusb", false, "/proc/usb/bus", false, VINF_SUCCESS, "", true, VERR_NOT_FOUND }, … … 119 115 /* No environment, sysfs available but without access permissions. */ 120 116 { NULL, NULL, "/dev/vboxusb", false, NULL, false, VERR_NO_MEMORY, "", true, VERR_VUSB_USB_DEVICE_PERMISSION }, 121 /* No environment, sysfs available with access permissions, method-specific init failed. */122 { NULL, NULL, "/dev/vboxusb", true, NULL, false, VERR_NO_MEMORY, "/dev/vboxusb", false, VERR_NO_MEMORY },123 117 /* No environment, usbfs available but without access permissions. */ 124 118 { NULL, NULL, NULL, false, "/proc/bus/usb", false, VERR_NO_MEMORY, "", true, VERR_VUSB_USBFS_PERMISSION }, 125 /* No environment, usbfs available with access permissions, method-specific126 * init failed. */127 { NULL, NULL, NULL, false, "/proc/bus/usb", true, VERR_NO_MEMORY, "/proc/bus/usb", true, VERR_NO_MEMORY }128 119 }; 129 120 130 121 static void testInit(RTTEST hTest) 131 122 { 132 RTTestSub(hTest, "Testing USBProxy ServiceLinux initialisation");123 RTTestSub(hTest, "Testing USBProxyLinuxChooseMethod"); 133 124 for (unsigned i = 0; i < RT_ELEMENTS(s_testEnvironment); ++i) 134 125 { 135 USBProxyServiceLinux test(NULL); 126 bool fUsingUsbfs = true; 127 const char *pcszDevicesRoot = ""; 128 136 129 TestUSBSetEnv(s_testEnvironment[i].pcszEnvUsb, 137 130 s_testEnvironment[i].pcszEnvUsbRoot); 138 131 TestUSBSetupInit(s_testEnvironment[i].pcszUsbfsRoot, 139 s_testEnvironment[i].fUsbfsAccessible, 140 s_testEnvironment[i].pcszDevicesRoot, 141 s_testEnvironment[i].fDevicesAccessible, 142 s_testEnvironment[i].rcMethodInit); 143 HRESULT hrc = test.init(); 144 RTTESTI_CHECK_MSG(hrc == S_OK, 145 ("init() returned 0x%x (test index %i)!\n", hrc, i)); 146 int rc = test.getLastError(); 132 s_testEnvironment[i].fUsbfsAccessible, 133 s_testEnvironment[i].pcszDevicesRoot, 134 s_testEnvironment[i].fDevicesAccessible, 135 s_testEnvironment[i].rcMethodInit); 136 int rc = USBProxyLinuxChooseMethod(&fUsingUsbfs, &pcszDevicesRoot); 147 137 RTTESTI_CHECK_MSG(rc == s_testEnvironment[i].rcExpected, 148 (" getLastError() returned%Rrc (test index %i) instead of %Rrc!\n",138 ("rc=%Rrc (test index %i) instead of %Rrc!\n", 149 139 rc, i, s_testEnvironment[i].rcExpected)); 150 const char *pcszDevicesRoot = test.testGetDevicesRoot();151 140 RTTESTI_CHECK_MSG(!RTStrCmp(pcszDevicesRoot, 152 141 s_testEnvironment[i].pcszDevicesRootExpected), … … 154 143 pcszDevicesRoot, i, 155 144 s_testEnvironment[i].pcszDevicesRootExpected)); 156 bool fUsingUsbfs = test.testGetUsingUsbfs();157 145 RTTESTI_CHECK_MSG( fUsingUsbfs 158 146 == s_testEnvironment[i].fUsingUsbfsExpected,
Note:
See TracChangeset
for help on using the changeset viewer.