1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Oracle VM VirtualBox
|
---|
4 | # VirtualBox linux installation script unit test
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2007-2015 Oracle Corporation
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License (GPL) as published by the Free Software
|
---|
13 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | #
|
---|
17 |
|
---|
18 | #include installer-common.sh
|
---|
19 |
|
---|
20 | echo Testing udev rule generation
|
---|
21 |
|
---|
22 | setup_test_install_udev
|
---|
23 |
|
---|
24 | TEST_UDEV_VERSION=55
|
---|
25 |
|
---|
26 | udev_55_rules=`cat <<UDEV_END
|
---|
27 | KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
|
---|
28 | SUBSYSTEM=="usb_device", ACTION=="add", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
|
---|
29 | SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
|
---|
30 | SUBSYSTEM=="usb_device", ACTION=="remove", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
|
---|
31 | SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
|
---|
32 | UDEV_END
|
---|
33 |
|
---|
34 | install_udev_output="`install_udev_run`"
|
---|
35 | case "$install_udev_output" in
|
---|
36 | "$udev_55_rules") ;;
|
---|
37 | *)
|
---|
38 | echo "Bad output for udev version 55. Expected:"
|
---|
39 | echo "$udev_55_rules"
|
---|
40 | echo "Actual:"
|
---|
41 | echo "$install_udev_output"
|
---|
42 | ;;
|
---|
43 | esac
|
---|
44 |
|
---|
45 | TEST_UDEV_VERSION=54
|
---|
46 |
|
---|
47 | udev_54_rules=`cat <<UDEV_END
|
---|
48 | KERNEL="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="vboxusers", MODE="0660"
|
---|
49 | SUBSYSTEM="usb_device", ACTION="add", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
|
---|
50 | SUBSYSTEM="usb", ACTION="add", ENV{DEVTYPE}="usb_device", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}"
|
---|
51 | SUBSYSTEM="usb_device", ACTION="remove", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
|
---|
52 | SUBSYSTEM="usb", ACTION="remove", ENV{DEVTYPE}="usb_device", RUN="/opt/VirtualBox/VBoxCreateUSBNode.sh --remove $major $minor"
|
---|
53 | UDEV_END
|
---|
54 |
|
---|
55 | install_udev_output="`install_udev_run`"
|
---|
56 | case "$install_udev_output" in
|
---|
57 | "$udev_54_rules") ;;
|
---|
58 | *)
|
---|
59 | echo "Bad output for udev version 54. Expected:"
|
---|
60 | echo "$udev_54_rules"
|
---|
61 | echo "Actual:"
|
---|
62 | echo "$install_udev_output"
|
---|
63 | ;;
|
---|
64 | esac
|
---|
65 |
|
---|
66 | echo Done.
|
---|