tstInstallerLinux.sh revision f1acc1e99894e016bd1a6ee65c56b3fc064fa4eb
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"
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync *) echo Unknown command $command >&2; exit 1;;
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync # Set up unit testing environment for the "install_udev" function below.
cf0c5109e04ca2939c011edb5ac034987591fd9evboxsync eval 'my_rm() { case "$2" in "/etc/udev/rules.d/60-vboxdrv.rules") true ;; *) echo "rm: bad file name \"$2\"!"; false ;; esac ; }'
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsyncKERNEL=="vboxdrv", NAME="vboxdrv", 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"
d87ec738bd7d30635ddd129a1beb7eadb6658aa9vboxsyncinstall_udev_output="`install_udev vboxusers 0660 /opt/VirtualBox`"
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsync echo "Bad output for udev version 59. Expected:"
4d878e2d51fdc1fc9911161eee65eaf74ed48400vboxsync echo "Actual:"
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsyncKERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
d87ec738bd7d30635ddd129a1beb7eadb6658aa9vboxsyncinstall_udev_output="`install_udev vboxusers 0660 /opt/VirtualBox`"
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync echo "Bad output for udev version 55. Expected:"
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync echo "Actual:"
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsyncKERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600"
d87ec738bd7d30635ddd129a1beb7eadb6658aa9vboxsyncinstall_udev_output="`install_udev root 0600 /usr/lib/virtualbox`"
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync echo "Bad output for udev version 54. Expected:"
09ed5ee011f3a6cd9d4742216ad3bb7dbf855641vboxsync echo "Actual:"
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."