All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP]  [PATCH] syscalls/utimensat01: "chattr" command error
@ 2015-03-31  3:16 cuibixuan
  2015-04-01 14:33 ` Cyril Hrubis
  0 siblings, 1 reply; 8+ messages in thread
From: cuibixuan @ 2015-03-31  3:16 UTC (permalink / raw)
  To: ltp-list

Run testcase "utimensat01":

Pathname test
chattr: Inappropriate ioctl for device while reading flags on /tmp/ltp-FAAVCPyWnz/utimensat_tests/utimensat.test_file
./utimensat01 -q /tmp/ltp-FAAVCPyWnz/utimensat_tests/utimensat.test_file 0 n 0 o
EXPECTED: EPERM
RESULT:   SUCCESS 1421205831 0
FAILED test 46

Readable file descriptor (futimens(3)) test
chattr: Inappropriate ioctl for device while reading flags on /tmp/ltp-FAAVCPyWnz/utimensat_tests/utimensat.test_file
./utimensat01 -q -d /tmp/ltp-FAAVCPyWnz/utimensat_tests/utimensat.test_file NULL 0 n 0 o
EXPECTED: EPERM
RESULT:   SUCCESS 1421205834 0
FAILED test 47
...
Failed tests:  46 47 48 49 50 51 52 53 54 55 56 57 58 61 62 63 64 65 66 67 68 69 70 73 74 75 76 77 78 

The "chattr" command in case failed in some file system (such as memory fs):
chattr: Inappropriate ioctl for device while reading flags on 
I learn that chattr command only can be used in ext2 or ext3 (ext4 is ok now).

So we check it before running and test log on no-ext2 file system:

incrementing stop
test sudo for -n option, non-interactive
sudo supports -n
chattr: Inappropriate ioctl for device while reading flags on /tmp/ltp-IiAnqhwQST/utimensat_tests/tmp_file
utimensat01    1  TBROK  :  ltpapicmd.c:190: the chattr command is not supported in test dir

Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
---
 .../testcases/kernel/syscalls/utimensat/utimensat_tests.sh       | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh b/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
index b8eba51..972c81f 100755
--- a/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
+++ b/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
@@ -300,6 +300,15 @@ nuke_sudoers()
 }
 
 sudo $s_arg -u $test_user mkdir -p $TEST_DIR
+
+# Make sure chattr command is supported in test dir
+touch $TEST_DIR/tmp_file
+chattr +a $TEST_DIR/tmp_file
+if [ $? -ne 0 ] ; then
+        tst_resm TBROK "the chattr command is not supported in test dir"
+        exit 1
+fi
+
 cd $TEST_DIR
 chown root $LTPROOT/testcases/bin/$TEST_PROG
 chmod ugo+x,u+s $LTPROOT/testcases/bin/$TEST_PROG
-- 
1.8.2.2


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] syscalls/utimensat01: "chattr" command error
  2015-03-31  3:16 [LTP] [PATCH] syscalls/utimensat01: "chattr" command error cuibixuan
@ 2015-04-01 14:33 ` Cyril Hrubis
       [not found]   ` <551CB5CD.5030903@huawei.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2015-04-01 14:33 UTC (permalink / raw)
  To: cuibixuan; +Cc: ltp-list

Hi!
> Signed-off-by: Cui Bixuan <cuibixuan@huawei.com>
> ---
>  .../testcases/kernel/syscalls/utimensat/utimensat_tests.sh       | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh b/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
> index b8eba51..972c81f 100755
> --- a/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
> +++ b/ltp-master/testcases/kernel/syscalls/utimensat/utimensat_tests.sh
> @@ -300,6 +300,15 @@ nuke_sudoers()
>  }
>  
>  sudo $s_arg -u $test_user mkdir -p $TEST_DIR
> +
> +# Make sure chattr command is supported in test dir
> +touch $TEST_DIR/tmp_file
> +chattr +a $TEST_DIR/tmp_file
> +if [ $? -ne 0 ] ; then
> +        tst_resm TBROK "the chattr command is not supported in test dir"
> +        exit 1

This should rather be:
	tst_resm TCONF "..."
	exit 32

Or even better the test should be fixed to use the test.sh library then
this could be changed to:

tst_brkm TCONF "..."

> +fi
> +
>  cd $TEST_DIR
>  chown root $LTPROOT/testcases/bin/$TEST_PROG
>  chmod ugo+x,u+s $LTPROOT/testcases/bin/$TEST_PROG
> -- 
> 1.8.2.2
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v2] syscalls/utimensat01: "chattr" command error
       [not found]   ` <551CB5CD.5030903@huawei.com>
@ 2015-04-02  8:33     ` Cyril Hrubis
       [not found]       ` <552D1041.9010103@huawei.com>
       [not found]       ` <552D112E.4040104@huawei.com>
  0 siblings, 2 replies; 8+ messages in thread
From: Cyril Hrubis @ 2015-04-02  8:33 UTC (permalink / raw)
  To: cuibixuan; +Cc: ltp-list

Hi!
> @@ -24,6 +24,7 @@
>  export TCID=utimensat01
>  export TST_TOTAL=99
>  export TST_COUNT=0
> +. test.sh

If you start using test.sh in the testcase, you have to fix the rest of
the tst_resm() followed by exit as well (just change these to tst_brkm
and remove the exit). And also change the exit -1 at the end of the test
to tst_resm TFAIL and call tst_exit at the very end of the test.

Have a look at:

https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#23-writing-a-testcase-in-shell

And these fixes should ideally be done in a separate patch.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v4 1/2] syscalls/utimensat01: Use test.sh library for test case
       [not found]       ` <552D1041.9010103@huawei.com>
@ 2015-04-22 14:04         ` Cyril Hrubis
       [not found]           ` <55399C3A.70800@huawei.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2015-04-22 14:04 UTC (permalink / raw)
  To: Cui Bixuan; +Cc: zhuyanpeng, ltp-list, zhanyongming

>  echo "Total tests: $test_num; passed: $passed_cnt; failed: $failed_cnt"
>  if test $failed_cnt -gt 0; then
>      echo "Failed tests: $failed_list"
> -    exit -1
> +    tst_resm TFAIL "test failed"
>  fi
> 
> -exit
> +tst_resm TPASS "test pass"

The tst_resm TPASS should be in the else part of the if above, otherwise
the test will print both failure and success in case that failed_cnt is
greater than zero.

And changing the check_result() to call tst_resm TFAIL/TPASS directly
would be even better. In that case this part will call only tst_exit as
the pass/fail status will be saved by the test library.

> +tst_exit
> -- 1.6.0.2

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v4 2/2] syscalls/utimensat01: "chattr" command error
       [not found]       ` <552D112E.4040104@huawei.com>
@ 2015-04-22 14:06         ` Cyril Hrubis
       [not found]           ` <55399C8E.40608@huawei.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2015-04-22 14:06 UTC (permalink / raw)
  To: Cui Bixuan; +Cc: zhuyanpeng, ltp-list, zhanyongming

Hi!
> The "chattr" command in case failed in some file system (such as memory fs):
> 'chattr: Inappropriate ioctl for device while reading flags on'
> 
> I learn that chattr command only can be used in ext2 or ext3 (ext4 is ok now).
> So we check it before running.

Do all of the testcases fail or only some of them?

If the latter is case it would be better to set some variable and skip
only the testcases that will fail otherwise
(i.e. tst_resm TCONF "chattr not supported").

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v5 2/2] syscalls/utimensat01: "chattr" command error
       [not found]           ` <55399C8E.40608@huawei.com>
@ 2015-04-28 12:39             ` Cyril Hrubis
       [not found]               ` <55402B94.9010407@huawei.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2015-04-28 12:39 UTC (permalink / raw)
  To: Cui Bixuan; +Cc: zhuyanpeng, ltp-list, zhanyongming

Hi!
> +# Make sure chattr command is supported
> +touch $TEST_DIR/tmp_file
> +chattr +a $TEST_DIR/tmp_file
> +if [ $? -ne 0 ] ; then

You should remove the TEST_DIR here, otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v5 1/2] syscalls/utimensat01: Use test.sh library for test case
       [not found]           ` <55399C3A.70800@huawei.com>
@ 2015-04-28 12:39             ` Cyril Hrubis
  0 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2015-04-28 12:39 UTC (permalink / raw)
  To: Cui Bixuan; +Cc: zhuyanpeng, ltp-list, zhanyongming

Hi!
> Using test.sh in the case:
> * Change the tst_resm() followed by exit to tst_brkm and remove the exit
> * Changing the check_result() to call tst_resm TPASS and the test_failed() which is
>   called by check_result() to call tst_resm TFAIL
> * Delete the exit -1 at the end of the test and change exit to tst_exit at the
>   very end of the test

Pushed, thanks.

BTW: The test still can be cleaned up to use tst_tmpdir/tst_rmdir
     instead of creating it manually, it should stop working with
     global path to subtest binaries (the path to these is in $PATH),
     etc.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v6 2/2] syscalls/utimensat01: "chattr" command error
       [not found]               ` <55402B94.9010407@huawei.com>
@ 2015-05-04 11:35                 ` Cyril Hrubis
  0 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2015-05-04 11:35 UTC (permalink / raw)
  To: Cui Bixuan; +Cc: zhuyanpeng, ltp-list, zhanyongming

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2015-05-04 11:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31  3:16 [LTP] [PATCH] syscalls/utimensat01: "chattr" command error cuibixuan
2015-04-01 14:33 ` Cyril Hrubis
     [not found]   ` <551CB5CD.5030903@huawei.com>
2015-04-02  8:33     ` [LTP] [PATCH v2] " Cyril Hrubis
     [not found]       ` <552D1041.9010103@huawei.com>
2015-04-22 14:04         ` [LTP] [PATCH v4 1/2] syscalls/utimensat01: Use test.sh library for test case Cyril Hrubis
     [not found]           ` <55399C3A.70800@huawei.com>
2015-04-28 12:39             ` [LTP] [PATCH v5 " Cyril Hrubis
     [not found]       ` <552D112E.4040104@huawei.com>
2015-04-22 14:06         ` [LTP] [PATCH v4 2/2] syscalls/utimensat01: "chattr" command error Cyril Hrubis
     [not found]           ` <55399C8E.40608@huawei.com>
2015-04-28 12:39             ` [LTP] [PATCH v5 " Cyril Hrubis
     [not found]               ` <55402B94.9010407@huawei.com>
2015-05-04 11:35                 ` [LTP] [PATCH v6 " Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.