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

« back to all changes in this revision

Viewing changes to tests/regression/subdomain/coredump.sh

  • 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
 
#! /bin/bash
2
 
# $Id: coredump.sh 61 2006-05-19 18:32:14Z steve-beattie $
3
 
 
4
 
#       Copyright (C) 2002-2005 Novell/SUSE
5
 
#
6
 
#       This program is free software; you can redistribute it and/or
7
 
#       modify it under the terms of the GNU General Public License as
8
 
#       published by the Free Software Foundation, version 2 of the
9
 
#       License.
10
 
 
11
 
#=NAME coredump
12
 
#=DESCRIPTION coredump test
13
 
 
14
 
checkcorefile()
15
 
{
16
 
_corefilelist=`echo core.*`
17
 
if [ "$_corefilelist" = "core.*" ]
18
 
then
19
 
        _corefile=no
20
 
else
21
 
        _corefile=yes
22
 
fi
23
 
 
24
 
if [ "$1" = "yes" -a "$_corefile" = "no" ]
25
 
then
26
 
        echo "Error: corefile expected but not present - $2"
27
 
elif [ "$1" = "no" -a "$_corefile"  = "yes" ]
28
 
then
29
 
        echo "Error: corefile present when not expected -- $2"
30
 
fi
31
 
 
32
 
unset _corefile _corefilelist
33
 
rm -f core.*
34
 
}
35
 
 
36
 
pwd=`dirname $0`
37
 
pwd=`cd $pwd ; /bin/pwd`
38
 
 
39
 
bin=$pwd
40
 
 
41
 
. $bin/prologue.inc
42
 
 
43
 
coreperm=r
44
 
nocoreperm=ix
45
 
 
46
 
# enable coredumps
47
 
ulimit -c 1000000
48
 
 
49
 
# PASS TEST, no confinement
50
 
echo "*** A 'Segmentation Fault' message from bash is expected for the following test"
51
 
runchecktest "COREDUMP (no confinement)" signal11
52
 
checkcorefile yes "COREDUMP (no confinement)"
53
 
 
54
 
# PASS TEST, with r confinement
55
 
genprofile $test:$coreperm
56
 
cat $profile
57
 
 
58
 
echo
59
 
echo "*** A 'Segmentation Fault' message from bash is expected for the following test"
60
 
runchecktest "COREDUMP ($coreperm confinement)" signal11
61
 
checkcorefile yes "COREDUMP ($coreperm confinement)"
62
 
 
63
 
# FAIL TEST, with x confinement
64
 
genprofile $test:$nocoreperm
65
 
cat $profile
66
 
 
67
 
echo
68
 
echo "*** A 'Segmentation Fault' message from bash is expected for the following test"
69
 
runchecktest "COREDUMP ($nocoreperm confinement)" signal11
70
 
checkcorefile no "COREDUMP ($nocoreperm confinement)"