~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

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

  • Committer: Dustin Kirkland
  • Date: 2016-02-27 00:00:23 UTC
  • Revision ID: kirkland@ubuntu.com-20160227000023-h0e4oui5y1vbaurd
openingĀ 112

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# mmap-bmap.sh : Test to see if bmap from upper is a subset of the lower
 
4
#
 
5
# Author: Colin Ian King <colin.king@canonical.com>
 
6
#
 
7
# Copyright (C) 2013 Canonical Ltd.
 
8
#
 
9
# This program is free software; you can redistribute it and/or
 
10
# modify it under the terms of the GNU General Public License
 
11
# as published by the Free Software Foundation version 2
 
12
# of the License.
 
13
#
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
#
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with this program; if not, write to the Free Software
 
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 
22
 
 
23
test_script_dir=$(dirname $0)
 
24
rc=1
 
25
test_dir=0
 
26
 
 
27
. ${test_script_dir}/../lib/etl_funcs.sh
 
28
 
 
29
test_cleanup()
 
30
{
 
31
        etl_remove_test_dir $test_dir
 
32
        etl_umount
 
33
        etl_lumount
 
34
        etl_unlink_keys
 
35
        exit $rc
 
36
}
 
37
trap test_cleanup 0 1 2 3 15
 
38
 
 
39
# TEST
 
40
etl_add_keys || exit
 
41
etl_lmount || exit
 
42
etl_mount_i || exit
 
43
test_dir=$(etl_create_test_dir) || exit
 
44
test_file="${test_dir}/test_file"
 
45
 
 
46
dd if=/dev/zero of=$test_file bs=1M count=1 > /dev/null 2>&1 || exit
 
47
lower_test_file=$(etl_find_lower_path $test_file)
 
48
if [ $? -ne 0 ] || [ -z "$lower_test_file" ]; then
 
49
        rc=1
 
50
        exit
 
51
fi
 
52
${test_script_dir}/mmap-bmap/test $lower_test_file $test_file || exit
 
53
rc=$?
 
54
 
 
55
etl_umount || exit
 
56
etl_mount_i || exit
 
57
 
 
58
exit