Re: [PATCH v2 4/6] overlay/017: create helpers to record and check inode numbers

Amir Goldstein
2017-04-28T10:53:30Z

On Fri, Apr 28, 2017 at 1:04 PM, Amir Goldstein <amir73il@gmail.com> wrote:
> On Fri, Apr 28, 2017 at 12:24 PM, Eryu Guan <eguan@redhat.com> wrote:
>> On Fri, Apr 28, 2017 at 11:24:46AM +0300, Amir Goldstein wrote:
>>> Use helpers to records and check inode numbers so we can repeat
>>> the same test after rename and mount cycle.
>>>
>>> Suggested-by: Eryu Guan <eguan@redhat.com>
>>> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>>> ---
>>> tests/overlay/017 | 57 ++++++++++++++++++++++++++++++++++++++++---------------
>>> 1 file changed, 42 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/tests/overlay/017 b/tests/overlay/017
>>> index 779907d..3ff429f 100755
>>> --- a/tests/overlay/017
>>> +++ b/tests/overlay/017
>>> @@ -72,32 +72,59 @@ mknod $lowerdir/blkdev b 1 1
>>> mknod $lowerdir/fifo p
>>> $here/src/af_unix $lowerdir/socket
>>>
>>> +FILES="dir file symlink chrdev blkdev fifo socket"
>>> +
>>> +# Record inode numbers in format <ino> <basename>
>>> +function record_inode_numbers()
>>> +{
>>> + dir=$1
>>> + outfile=$2
>>> +
>>> + for f in $FILES; do
>>> + ls -id $dir/$f
>>> + done | \
>>> + while read ino file; do
>>> + echo $ino `basename $file` >> $outfile
>>> + done
>>> +}
>>> +
>>> +# Check inode numbers match recorder inode numbers
>>> +function check_inode_numbers()
>>> +{
>>> + dir=$1
>>> + before=$2
>>> + after=$2
>> ^^^ $3
>> Otherwise looks good to me. I can fix this typo at commit time.
>
> Oh boy! That's a lousy test :-)
> Now I wonder why the test failed when I ran it on kernel v4.10
> (when feeding after to find -inum)... something for me to check.
>

Ah. got it. 'after' inode number where appended to $tmp.before,
so find was also looking by the before inodes.