1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync/* $Id$ */
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync/** @file
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * USBProxyServiceLinux test case.
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync */
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync/*
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * Copyright (C) 2011 Oracle Corporation
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync *
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * available from http://www.virtualbox.org. This file is free software;
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * General Public License (GPL) as published by the Free Software
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync */
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync/******************************************************************************
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync* Header Files *
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync******************************************************************************/
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync#include "USBProxyService.h"
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync#include "USBGetDevices.h"
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync#include <VBox/err.h>
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync#include <iprt/assert.h>
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync#include <iprt/env.h>
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync#include <iprt/string.h>
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync#include <iprt/test.h>
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync/*** BEGIN STUBS ***/
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncUSBProxyService::USBProxyService(Host*) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncUSBProxyService::~USBProxyService() {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncHRESULT USBProxyService::init() { return S_OK; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncint USBProxyService::start() { return VINF_SUCCESS; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncint USBProxyService::stop() { return VINF_SUCCESS; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncRWLockHandle *USBProxyService::lockHandle() const { return NULL; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid *USBProxyService::insertFilter(USBFILTER const*) { return NULL; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::removeFilter(void*) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncint USBProxyService::captureDevice(HostUSBDevice*) { return VINF_SUCCESS; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::captureDeviceCompleted(HostUSBDevice*, bool) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::detachingDevice(HostUSBDevice*) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncint USBProxyService::releaseDevice(HostUSBDevice*) { return VINF_SUCCESS; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::releaseDeviceCompleted(HostUSBDevice*, bool) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::serviceThreadInit() {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::serviceThreadTerm() {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncint USBProxyService::wait(unsigned int) { return VINF_SUCCESS; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncint USBProxyService::interruptWait() { return VINF_SUCCESS; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncPUSBDEVICE USBProxyService::getDevices() { return NULL; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::deviceRemoved(ComObjPtr<HostUSBDevice> &aDevice) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid USBProxyService::deviceChanged(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList*, SessionMachine*) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncbool USBProxyService::updateDeviceState(HostUSBDevice*, USBDEVICE*, bool*, SessionMachine**) { return true; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncbool USBProxyService::updateDeviceStateFake(HostUSBDevice*, USBDEVICE*, bool*, SessionMachine**) { return true; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncbool USBProxyService::isActive() { return true; }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncVBoxMainHotplugWaiter::VBoxMainHotplugWaiter(char const*) {}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
8c1c3e6cfb2f0d0c4656d1d03ada68a8318ca11fvboxsynccom::Utf8Str HostUSBDevice::i_getName()
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync return Utf8Str();
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
37c53e9b2c955f92dff6f11aff63809004945f17vboxsyncint USBProxyService::getLastError(void)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync return mLastError;
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncvoid SysFreeString(BSTR bstr)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync Assert(0);
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
b0a3d0ec5780199a2f379da63c59ccf48f1a73b9vboxsyncstatic struct
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync{
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pcszEnvUsb;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pcszEnvUsbRoot;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pcszDevicesRoot;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync bool fDevicesAccessible;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pcszUsbfsRoot;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync bool fUsbfsAccessible;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync int rcMethodInit;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pcszDevicesRootExpected;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync bool fUsingUsbfsExpected;
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync int rcExpected;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync} s_testEnvironment[] =
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync{
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync /* "sysfs" and valid root in the environment */
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync { "sysfs", "/dev/bus/usb", "/dev/bus/usb", true, NULL, false, VINF_SUCCESS, "/dev/bus/usb", false, VINF_SUCCESS },
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync /* "sysfs" and bad root in the environment */
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync { "sysfs", "/dev/bus/usb", "/dev/vboxusb", false, "/proc/usb/bus", false, VINF_SUCCESS, "", true, VERR_NOT_FOUND },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* "sysfs" and no root in the environment */
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync { "sysfs", NULL, "/dev/vboxusb", true, NULL, false, VINF_SUCCESS, "/dev/vboxusb", false, VINF_SUCCESS },
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync /* "usbfs" and valid root in the environment */
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync { "usbfs", "/dev/bus/usb", NULL, false, "/dev/bus/usb", true, VINF_SUCCESS, "/dev/bus/usb", true, VINF_SUCCESS },
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync /* "usbfs" and bad root in the environment */
2d8a09147af7f74a5deb52f52ded5b845ddcba2dvboxsync { "usbfs", "/dev/bus/usb", "/dev/vboxusb", false, "/proc/usb/bus", false, VINF_SUCCESS, "", true, VERR_NOT_FOUND },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* "usbfs" and no root in the environment */
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync { "usbfs", NULL, NULL, false, "/proc/bus/usb", true, VINF_SUCCESS, "/proc/bus/usb", true, VINF_SUCCESS },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* invalid method in the environment, sysfs available */
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync { "invalid", "/dev/bus/usb", "/dev/vboxusb", true, NULL, false, VINF_SUCCESS, "/dev/vboxusb", false, VINF_SUCCESS },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* invalid method in the environment, usbfs available */
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync { "invalid", "/dev/bus/usb", NULL, true, "/proc/bus/usb", true, VINF_SUCCESS, "/proc/bus/usb", true, VINF_SUCCESS },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* invalid method in the environment, sysfs inaccessible */
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync { "invalid", "/dev/bus/usb", "/dev/vboxusb", false, NULL, false, VINF_SUCCESS, "", true, VERR_VUSB_USB_DEVICE_PERMISSION },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* invalid method in the environment, usbfs inaccessible */
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync { "invalid", "/dev/bus/usb", NULL, false, "/proc/bus/usb", false, VINF_SUCCESS, "", true, VERR_VUSB_USBFS_PERMISSION },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* No environment, sysfs and usbfs available but without access permissions. */
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync { NULL, NULL, "/dev/vboxusb", false, "/proc/bus/usb", false, VERR_NO_MEMORY, "", true, VERR_VUSB_USB_DEVICE_PERMISSION },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* No environment, sysfs and usbfs available, access permissions for sysfs. */
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync { NULL, NULL, "/dev/vboxusb", true, "/proc/bus/usb", false, VINF_SUCCESS, "/dev/vboxusb", false, VINF_SUCCESS },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* No environment, sysfs and usbfs available, access permissions for usbfs. */
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync { NULL, NULL, "/dev/vboxusb", false, "/proc/bus/usb", true, VINF_SUCCESS, "/proc/bus/usb", true, VINF_SUCCESS },
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync /* No environment, sysfs available but without access permissions. */
ca5d48382e06537b69b713b1b772dc299e681d24vboxsync { NULL, NULL, "/dev/vboxusb", false, NULL, false, VERR_NO_MEMORY, "", true, VERR_VUSB_USB_DEVICE_PERMISSION },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* No environment, usbfs available but without access permissions. */
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync { NULL, NULL, NULL, false, "/proc/bus/usb", false, VERR_NO_MEMORY, "", true, VERR_VUSB_USBFS_PERMISSION },
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync};
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
37c53e9b2c955f92dff6f11aff63809004945f17vboxsyncstatic void testInit(RTTEST hTest)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync RTTestSub(hTest, "Testing USBProxyLinuxChooseMethod");
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync for (unsigned i = 0; i < RT_ELEMENTS(s_testEnvironment); ++i)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync {
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync bool fUsingUsbfs = true;
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync const char *pcszDevicesRoot = "";
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync
5931d363b6b08895843fb9bfcc9823795da1e952vboxsync TestUSBSetEnv(s_testEnvironment[i].pcszEnvUsb,
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync s_testEnvironment[i].pcszEnvUsbRoot);
5931d363b6b08895843fb9bfcc9823795da1e952vboxsync TestUSBSetupInit(s_testEnvironment[i].pcszUsbfsRoot,
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync s_testEnvironment[i].fUsbfsAccessible,
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync s_testEnvironment[i].pcszDevicesRoot,
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync s_testEnvironment[i].fDevicesAccessible,
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync s_testEnvironment[i].rcMethodInit);
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync int rc = USBProxyLinuxChooseMethod(&fUsingUsbfs, &pcszDevicesRoot);
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync RTTESTI_CHECK_MSG(rc == s_testEnvironment[i].rcExpected,
15560e9bb8e85bdbe311a5c02139b487a306859dvboxsync ("rc=%Rrc (test index %i) instead of %Rrc!\n",
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync rc, i, s_testEnvironment[i].rcExpected));
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync RTTESTI_CHECK_MSG(!RTStrCmp(pcszDevicesRoot,
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync s_testEnvironment[i].pcszDevicesRootExpected),
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync ("testGetDevicesRoot() returned %s (test index %i) instead of %s!\n",
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync pcszDevicesRoot, i,
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync s_testEnvironment[i].pcszDevicesRootExpected));
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync RTTESTI_CHECK_MSG( fUsingUsbfs
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync == s_testEnvironment[i].fUsingUsbfsExpected,
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync ("testGetUsingUsbfs() returned %RTbool (test index %i) instead of %RTbool!\n",
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync fUsingUsbfs, i,
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync s_testEnvironment[i].fUsingUsbfsExpected));
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync }
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
b0a3d0ec5780199a2f379da63c59ccf48f1a73b9vboxsyncstatic struct
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pacszDeviceAddresses[16];
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pacszAccessibleFiles[16];
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync const char *pcszRoot;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync bool fIsDeviceNodes;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync bool fAvailableExpected;
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync} s_testCheckDeviceRoot[] =
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* /dev/vboxusb accessible -> device nodes method available */
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync { { NULL }, { "/dev/vboxusb" }, "/dev/vboxusb", true, true },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* /dev/vboxusb present but not accessible -> device nodes method not
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync * available */
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync { { NULL }, { NULL }, "/dev/vboxusb", true, false },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* /proc/bus/usb available but empty -> usbfs method available (we can't
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync * really check in this case) */
ce58048f6cafbf5f68163cc932fecc521de0733fvboxsync { { NULL }, { "/proc/bus/usb" }, "/proc/bus/usb", false, true },
ce58048f6cafbf5f68163cc932fecc521de0733fvboxsync /* /proc/bus/usb not available or not accessible -> usbfs method not available */
ce58048f6cafbf5f68163cc932fecc521de0733fvboxsync { { NULL }, { NULL }, "/proc/bus/usb", false, false },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* /proc/bus/usb available, one inaccessible device -> usbfs method not
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync * available */
ce58048f6cafbf5f68163cc932fecc521de0733fvboxsync { { "/proc/bus/usb/001/001" }, { "/proc/bus/usb" }, "/proc/bus/usb", false, false },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* /proc/bus/usb available, one device of two inaccessible -> usbfs method
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync * not available */
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync { { "/proc/bus/usb/001/001", "/proc/bus/usb/002/002" },
ce58048f6cafbf5f68163cc932fecc521de0733fvboxsync { "/proc/bus/usb", "/proc/bus/usb/001/001" }, "/proc/bus/usb", false, false },
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync /* /proc/bus/usb available, two accessible devices -> usbfs method
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync * available */
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync { { "/proc/bus/usb/001/001", "/proc/bus/usb/002/002" },
ce58048f6cafbf5f68163cc932fecc521de0733fvboxsync { "/proc/bus/usb", "/proc/bus/usb/001/001", "/proc/bus/usb/002/002" },
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync "/proc/bus/usb", false, true }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync};
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
37c53e9b2c955f92dff6f11aff63809004945f17vboxsyncstatic void testCheckDeviceRoot(RTTEST hTest)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync RTTestSub(hTest, "Testing the USBProxyLinuxCheckDeviceRoot API");
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync for (unsigned i = 0; i < RT_ELEMENTS(s_testCheckDeviceRoot); ++i)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync {
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync TestUSBSetAvailableUsbfsDevices(s_testCheckDeviceRoot[i]
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync .pacszDeviceAddresses);
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync TestUSBSetAccessibleFiles(s_testCheckDeviceRoot[i]
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync .pacszAccessibleFiles);
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync bool fAvailable = USBProxyLinuxCheckDeviceRoot
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync (s_testCheckDeviceRoot[i].pcszRoot,
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync s_testCheckDeviceRoot[i].fIsDeviceNodes);
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync RTTESTI_CHECK_MSG( fAvailable
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync == s_testCheckDeviceRoot[i].fAvailableExpected,
1df46139c7299e5fbb38e49955bce0c8ad972330vboxsync ("USBProxyLinuxCheckDeviceRoot() returned %RTbool (test index %i) instead of %RTbool!\n",
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync fAvailable, i,
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync s_testCheckDeviceRoot[i].fAvailableExpected));
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync }
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync}
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsyncint main(void)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync{
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync /*
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * Init the runtime, test and say hello.
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync */
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync RTTEST hTest;
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync RTEXITCODE rcExit = RTTestInitAndCreate("tstUSBProxyLinux", &hTest);
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync if (rcExit != RTEXITCODE_SUCCESS)
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync return rcExit;
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync RTTestBanner(hTest);
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync /*
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * Run the tests.
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync */
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync testInit(hTest);
37c53e9b2c955f92dff6f11aff63809004945f17vboxsync testCheckDeviceRoot(hTest);
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync /*
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync * Summary
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync */
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync return RTTestSummaryAndDestroy(hTest);
1d7eb4842eb34752cbc8655fc26097b97806314dvboxsync}