tstInstallerLinux.sh revision db02ea0a50fcbf38450d91bd145f40977aa39df8
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# Oracle VM VirtualBox
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# VirtualBox linux installation script unit test
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# Copyright (C) 2007-2011 Oracle Corporation
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# available from http://www.virtualbox.org. This file is free software;
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# you can redistribute it and/or modify it under the terms of the GNU
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# General Public License (GPL) as published by the Free Software
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
d87ec738bd7d30635ddd129a1beb7eadb6658aa9vboxsyncecho "Testing udev rule generation"
3a57b442195315f0e98e6e9b56ee1dc198cb9ce7vboxsync echo "Bad output for udev version $VERSION. Expected:"
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsyncKERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
db02ea0a50fcbf38450d91bd145f40977aa39df8vboxsyncKERNEL=="vboxnetctl", NAME="vboxnetctl", OWNER="root", GROUP="vboxusers", MODE="0660"
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsyncSUBSYSTEM=="usb_device", ACTION=="add", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsyncSUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsyncSUBSYSTEM=="usb_device", ACTION=="remove", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsyncSUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN+="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
3a57b442195315f0e98e6e9b56ee1dc198cb9ce7vboxsyncinstall_udev_output="`generate_udev_rule vboxusers 0660 /opt/VirtualBox "" "" "udevinfo, version 059"`"
3a57b442195315f0e98e6e9b56ee1dc198cb9ce7vboxsynccheck_udev_rule_generation OUTPUT "$install_udev_output" \
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsyncKERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
db02ea0a50fcbf38450d91bd145f40977aa39df8vboxsyncKERNEL=="vboxnetctl", NAME="vboxnetctl", OWNER="root", GROUP="vboxusers", MODE="0660"
3a57b442195315f0e98e6e9b56ee1dc198cb9ce7vboxsyncinstall_udev_output="`generate_udev_rule vboxusers 0660 /opt/VirtualBox "" "" "v 0055"`"
3a57b442195315f0e98e6e9b56ee1dc198cb9ce7vboxsynccheck_udev_rule_generation OUTPUT "$install_udev_output" \
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsyncKERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"
db02ea0a50fcbf38450d91bd145f40977aa39df8vboxsyncKERNEL="vboxnetctl", NAME="vboxnetctl", OWNER="root", GROUP="root", MODE="0600"
3a57b442195315f0e98e6e9b56ee1dc198cb9ce7vboxsyncinstall_udev_output="`generate_udev_rule root 0600 /usr/lib/virtualbox "" "" 54`"
3a57b442195315f0e98e6e9b56ee1dc198cb9ce7vboxsynccheck_udev_rule_generation OUTPUT "$install_udev_output" \
551b0326a620dcb8f7d0b062cb25266dbfb23661vboxsyncecho "Testing device node setup"
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync echo Unknown command $command >&2; exit 1;;
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync # Set up unit testing environment for the "install_udev" function below.
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync test_inst_dir="$3" # The expected installation directory
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync eval 'do_install_udev() { test "$1" = "${test_drv_grp}" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync -a "$2" = "${test_drv_mode}" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync -a "$3" = "${test_inst_dir}" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync -a "$4" = "${test_usb_grp}" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync -a "$5" = "${INSTALL_NO_UDEV}" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync || echo "do_install_udev: bad parameters: $@" >&2 ; }'
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync test "$1" = "${sysfs_usb_devices}" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync -a "$2" = "${test_inst_dir}/VBoxCreateUSBNode.sh" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync -a "$3" = "${test_usb_grp}" \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync || echo "do_install_create_usb_node_for_sysfs: \
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsyncbad parameters: $@" >&2 ; }'
551b0326a620dcb8f7d0b062cb25266dbfb23661vboxsyncsetup_test_input_install_device_node_setup vboxusers 0660 /opt/VirtualBox \
551b0326a620dcb8f7d0b062cb25266dbfb23661vboxsynccommand="install_device_node_setup vboxusers 0660 /opt/VirtualBox vboxusb"
551b0326a620dcb8f7d0b062cb25266dbfb23661vboxsyncsetup_test_input_install_device_node_setup root 0660 /opt/VirtualBox root
551b0326a620dcb8f7d0b062cb25266dbfb23661vboxsynccommand="install_device_node_setup vboxusers 0660 /opt/VirtualBox vboxusb"
551b0326a620dcb8f7d0b062cb25266dbfb23661vboxsyncsetup_test_input_install_device_node_setup vboxusers 0660 /opt/VirtualBox \
551b0326a620dcb8f7d0b062cb25266dbfb23661vboxsynccommand="install_device_node_setup vboxusers 0660 /opt/VirtualBox vboxusb"
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsyncecho "Done. Error count $CERRS."