#
# Oracle VM VirtualBox
# VirtualBox linux installation script unit test
#
# Copyright (C) 2007-2011 Oracle Corporation
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
#include installer-common.sh
CERRS=0
echo "Testing udev rule generation"
OUTPUT="$2"
EXPECTED="$4"
VERSION="$6"
*)
echo "Bad output for udev version $VERSION. Expected:"
echo "$EXPECTED"
echo "Actual:"
echo "$OUTPUT"
;;
esac
}
SUBSYSTEM=="usb_device", ACTION=="add", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
SUBSYSTEM=="usb_device", ACTION=="remove", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
install_udev_output="`generate_udev_rule vboxusers 0660 /opt/VirtualBox "" "" "udevinfo, version 059"`"
VERSION 59
VERSION 55
VERSION 54
echo "Testing device node setup"
command="$1"
shift
"install_udev")
"install_create_usb_node_for_sysfs")
*)
esac
}
# Set up unit testing environment for the "install_udev" function below.
eval 'do_install_udev() { test "$1" = "${test_drv_grp}" \
-a "$2" = "${test_drv_mode}" \
-a "$3" = "${test_inst_dir}" \
-a "$4" = "${test_usb_grp}" \
-a "$5" = "${INSTALL_NO_UDEV}" \
|| echo "do_install_udev: bad parameters: $@" >&2 ; }'
eval 'do_install_create_usb_node_for_sysfs() { \
test "$1" = "${sysfs_usb_devices}" \
-a "$2" = "${test_inst_dir}/VBoxCreateUSBNode.sh" \
-a "$3" = "${test_usb_grp}" \
|| echo "do_install_create_usb_node_for_sysfs: \
bad parameters: $@" >&2 ; }'
}
unset INSTALL_NO_GROUP
unset INSTALL_NO_UDEV
command="install_device_node_setup vboxusers 0660 /opt/VirtualBox vboxusb"
test -n "${err}" && {
echo "${command} failed."
echo "Error: ${err}"
}
unset INSTALL_NO_UDEV
command="install_device_node_setup vboxusers 0660 /opt/VirtualBox vboxusb"
test -n "${err}" && {
echo "${command} failed."
echo "Error: ${err}"
}
unset INSTALL_NO_GROUP
command="install_device_node_setup vboxusers 0660 /opt/VirtualBox vboxusb"
test -n "${err}" && {
echo "${command} failed."
echo "Error: ${err}"
}
echo "Done. Error count $CERRS."