* [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF
@ 2019-05-30 9:09 Caspar Zhang
2019-05-30 9:09 ` [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted Caspar Zhang
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Caspar Zhang @ 2019-05-30 9:09 UTC (permalink / raw)
To: ltp
Consider this situation: we get only TPASS and TCONF in test
results, and the last status happens to be TPASS, the check
condition in commit fecdd885eb4b ("tst_test: Fix exit value on
tst_brk(TCONF, ...)" won't work. Fix it by removing unnecessary
TCONF check.
Fixes: 5390d6ea3657 ("lib/tst_test: Report 0 if test has both TPASS and TCONF")
Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
---
lib/tst_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 2d88adbd7..8ba122fbe 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -594,7 +594,7 @@ static void do_exit(int ret)
printf("skipped %d\n", results->skipped);
printf("warnings %d\n", results->warnings);
- if (results->passed && ret == TCONF)
+ if (results->passed)
ret = 0;
if (results->failed)
--
2.21.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted
2019-05-30 9:09 [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Caspar Zhang
@ 2019-05-30 9:09 ` Caspar Zhang
2019-05-31 3:17 ` Li Wang
2019-06-28 12:52 ` Caspar Zhang
2019-05-30 9:09 ` [LTP] [PATCH 3/3] tst_test.sh, test.sh: report pass if both TPASS and TCONF exist in shell test Caspar Zhang
2019-05-30 15:18 ` [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Cyril Hrubis
2 siblings, 2 replies; 11+ messages in thread
From: Caspar Zhang @ 2019-05-30 9:09 UTC (permalink / raw)
To: ltp
TCONF should also be one of exit statuses in a single test, else the
output of TST_COUNT in shell tests could be wrong.
Wrong:
<<<test_output>>>
memcg_use_hierarchy_test 1 TINFO: Starting test 1
memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
memcg_use_hierarchy_test 1 TPASS: process 28658 is killed
memcg_use_hierarchy_test 2 TINFO: Starting test 2
memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1, blame systemd, skip
memcg_use_hierarchy_test 2 TINFO: Starting test 3
memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
memcg_use_hierarchy_test 2 TPASS: echo 0 > subgroup/memory.use_hierarchy failed as expected
<<<execution_status>>>
Right:
<<<test_output>>>
memcg_use_hierarchy_test 1 TINFO: Starting test 1
memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
memcg_use_hierarchy_test 1 TPASS: process 26825 is killed
memcg_use_hierarchy_test 2 TINFO: Starting test 2
memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1, blame systemd, skip
memcg_use_hierarchy_test 3 TINFO: Starting test 3
memcg_use_hierarchy_test 3 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
memcg_use_hierarchy_test 3 TPASS: echo 0 > subgroup/memory.use_hierarchy failed as expected
<<<execution_status>>>
Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
---
testcases/lib/test.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 670248ee5..ade8fcdff 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -58,8 +58,7 @@ tst_resm()
echo " $@"
case "$ret" in
- TPASS|TFAIL)
- TST_COUNT=$((TST_COUNT+1));;
+ TPASS|TFAIL|TCONF) TST_COUNT=$((TST_COUNT+1));;
esac
}
--
2.21.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted
2019-05-30 9:09 ` [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted Caspar Zhang
@ 2019-05-31 3:17 ` Li Wang
2019-06-09 15:40 ` Caspar Zhang
2019-06-28 12:52 ` Caspar Zhang
1 sibling, 1 reply; 11+ messages in thread
From: Li Wang @ 2019-05-31 3:17 UTC (permalink / raw)
To: ltp
On Thu, May 30, 2019 at 5:10 PM Caspar Zhang <caspar@linux.alibaba.com>
wrote:
> TCONF should also be one of exit statuses in a single test, else the
> output of TST_COUNT in shell tests could be wrong.
>
> Wrong:
> <<<test_output>>>
> memcg_use_hierarchy_test 1 TINFO: Starting test 1
> memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 1 TPASS: process 28658 is killed
> memcg_use_hierarchy_test 2 TINFO: Starting test 2
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1,
> blame systemd, skip
> memcg_use_hierarchy_test 2 TINFO: Starting test 3
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 2 TPASS: echo 0 > subgroup/memory.use_hierarchy
> failed as expected
> <<<execution_status>>>
>
> Right:
> <<<test_output>>>
> memcg_use_hierarchy_test 1 TINFO: Starting test 1
> memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 1 TPASS: process 26825 is killed
> memcg_use_hierarchy_test 2 TINFO: Starting test 2
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1,
> blame systemd, skip
> memcg_use_hierarchy_test 3 TINFO: Starting test 3
> memcg_use_hierarchy_test 3 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 3 TPASS: echo 0 > subgroup/memory.use_hierarchy
> failed as expected
> <<<execution_status>>>
>
This is a good catch, but maybe it's not wise to simply regard the TCONF as
a single test, because there are many system-config detections in setup()
function, that will make LTP gives a mendacious report on the test numbers
if applying this patch.
e.g.
if tst_kvcmp -lt "3.10"; then
tst_brk TCONF "test must be run with kernel 3.10 or newer"
fi
if dir path not exist; then
tst_brk TCONF "system does not have xxxx/"
fi
and so on...
>
> Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
> ---
> testcases/lib/test.sh | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index 670248ee5..ade8fcdff 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -58,8 +58,7 @@ tst_resm()
> echo " $@"
>
> case "$ret" in
> - TPASS|TFAIL)
> - TST_COUNT=$((TST_COUNT+1));;
> + TPASS|TFAIL|TCONF) TST_COUNT=$((TST_COUNT+1));;
> esac
> }
>
> --
> 2.21.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190531/10b12894/attachment.html>
^ permalink raw reply [flat|nested] 11+ messages in thread* [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted
2019-05-31 3:17 ` Li Wang
@ 2019-06-09 15:40 ` Caspar Zhang
2019-06-10 8:01 ` Li Wang
0 siblings, 1 reply; 11+ messages in thread
From: Caspar Zhang @ 2019-06-09 15:40 UTC (permalink / raw)
To: ltp
On Fri, May 31, 2019 at 11:17:14AM +0800, Li Wang wrote:
>
>
> On Thu, May 30, 2019 at 5:10 PM Caspar Zhang <[1]caspar@linux.alibaba.com>
> wrote:
>
> TCONF should also be one of exit statuses in a single test, else the
> output of TST_COUNT in shell tests could be wrong.
>
> Wrong:
> <<<test_output>>>
> memcg_use_hierarchy_test 1 TINFO: Starting test 1
> memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 1 TPASS: process 28658 is killed
> memcg_use_hierarchy_test 2 TINFO: Starting test 2
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1,
> blame systemd, skip
> memcg_use_hierarchy_test 2 TINFO: Starting test 3
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 2 TPASS: echo 0 > subgroup/memory.use_hierarchy
> failed as expected
> <<<execution_status>>>
>
> Right:
> <<<test_output>>>
> memcg_use_hierarchy_test 1 TINFO: Starting test 1
> memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 1 TPASS: process 26825 is killed
> memcg_use_hierarchy_test 2 TINFO: Starting test 2
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1,
> blame systemd, skip
> memcg_use_hierarchy_test 3 TINFO: Starting test 3
> memcg_use_hierarchy_test 3 TINFO: set /dev/memcg/memory.use_hierarchy to 0
> failed
> memcg_use_hierarchy_test 3 TPASS: echo 0 > subgroup/memory.use_hierarchy
> failed as expected
> <<<execution_status>>>
>
>
> This is a good catch, but maybe it's not wise to simply regard the TCONF as a
> single test, because there are many system-config detections in setup()
> function, that will make LTP gives a mendacious report on the test numbers if
> applying this patch.
>
> e.g.
>
> if tst_kvcmp -lt "3.10"; then
> tst_brk TCONF "test must be run with kernel 3.10 or newer"
> fi
> if dir path not exist; then
> tst_brk TCONF "system does not have xxxx/"
> fi
> and so on...
TCONF usually report only once, I would still take it a valid report on
numbers. Take your case as example, I guess we are able to see results
like:
mytest 1 TPASS: pass
or
mytest 1 TCONF: test must be run with kernel 3.10 or newer
or
mytest 1 TCONF: system does not have xxx/
Thanks,
Caspar
>
>
>
>
> Signed-off-by: Caspar Zhang <[2]caspar@linux.alibaba.com>
> ---
> testcases/lib/test.sh | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index 670248ee5..ade8fcdff 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -58,8 +58,7 @@ tst_resm()
> echo " $@"
>
> case "$ret" in
> - TPASS|TFAIL)
> - TST_COUNT=$((TST_COUNT+1));;
> + TPASS|TFAIL|TCONF) TST_COUNT=$((TST_COUNT+1));;
> esac
> }
>
> --
> 2.21.0
>
>
> --
> Mailing list info: [3]https://lists.linux.it/listinfo/ltp
>
>
>
> --
> Regards,
> Li Wang
>
> References:
>
> [1] mailto:caspar@linux.alibaba.com
> [2] mailto:caspar@linux.alibaba.com
> [3] https://lists.linux.it/listinfo/ltp
--
Thanks,
Caspar
^ permalink raw reply [flat|nested] 11+ messages in thread* [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted
2019-06-09 15:40 ` Caspar Zhang
@ 2019-06-10 8:01 ` Li Wang
0 siblings, 0 replies; 11+ messages in thread
From: Li Wang @ 2019-06-10 8:01 UTC (permalink / raw)
To: ltp
On Sun, Jun 9, 2019 at 11:41 PM Caspar Zhang <caspar@linux.alibaba.com>
wrote:
> On Fri, May 31, 2019 at 11:17:14AM +0800, Li Wang wrote:
> >
> >
> > On Thu, May 30, 2019 at 5:10 PM Caspar Zhang <[1]
> caspar@linux.alibaba.com>
> > wrote:
> >
> > TCONF should also be one of exit statuses in a single test, else the
> > output of TST_COUNT in shell tests could be wrong.
> >
> > Wrong:
> > <<<test_output>>>
> > memcg_use_hierarchy_test 1 TINFO: Starting test 1
> > memcg_use_hierarchy_test 1 TINFO: set
> /dev/memcg/memory.use_hierarchy to 0
> > failed
> > memcg_use_hierarchy_test 1 TPASS: process 28658 is killed
> > memcg_use_hierarchy_test 2 TINFO: Starting test 2
> > memcg_use_hierarchy_test 2 TINFO: set
> /dev/memcg/memory.use_hierarchy to 0
> > failed
> > memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been
> 1,
> > blame systemd, skip
> > memcg_use_hierarchy_test 2 TINFO: Starting test 3
> > memcg_use_hierarchy_test 2 TINFO: set
> /dev/memcg/memory.use_hierarchy to 0
> > failed
> > memcg_use_hierarchy_test 2 TPASS: echo 0 >
> subgroup/memory.use_hierarchy
> > failed as expected
> > <<<execution_status>>>
> >
> > Right:
> > <<<test_output>>>
> > memcg_use_hierarchy_test 1 TINFO: Starting test 1
> > memcg_use_hierarchy_test 1 TINFO: set
> /dev/memcg/memory.use_hierarchy to 0
> > failed
> > memcg_use_hierarchy_test 1 TPASS: process 26825 is killed
> > memcg_use_hierarchy_test 2 TINFO: Starting test 2
> > memcg_use_hierarchy_test 2 TINFO: set
> /dev/memcg/memory.use_hierarchy to 0
> > failed
> > memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been
> 1,
> > blame systemd, skip
> > memcg_use_hierarchy_test 3 TINFO: Starting test 3
> > memcg_use_hierarchy_test 3 TINFO: set
> /dev/memcg/memory.use_hierarchy to 0
> > failed
> > memcg_use_hierarchy_test 3 TPASS: echo 0 >
> subgroup/memory.use_hierarchy
> > failed as expected
> > <<<execution_status>>>
> >
> >
> > This is a good catch, but maybe it's not wise to simply regard the TCONF
> as a
> > single test, because there are many system-config detections in setup()
> > function, that will make LTP gives a mendacious report on the test
> numbers if
> > applying this patch.
> >
> > e.g.
> >
> > if tst_kvcmp -lt "3.10"; then
> > tst_brk TCONF "test must be run with kernel 3.10 or newer"
> > fi
> > if dir path not exist; then
> > tst_brk TCONF "system does not have xxxx/"
> > fi
> > and so on...
>
> TCONF usually report only once, I would still take it a valid report on
> numbers. Take your case as example, I guess we are able to see results
> like:
>
Okay, that sounds reasonable too.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190610/e109fe9c/attachment.html>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted
2019-05-30 9:09 ` [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted Caspar Zhang
2019-05-31 3:17 ` Li Wang
@ 2019-06-28 12:52 ` Caspar Zhang
2019-07-04 14:01 ` Cyril Hrubis
1 sibling, 1 reply; 11+ messages in thread
From: Caspar Zhang @ 2019-06-28 12:52 UTC (permalink / raw)
To: ltp
Hi Cyril, is it ok to push 2/3 and 3/3 as they've got Li Wang's
Reviewed-by, or do you have different opinion?
Thanks,
Caspar
On Thu, May 30, 2019 at 05:09:57PM +0800, Caspar Zhang wrote:
> TCONF should also be one of exit statuses in a single test, else the
> output of TST_COUNT in shell tests could be wrong.
>
> Wrong:
> <<<test_output>>>
> memcg_use_hierarchy_test 1 TINFO: Starting test 1
> memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
> memcg_use_hierarchy_test 1 TPASS: process 28658 is killed
> memcg_use_hierarchy_test 2 TINFO: Starting test 2
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
> memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1, blame systemd, skip
> memcg_use_hierarchy_test 2 TINFO: Starting test 3
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
> memcg_use_hierarchy_test 2 TPASS: echo 0 > subgroup/memory.use_hierarchy failed as expected
> <<<execution_status>>>
>
> Right:
> <<<test_output>>>
> memcg_use_hierarchy_test 1 TINFO: Starting test 1
> memcg_use_hierarchy_test 1 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
> memcg_use_hierarchy_test 1 TPASS: process 26825 is killed
> memcg_use_hierarchy_test 2 TINFO: Starting test 2
> memcg_use_hierarchy_test 2 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
> memcg_use_hierarchy_test 2 TCONF: memory.use_hierarchy already been 1, blame systemd, skip
> memcg_use_hierarchy_test 3 TINFO: Starting test 3
> memcg_use_hierarchy_test 3 TINFO: set /dev/memcg/memory.use_hierarchy to 0 failed
> memcg_use_hierarchy_test 3 TPASS: echo 0 > subgroup/memory.use_hierarchy failed as expected
> <<<execution_status>>>
>
> Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
> ---
> testcases/lib/test.sh | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index 670248ee5..ade8fcdff 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -58,8 +58,7 @@ tst_resm()
> echo " $@"
>
> case "$ret" in
> - TPASS|TFAIL)
> - TST_COUNT=$((TST_COUNT+1));;
> + TPASS|TFAIL|TCONF) TST_COUNT=$((TST_COUNT+1));;
> esac
> }
>
> --
> 2.21.0
>
--
Thanks,
Caspar
^ permalink raw reply [flat|nested] 11+ messages in thread* [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted
2019-06-28 12:52 ` Caspar Zhang
@ 2019-07-04 14:01 ` Cyril Hrubis
0 siblings, 0 replies; 11+ messages in thread
From: Cyril Hrubis @ 2019-07-04 14:01 UTC (permalink / raw)
To: ltp
Hi!
Pushed thanks.
> Hi Cyril, is it ok to push 2/3 and 3/3 as they've got Li Wang's
> Reviewed-by, or do you have different opinion?
I've checked and these two changes actually unify behavior of the shell
libraries with the C libraries. We did miss the changes to the shell
libraries when we modified the C libraries, so this changes make perfect
sense.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 11+ messages in thread
* [LTP] [PATCH 3/3] tst_test.sh, test.sh: report pass if both TPASS and TCONF exist in shell test
2019-05-30 9:09 [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Caspar Zhang
2019-05-30 9:09 ` [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted Caspar Zhang
@ 2019-05-30 9:09 ` Caspar Zhang
2019-05-31 3:37 ` Li Wang
2019-05-30 15:18 ` [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Cyril Hrubis
2 siblings, 1 reply; 11+ messages in thread
From: Caspar Zhang @ 2019-05-30 9:09 UTC (permalink / raw)
To: ltp
We don't want the test reporting TCONF if at least one TPASS existed
during testing. And this is also true in shell tests. So fix it.
Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
---
testcases/lib/test.sh | 9 +++++++++
testcases/lib/tst_test.sh | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index ade8fcdff..7cc3bb2fe 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -23,6 +23,7 @@
export LTP_RET_VAL=0
export TST_COUNT=1
+export TST_PASS_COUNT=0
export TST_LIB_LOADED=1
export TST_TMPDIR_RHOST=0
@@ -60,6 +61,10 @@ tst_resm()
case "$ret" in
TPASS|TFAIL|TCONF) TST_COUNT=$((TST_COUNT+1));;
esac
+
+ if [ "$ret" = TPASS ]; then
+ TST_PASS_COUNT=$((TST_PASS_COUNT+1))
+ fi
}
tst_brkm()
@@ -111,6 +116,10 @@ tst_exit()
rm -f "$LTP_IPC_PATH"
fi
+ # Mask out TCONF if no TFAIL/TBROK/TWARN but has TPASS
+ if [ $((LTP_RET_VAL & 7)) -eq 0 -a $TST_PASS_COUNT -gt 0 ]; then
+ LTP_RET_VAL=$((LTP_RET_VAL & ~32))
+ fi
# Mask out TINFO
exit $((LTP_RET_VAL & ~16))
}
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 512732315..bf725fdde 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -78,7 +78,7 @@ _tst_do_exit()
ret=$((ret|4))
fi
- if [ $TST_CONF -gt 0 ]; then
+ if [ $TST_CONF -gt 0 -a $TST_PASS -eq 0 ]; then
ret=$((ret|32))
fi
--
2.21.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [LTP] [PATCH 3/3] tst_test.sh, test.sh: report pass if both TPASS and TCONF exist in shell test
2019-05-30 9:09 ` [LTP] [PATCH 3/3] tst_test.sh, test.sh: report pass if both TPASS and TCONF exist in shell test Caspar Zhang
@ 2019-05-31 3:37 ` Li Wang
0 siblings, 0 replies; 11+ messages in thread
From: Li Wang @ 2019-05-31 3:37 UTC (permalink / raw)
To: ltp
On Thu, May 30, 2019 at 5:11 PM Caspar Zhang <caspar@linux.alibaba.com>
wrote:
> We don't want the test reporting TCONF if at least one TPASS existed
> during testing. And this is also true in shell tests. So fix it.
>
PATCH 3/3 makes sense to me.
Reviewed-by: Li Wang <liwang@redhat.com>
>
> Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
> ---
> testcases/lib/test.sh | 9 +++++++++
> testcases/lib/tst_test.sh | 2 +-
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index ade8fcdff..7cc3bb2fe 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -23,6 +23,7 @@
>
> export LTP_RET_VAL=0
> export TST_COUNT=1
> +export TST_PASS_COUNT=0
> export TST_LIB_LOADED=1
> export TST_TMPDIR_RHOST=0
>
> @@ -60,6 +61,10 @@ tst_resm()
> case "$ret" in
> TPASS|TFAIL|TCONF) TST_COUNT=$((TST_COUNT+1));;
> esac
> +
> + if [ "$ret" = TPASS ]; then
> + TST_PASS_COUNT=$((TST_PASS_COUNT+1))
> + fi
> }
>
> tst_brkm()
> @@ -111,6 +116,10 @@ tst_exit()
> rm -f "$LTP_IPC_PATH"
> fi
>
> + # Mask out TCONF if no TFAIL/TBROK/TWARN but has TPASS
> + if [ $((LTP_RET_VAL & 7)) -eq 0 -a $TST_PASS_COUNT -gt 0 ]; then
> + LTP_RET_VAL=$((LTP_RET_VAL & ~32))
> + fi
> # Mask out TINFO
> exit $((LTP_RET_VAL & ~16))
> }
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 512732315..bf725fdde 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -78,7 +78,7 @@ _tst_do_exit()
> ret=$((ret|4))
> fi
>
> - if [ $TST_CONF -gt 0 ]; then
> + if [ $TST_CONF -gt 0 -a $TST_PASS -eq 0 ]; then
> ret=$((ret|32))
> fi
>
> --
> 2.21.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190531/9ea6f2e3/attachment-0001.html>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF
2019-05-30 9:09 [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Caspar Zhang
2019-05-30 9:09 ` [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted Caspar Zhang
2019-05-30 9:09 ` [LTP] [PATCH 3/3] tst_test.sh, test.sh: report pass if both TPASS and TCONF exist in shell test Caspar Zhang
@ 2019-05-30 15:18 ` Cyril Hrubis
2019-05-30 16:40 ` Caspar Zhang
2 siblings, 1 reply; 11+ messages in thread
From: Cyril Hrubis @ 2019-05-30 15:18 UTC (permalink / raw)
To: ltp
Hi!
> Consider this situation: we get only TPASS and TCONF in test
> results, and the last status happens to be TPASS, the check
> condition in commit fecdd885eb4b ("tst_test: Fix exit value on
> tst_brk(TCONF, ...)" won't work. Fix it by removing unnecessary
> TCONF check.
What is the exact sequence of the tst_res()/tst_brk() calls leading to
this?
Because if the test function has exitted with 0 the do_exit() function
would be passed 0 and that case is handled already:
if (results->skipped && !results->passed)
ret |= TCONF;
> Fixes: 5390d6ea3657 ("lib/tst_test: Report 0 if test has both TPASS and TCONF")
> Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
> ---
> lib/tst_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 2d88adbd7..8ba122fbe 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -594,7 +594,7 @@ static void do_exit(int ret)
> printf("skipped %d\n", results->skipped);
> printf("warnings %d\n", results->warnings);
>
> - if (results->passed && ret == TCONF)
> + if (results->passed)
> ret = 0;
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 11+ messages in thread* [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF
2019-05-30 15:18 ` [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Cyril Hrubis
@ 2019-05-30 16:40 ` Caspar Zhang
0 siblings, 0 replies; 11+ messages in thread
From: Caspar Zhang @ 2019-05-30 16:40 UTC (permalink / raw)
To: ltp
On Thu, May 30, 2019 at 05:18:43PM +0200, Cyril Hrubis wrote:
> Hi!
> > Consider this situation: we get only TPASS and TCONF in test
> > results, and the last status happens to be TPASS, the check
> > condition in commit fecdd885eb4b ("tst_test: Fix exit value on
> > tst_brk(TCONF, ...)" won't work. Fix it by removing unnecessary
> > TCONF check.
>
> What is the exact sequence of the tst_res()/tst_brk() calls leading to
> this?
>
> Because if the test function has exitted with 0 the do_exit() function
> would be passed 0 and that case is handled already:
>
> if (results->skipped && !results->passed)
> ret |= TCONF;
Hmm... you are right, the original fix was absolutely correct. Please
feel free to ignore this patch. Sorry for the noise ;-)
Thanks,
Caspar
>
> > Fixes: 5390d6ea3657 ("lib/tst_test: Report 0 if test has both TPASS and TCONF")
> > Signed-off-by: Caspar Zhang <caspar@linux.alibaba.com>
> > ---
> > lib/tst_test.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/tst_test.c b/lib/tst_test.c
> > index 2d88adbd7..8ba122fbe 100644
> > --- a/lib/tst_test.c
> > +++ b/lib/tst_test.c
> > @@ -594,7 +594,7 @@ static void do_exit(int ret)
> > printf("skipped %d\n", results->skipped);
> > printf("warnings %d\n", results->warnings);
> >
> > - if (results->passed && ret == TCONF)
> > + if (results->passed)
> > ret = 0;
>
> --
> Cyril Hrubis
> chrubis@suse.cz
--
Thanks,
Caspar
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-07-04 14:01 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-30 9:09 [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Caspar Zhang
2019-05-30 9:09 ` [LTP] [PATCH 2/3] lib/test.sh: TCONF needs to be counted Caspar Zhang
2019-05-31 3:17 ` Li Wang
2019-06-09 15:40 ` Caspar Zhang
2019-06-10 8:01 ` Li Wang
2019-06-28 12:52 ` Caspar Zhang
2019-07-04 14:01 ` Cyril Hrubis
2019-05-30 9:09 ` [LTP] [PATCH 3/3] tst_test.sh, test.sh: report pass if both TPASS and TCONF exist in shell test Caspar Zhang
2019-05-31 3:37 ` Li Wang
2019-05-30 15:18 ` [LTP] [PATCH 1/3] tst_test: fix again when test has both TPASS and TCONF Cyril Hrubis
2019-05-30 16:40 ` Caspar Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox