FSTests Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH xfstests] generic/192: Move 'cd /' to the place where the program exits
@ 2019-10-09  8:27 Zhihao Cheng
  2019-10-13 12:46 ` Eryu Guan
  0 siblings, 1 reply; 3+ messages in thread
From: Zhihao Cheng @ 2019-10-09  8:27 UTC (permalink / raw)
  To: guaneryu, darrick.wong, ebiggers, yi.zhang
  Cc: fstests, linux-kernel, chengzhihao1

Running generic/192 with overlayfs(Let ubifs as base fs) yields the
following output:

  generic/192 - output mismatch
     QA output created by 192
     sleep for 5 seconds
     test
    +./common/rc: line 316: src/t_dir_type: No such file or directory
     delta1 is in range
     delta2 is in range
    ...

When the use case fails, the call stack in generic/192 is:

  local unknowns=$(src/t_dir_type $dir u | wc -l)	common/rc:316
  _supports_filetype					common/rc:299
  _overlay_mount					common/overlay:52
  _overlay_test_mount					common/overlay:93
  _test_mount						common/rc:407
  _test_cycle_mount					generic/192:50

Before _test_cycle_mount() being invoked, generic/192 executed 'cd /'
to change work dir from 'xfstests-dev' to '/', so src/t_dir_type was not
found.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
 tests/generic/192 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/generic/192 b/tests/generic/192
index 50b3d6fd..5550f39e 100755
--- a/tests/generic/192
+++ b/tests/generic/192
@@ -15,7 +15,12 @@ echo "QA output created by $seq"
 here=`pwd`
 tmp=/tmp/$$
 status=1	# failure is the default!
-trap "exit \$status" 0 1 2 3 15
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+}
 
 _access_time()
 {
@@ -46,7 +51,6 @@ sleep $delay # sleep to allow time to move on for access
 cat $testfile
 time2=`_access_time $testfile | tee -a $seqres.full`
 
-cd /
 _test_cycle_mount
 time3=`_access_time $testfile | tee -a $seqres.full`
 
-- 
2.13.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH xfstests] generic/192: Move 'cd /' to the place where the program exits
  2019-10-09  8:27 [PATCH xfstests] generic/192: Move 'cd /' to the place where the program exits Zhihao Cheng
@ 2019-10-13 12:46 ` Eryu Guan
  2019-10-14  2:26   ` Zhihao Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: Eryu Guan @ 2019-10-13 12:46 UTC (permalink / raw)
  To: Zhihao Cheng; +Cc: darrick.wong, ebiggers, yi.zhang, fstests, linux-kernel

On Wed, Oct 09, 2019 at 04:27:57PM +0800, Zhihao Cheng wrote:
> Running generic/192 with overlayfs(Let ubifs as base fs) yields the
> following output:
> 
>   generic/192 - output mismatch
>      QA output created by 192
>      sleep for 5 seconds
>      test
>     +./common/rc: line 316: src/t_dir_type: No such file or directory
>      delta1 is in range
>      delta2 is in range
>     ...
> 
> When the use case fails, the call stack in generic/192 is:
> 
>   local unknowns=$(src/t_dir_type $dir u | wc -l)	common/rc:316
>   _supports_filetype					common/rc:299
>   _overlay_mount					common/overlay:52
>   _overlay_test_mount					common/overlay:93
>   _test_mount						common/rc:407
>   _test_cycle_mount					generic/192:50
> 
> Before _test_cycle_mount() being invoked, generic/192 executed 'cd /'
> to change work dir from 'xfstests-dev' to '/', so src/t_dir_type was not
> found.
> 
> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>

Thanks for the debug! But I think the right fix is to call t_dir_type
via "$here", i.e.

	local unknowns=$($here/src/t_dir_type $dir u | wc -l)

'here', which points to the top level dir of xfstests source code, is
defined in every test in test setup, and is guaranteed not to be empty.

Thanks,
Eryu

> ---
>  tests/generic/192 | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/192 b/tests/generic/192
> index 50b3d6fd..5550f39e 100755
> --- a/tests/generic/192
> +++ b/tests/generic/192
> @@ -15,7 +15,12 @@ echo "QA output created by $seq"
>  here=`pwd`
>  tmp=/tmp/$$
>  status=1	# failure is the default!
> -trap "exit \$status" 0 1 2 3 15
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +}
>  
>  _access_time()
>  {
> @@ -46,7 +51,6 @@ sleep $delay # sleep to allow time to move on for access
>  cat $testfile
>  time2=`_access_time $testfile | tee -a $seqres.full`
>  
> -cd /
>  _test_cycle_mount
>  time3=`_access_time $testfile | tee -a $seqres.full`
>  
> -- 
> 2.13.6
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH xfstests] generic/192: Move 'cd /' to the place where the program exits
  2019-10-13 12:46 ` Eryu Guan
@ 2019-10-14  2:26   ` Zhihao Cheng
  0 siblings, 0 replies; 3+ messages in thread
From: Zhihao Cheng @ 2019-10-14  2:26 UTC (permalink / raw)
  To: Eryu Guan; +Cc: darrick.wong, ebiggers, yi.zhang, fstests, linux-kernel

I agree with your proposal. Indeed, '$here' is referenced in other places where executable files under src are used, including '$here/src/feature', '$here/src/seek_sanity_test', etc.
I have a question about why many test cases execute 'cd /' before the end. For example, generic/124, generic/122, generic/003. I wonder the intention of operation 'cd /'.

ÔÚ 2019/10/13 20:46, Eryu Guan дµÀ:
> On Wed, Oct 09, 2019 at 04:27:57PM +0800, Zhihao Cheng wrote:
>> Running generic/192 with overlayfs(Let ubifs as base fs) yields the
>> following output:
>>
>>   generic/192 - output mismatch
>>      QA output created by 192
>>      sleep for 5 seconds
>>      test
>>     +./common/rc: line 316: src/t_dir_type: No such file or directory
>>      delta1 is in range
>>      delta2 is in range
>>     ...
>>
>> When the use case fails, the call stack in generic/192 is:
>>
>>   local unknowns=$(src/t_dir_type $dir u | wc -l)	common/rc:316
>>   _supports_filetype					common/rc:299
>>   _overlay_mount					common/overlay:52
>>   _overlay_test_mount					common/overlay:93
>>   _test_mount						common/rc:407
>>   _test_cycle_mount					generic/192:50
>>
>> Before _test_cycle_mount() being invoked, generic/192 executed 'cd /'
>> to change work dir from 'xfstests-dev' to '/', so src/t_dir_type was not
>> found.
>>
>> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
> 
> Thanks for the debug! But I think the right fix is to call t_dir_type
> via "$here", i.e.
> 
> 	local unknowns=$($here/src/t_dir_type $dir u | wc -l)
> 
> 'here', which points to the top level dir of xfstests source code, is
> defined in every test in test setup, and is guaranteed not to be empty.
> 
> Thanks,
> Eryu
> 
>> ---
>>  tests/generic/192 | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/generic/192 b/tests/generic/192
>> index 50b3d6fd..5550f39e 100755
>> --- a/tests/generic/192
>> +++ b/tests/generic/192
>> @@ -15,7 +15,12 @@ echo "QA output created by $seq"
>>  here=`pwd`
>>  tmp=/tmp/$$
>>  status=1	# failure is the default!
>> -trap "exit \$status" 0 1 2 3 15
>> +trap "_cleanup; exit \$status" 0 1 2 3 15
>> +
>> +_cleanup()
>> +{
>> +	cd /
>> +}
>>  
>>  _access_time()
>>  {
>> @@ -46,7 +51,6 @@ sleep $delay # sleep to allow time to move on for access
>>  cat $testfile
>>  time2=`_access_time $testfile | tee -a $seqres.full`
>>  
>> -cd /
>>  _test_cycle_mount
>>  time3=`_access_time $testfile | tee -a $seqres.full`
>>  
>> -- 
>> 2.13.6
>>
> 
> .
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09  8:27 [PATCH xfstests] generic/192: Move 'cd /' to the place where the program exits Zhihao Cheng
2019-10-13 12:46 ` Eryu Guan
2019-10-14  2:26   ` Zhihao Cheng

FSTests Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/fstests/0 fstests/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 fstests fstests/ https://lore.kernel.org/fstests \
		fstests@vger.kernel.org linux-fstests@archiver.kernel.org
	public-inbox-index fstests

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.fstests


AGPL code for this site: git clone https://public-inbox.org/ public-inbox