Minor fix for the license of tests package
[platform/upstream/dbus.git] / test / test-apparmor-activation.sh
1 #!/bin/sh
2
3 # Copyright © 2016 Collabora Ltd.
4 #
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation files
7 # (the "Software"), to deal in the Software without restriction,
8 # including without limitation the rights to use, copy, modify, merge,
9 # publish, distribute, sublicense, and/or sell copies of the Software,
10 # and to permit persons to whom the Software is furnished to do so,
11 # subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 # SOFTWARE.
24
25 set -e
26
27 if [ "x$(id -u)" != "x0" ]; then
28     echo "1..0 # SKIP - this test can only be run as root"
29     exit 0
30 fi
31
32 if [ -z "$DBUS_TEST_EXEC" ]; then
33     DBUS_TEST_EXEC="$(dirname "$0")"
34     if ! [ -x "$DBUS_TEST_EXEC/test-apparmor-activation" ]; then
35         echo "1..0 # SKIP - executable not found and DBUS_TEST_EXEC not set"
36         exit 0
37     fi
38 fi
39
40 if [ -z "$DBUS_TEST_DATA" ]; then
41     DBUS_TEST_DATA="$DBUS_TEST_EXEC/data"
42     if ! [ -e "$DBUS_TEST_DATA/dbus-installed-tests.aaprofile" ]; then
43         echo "1..0 # SKIP - required data not found and DBUS_TEST_DATA not set"
44         exit 0
45     fi
46 fi
47
48 echo "# Attempting to load AppArmor profiles"
49 if ! apparmor_parser --skip-cache --replace \
50         "$DBUS_TEST_DATA/dbus-installed-tests.aaprofile"; then
51     echo "1..0 # SKIP - unable to load AppArmor profiles"
52     exit 0
53 fi
54
55 exec "$DBUS_TEST_EXEC/test-apparmor-activation" --tap "$@"
56
57 # vim:set sts=4 sw=4 et: