~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to tests/regression/apparmor/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#       Copyright (C) 2002-2005 Novell/SUSE
 
2
#
 
3
#       This program is free software; you can redistribute it and/or
 
4
#       modify it under the terms of the GNU General Public License as
 
5
#       published by the Free Software Foundation, version 2 of the
 
6
#       License.
 
7
 
 
8
SRC=access.c \
 
9
    changeprofile.c \
 
10
    changehat.c \
 
11
    changehat_fork.c \
 
12
    changehat_misc.c \
 
13
    changehat_misc2.c \
 
14
    changehat_twice.c \
 
15
    changehat_fail.c \
 
16
    changehat_wrapper.c \
 
17
    changehat_pthread.c \
 
18
    chdir.c \
 
19
    chgrp.c \
 
20
    chmod.c \
 
21
    chown.c \
 
22
    clone.c \
 
23
    coredump.c \
 
24
    deleted.c \
 
25
    environ.c \
 
26
    env_check.c \
 
27
    exec.c \
 
28
    exec_qual.c \
 
29
    exec_qual2.c \
 
30
    fchdir.c \
 
31
    fchgrp.c \
 
32
    fchmod.c \
 
33
    fchown.c \
 
34
    fork.c \
 
35
    link.c \
 
36
    link_subset.c \
 
37
    mmap.c \
 
38
    mkdir.c \
 
39
    mount.c \
 
40
    named_pipe.c \
 
41
    net_raw.c \
 
42
    open.c \
 
43
    openat.c \
 
44
    pipe.c \
 
45
    ptrace.c \
 
46
    ptrace_helper.c \
 
47
    pwrite.c \
 
48
    rename.c \
 
49
    readdir.c \
 
50
    rw.c \
 
51
    symlink.c \
 
52
    syscall_mknod.c \
 
53
    swap.c \
 
54
    syscall_chroot.c \
 
55
    syscall_mlockall.c \
 
56
    syscall_ptrace.c \
 
57
    syscall_reboot.c \
 
58
    syscall_setpriority.c \
 
59
    syscall_sethostname.c \
 
60
    syscall_setdomainname.c \
 
61
    syscall_setscheduler.c \
 
62
    syscall_sysctl.c \
 
63
    sysctl_proc.c \
 
64
    tcp.c \
 
65
    unix_fd_client.c \
 
66
    unix_fd_server.c \
 
67
    unlink.c \
 
68
    xattrs.c
 
69
 
 
70
#only do the ioperm/iopl tests for x86 derived architectures
 
71
ifneq (,$(findstring $(shell uname -i),i386 i486 i586 i686 x86 x86_64))
 
72
SRC+=syscall_ioperm.c syscall_iopl.c
 
73
endif
 
74
 
 
75
# Suck, Fedora Core 3 no longer includes /sbin/kernelversion
 
76
KERNELVERSION:=$(shell if [ -x /sbin/kernelversion ] ; then \
 
77
                                /sbin/kernelversion ; \
 
78
                       else \
 
79
                                uname -r ; \
 
80
                       fi )
 
81
KERNELMAJOR:=$(shell echo ${KERNELVERSION} | cut -d. -f1)
 
82
KERNELMINOR:=$(shell echo ${KERNELVERSION} | cut -d. -f2)
 
83
CHANGEHAT_FLAGS=$(shell if [ ! -f /usr/include/sys/apparmor.h ] ; then \
 
84
                                if [ -f /usr/include/sys/immunix.h ] ; then \
 
85
                                        echo -DUSE_COMPAT_IMMUNIX_H ; \
 
86
                                else \
 
87
                                        (echo -DCHANGEHAT_NOT_IN_LIBRARY; \
 
88
                                        [ $(KERNELMAJOR) -eq 2 ] && \
 
89
                                        if [ $(KERNELMINOR) -eq 4 ] ; then \
 
90
                                                echo -DCHANGEHAT_2_4_KERNEL ; \
 
91
                                        elif [ $(KERNELMINOR) -eq 2 ] ; then \
 
92
                                                echo -DCHANGEHAT_2_2_KERNEL ;\
 
93
                                        fi ) \
 
94
                                fi ;\
 
95
                        fi )
 
96
 
 
97
LIBIMMUNIX:=$(shell     if [ -f /usr/lib/libapparmor.so -o -f /usr/lib64/libapparmor.so ] ; then \
 
98
                                echo -lapparmor ; \
 
99
                        elif [ -f /lib/libimmunix.so.1 -o -f /lib64/libimmunix.so ] ; then \
 
100
                                echo -limmunix ; \
 
101
                        fi )
 
102
 
 
103
CFLAGS+=$(CHANGEHAT_FLAGS) -Wall -Wstrict-prototypes
 
104
LDLIBS+=$(LIBIMMUNIX)
 
105
 
 
106
EXEC=$(SRC:%.c=%)
 
107
 
 
108
TESTS=access \
 
109
      capabilities \
 
110
      changeprofile \
 
111
      changehat \
 
112
      changehat_fork \
 
113
      changehat_misc \
 
114
      chdir \
 
115
      clone \
 
116
      coredump \
 
117
      deleted \
 
118
      environ \
 
119
      exec \
 
120
      exec_qual \
 
121
      fchdir \
 
122
      fork \
 
123
      i18n \
 
124
      link \
 
125
      link_subset \
 
126
      mkdir \
 
127
      mmap \
 
128
      mount \
 
129
      mult_mount \
 
130
      named_pipe \
 
131
      net_raw \
 
132
      open \
 
133
      openat \
 
134
      pipe \
 
135
      ptrace \
 
136
      pwrite \
 
137
      regex \
 
138
      rename \
 
139
      readdir \
 
140
      rw \
 
141
      swap \
 
142
      sd_flags \
 
143
      setattr \
 
144
      symlink \
 
145
      syscall \
 
146
      tcp \
 
147
      unix_fd_server \
 
148
      unlink\
 
149
      xattrs\
 
150
      longpath
 
151
 
 
152
# Tests that can crash the kernel should be placed here
 
153
RISKY_TESTS=
 
154
 
 
155
all: $(EXEC) changehat.h
 
156
 
 
157
changehat_pthread: changehat_pthread.c changehat.h
 
158
        ${CC} ${CFLAGS} ${LDFLAGS} $< -o $@ ${LDLIBS} -pthread
 
159
 
 
160
tests: all
 
161
        @if [ `whoami` = "root" ] ;\
 
162
        then \
 
163
                rc=0; \
 
164
                for i in $(TESTS) ;\
 
165
                do \
 
166
                        echo ;\
 
167
                        echo "running $$i" ;\
 
168
                        bash $$i.sh ;\
 
169
                        if [ $$? -ne 0 ] ; then \
 
170
                                rc=1;\
 
171
                        fi;\
 
172
                done ;\
 
173
                exit $$rc;\
 
174
        else \
 
175
                echo "must be root to run tests" ;\
 
176
                exit 1;\
 
177
        fi
 
178
 
 
179
alltests: all
 
180
        @if [ `whoami` = "root" ] ;\
 
181
        then \
 
182
                rc=0; \
 
183
                for i in $(TESTS) $(RISKY_TESTS) ;\
 
184
                do \
 
185
                        echo ;\
 
186
                        echo "running $$i" ;\
 
187
                        bash $$i.sh ;\
 
188
                        if [ $$? -ne 0 ] ; then \
 
189
                                rc=1;\
 
190
                        fi;\
 
191
                done ;\
 
192
                exit $$rc;\
 
193
        else \
 
194
                echo "must be root to run tests" ;\
 
195
                exit 1;\
 
196
        fi
 
197
 
 
198
clean:
 
199
        rm -f $(EXEC)
 
200
 
 
201
regex.sh: open exec