~ecryptfs/ecryptfs/oldtrunk2

« back to all changes in this revision

Viewing changes to tests/kernel/lp-745836.sh

  • Committer: Tyler Hicks
  • Author(s): Colin King
  • Date: 2012-03-30 14:25:03 UTC
  • mfrom: (660.1.13 new-tests)
  • Revision ID: tyhicks@canonical.com-20120330142503-pny5ti93wo0577kb
* tests/kernel/lp-745836.sh:
  - test case for clearing ECRYPTFS_NEW_FILE flag during truncate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# lp-74586.sh: Test for https://launchpad.net/bugs/745836
 
4
# Author: Colin Ian King <colin.king@canonical.com>
 
5
#
 
6
# Copyright (C) 2012 Canonical Ltd.
 
7
#
 
8
# This program is free software; you can redistribute it and/or
 
9
# modify it under the terms of the GNU General Public License
 
10
# as published by the Free Software Foundation version 2
 
11
# of the License.
 
12
#
 
13
# This program is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with this program; if not, write to the Free Software
 
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 
21
 
 
22
test_script_dir=$(dirname $0)
 
23
rc=1
 
24
 
 
25
. ${test_script_dir}/../lib/etl_funcs.sh
 
26
 
 
27
test_cleanup()
 
28
{
 
29
        etl_remove_test_dir $test_dir
 
30
        etl_umount
 
31
        etl_lumount
 
32
        etl_unlink_keys
 
33
        exit $rc
 
34
}
 
35
trap test_cleanup 0 1 2 3 15
 
36
 
 
37
etl_add_keys || exit
 
38
etl_lmount || exit
 
39
etl_mount_i || exit
 
40
test_dir=$(etl_create_test_dir `basename $0`) || exit
 
41
test_file="${test_dir}/foo"
 
42
 
 
43
touch $test_file || exit
 
44
truncate -s 4096 $test_file || exit
 
45
sync || exit
 
46
echo 1 > /proc/sys/vm/drop_caches || exit
 
47
#
 
48
#  File should be all full of zeros and hence have the
 
49
#  following md5sum:
 
50
#
 
51
sum=$(md5sum $test_file | cut -f1 -d ' ')
 
52
if [ $sum == "620f0b67a91f7f74151bc5be745b7110" ]; then
 
53
        rc=0
 
54
fi
 
55
rm $test_file
 
56
 
 
57
exit