~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to tests/kernel/mmap-close.sh

  • Committer: Tyler Hicks
  • Date: 2012-09-13 00:42:52 UTC
  • Revision ID: tyhicks@canonical.com-20120913004252-49k77a6u0tyts997
* tests/kernel/mmap-close.sh, tests/kernel/mmap-close/test.c:
  - Add regression test for open->mmap()->close()->dirty memory->munmap()
    pattern

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# mmap-close.sh : Test for catching regressions when applications do this:
 
4
#
 
5
#                 open() -> mmap() -> *close()* -> dirty mapping -> munmap()
 
6
#
 
7
#                 Past regressions have been reported in these bugs:
 
8
#
 
9
#                 https://bugs.launchpad.net/bugs/870326
 
10
#                 https://bugs.launchpad.net/bugs/1047261
 
11
# Author: Tyler Hicks <tyhicks@canonical.com>
 
12
#
 
13
# Copyright (C) 2012 Canonical Ltd.
 
14
#
 
15
# This program is free software; you can redistribute it and/or
 
16
# modify it under the terms of the GNU General Public License
 
17
# as published by the Free Software Foundation version 2
 
18
# of the License.
 
19
#
 
20
# This program is distributed in the hope that it will be useful,
 
21
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
23
# GNU General Public License for more details.
 
24
#
 
25
# You should have received a copy of the GNU General Public License
 
26
# along with this program; if not, write to the Free Software
 
27
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 
28
 
 
29
test_script_dir=$(dirname $0)
 
30
rc=1
 
31
test_dir=0
 
32
 
 
33
. ${test_script_dir}/../lib/etl_funcs.sh
 
34
 
 
35
test_cleanup()
 
36
{
 
37
        etl_remove_test_dir $test_dir
 
38
        etl_umount
 
39
        etl_lumount
 
40
        etl_unlink_keys
 
41
        exit $rc
 
42
}
 
43
trap test_cleanup 0 1 2 3 15
 
44
 
 
45
# TEST
 
46
etl_add_keys || exit
 
47
etl_lmount || exit
 
48
etl_mount_i || exit
 
49
test_dir=$(etl_create_test_dir `basename $0`) || exit
 
50
test_file="${test_dir}/test_file"
 
51
 
 
52
${test_script_dir}/mmap-close/test $test_file || exit
 
53
 
 
54
md5sum1=$(md5sum $test_file) || exit
 
55
 
 
56
etl_umount || exit
 
57
etl_mount_i || exit
 
58
 
 
59
md5sum2=$(md5sum $test_file) || exit
 
60
 
 
61
if [ "$md5sum1" == "$md5sum2" ]; then
 
62
        rc=0
 
63
fi
 
64
 
 
65
exit