Merge lp:~tyhicks/ecryptfs/namelen-test into lp:ecryptfs

Proposed by Tyler Hicks
Status: Merged
Merged at revision: 835
Proposed branch: lp:~tyhicks/ecryptfs/namelen-test
Merge into: lp:ecryptfs
Diff against target: 82 lines (+60/-1)
3 files modified
tests/kernel/Makefile.am (+1/-0)
tests/kernel/namelen.sh (+58/-0)
tests/kernel/tests.rc (+1/-1)
To merge this branch: bzr merge lp:~tyhicks/ecryptfs/namelen-test
Reviewer Review Type Date Requested Status
Colin Ian King (community) Approve
Review via email: mp+242951@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Colin Ian King (colin-king) wrote :

Looks sane to me. Ack.

review: Approve
lp:~tyhicks/ecryptfs/namelen-test updated
835. By Tyler Hicks

Add test for validating reported namelen value

Revision history for this message
Tyler Hicks (tyhicks) wrote :

Hey Colin - I fixed and pushed a small issue right before you gave me the ack. I didn't call the proper cleanup helpers (etl_umount, etl_lumount, etl_unlink_keys) from the test script's cleanup trap.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/kernel/Makefile.am'
2--- tests/kernel/Makefile.am 2013-01-24 17:33:42 +0000
3+++ tests/kernel/Makefile.am 2014-11-26 18:42:15 +0000
4@@ -28,6 +28,7 @@
5 mmap-bmap.sh \
6 mmap-close.sh \
7 mmap-dir.sh \
8+ namelen.sh \
9 read-dir.sh \
10 setattr-flush-dirty.sh \
11 trunc-file.sh
12
13=== added file 'tests/kernel/namelen.sh'
14--- tests/kernel/namelen.sh 1970-01-01 00:00:00 +0000
15+++ tests/kernel/namelen.sh 2014-11-26 18:42:15 +0000
16@@ -0,0 +1,58 @@
17+#!/bin/bash
18+#
19+# namelen.sh: Test for validating namelen reported by eCryptfs
20+# Author: Tyler Hicks <tyhicks@canonical.com>
21+#
22+# Copyright (C) 2014 Canonical Ltd.
23+#
24+# This program is free software; you can redistribute it and/or
25+# modify it under the terms of the GNU General Public License
26+# as published by the Free Software Foundation version 2
27+# of the License.
28+#
29+# This program is distributed in the hope that it will be useful,
30+# but WITHOUT ANY WARRANTY; without even the implied warranty of
31+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+# GNU General Public License for more details.
33+#
34+# You should have received a copy of the GNU General Public License
35+# along with this program; if not, write to the Free Software
36+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
37+
38+test_script_dir=$(dirname $0)
39+rc=1
40+
41+. ${test_script_dir}/../lib/etl_funcs.sh
42+
43+test_cleanup()
44+{
45+ etl_remove_test_dir "$test_dir"
46+ etl_umount
47+ etl_lumount
48+ etl_unlink_keys
49+ exit $rc
50+}
51+trap test_cleanup 0 1 2 3 15
52+
53+etl_add_keys || exit
54+etl_lmount || exit
55+etl_mount_i || exit
56+test_dir=$(etl_create_test_dir) || exit
57+test_file="$test_dir/a"
58+
59+namelen=$(getconf NAME_MAX "$test_dir")
60+[ $namelen -le 0 ] && exit
61+
62+# Make sure we can create any file up to namelen chars long
63+for ((i=1; i <= $namelen; i++)); do
64+ touch "$test_file" || exit
65+ rm $test_file
66+ test_file+=a
67+done
68+
69+# Throw an error if creating a file (namelen + 1) chars long succeeds
70+test_file+=a
71+touch "$test_file" 2>/dev/null && exit
72+
73+rc=0
74+exit
75
76=== modified file 'tests/kernel/tests.rc'
77--- tests/kernel/tests.rc 2013-01-24 17:33:42 +0000
78+++ tests/kernel/tests.rc 2014-11-26 18:42:15 +0000
79@@ -1,2 +1,2 @@
80 destructive="miscdev-bad-count.sh extend-file-random.sh trunc-file.sh directory-concurrent.sh file-concurrent.sh lp-994247.sh"
81-safe="llseek.sh lp-469664.sh lp-524919.sh lp-509180.sh lp-613873.sh lp-745836.sh lp-870326.sh lp-885744.sh lp-926292.sh inotify.sh mmap-bmap.sh mmap-close.sh mmap-dir.sh read-dir.sh setattr-flush-dirty.sh inode-race-stat.sh lp-1009207.sh enospc.sh lp-911507.sh lp-872905.sh lp-561129.sh mknod.sh link.sh xattr.sh"
82+safe="llseek.sh lp-469664.sh lp-524919.sh lp-509180.sh lp-613873.sh lp-745836.sh lp-870326.sh lp-885744.sh lp-926292.sh inotify.sh mmap-bmap.sh mmap-close.sh mmap-dir.sh read-dir.sh setattr-flush-dirty.sh inode-race-stat.sh lp-1009207.sh enospc.sh lp-911507.sh lp-872905.sh lp-561129.sh mknod.sh link.sh xattr.sh namelen.sh"

Subscribers

People subscribed via source and target branches