public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Chunyu Hu <chuhu@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH RFC 6/9] ftrace_stress: skip unsupported tests
Date: Fri, 18 Mar 2016 09:08:34 -0400 (EDT)	[thread overview]
Message-ID: <2674277.29655623.1458306514829.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160317170701.GG31815@rei.lan>

Hi Cyril,

I will fix the issues you mentioned about the stress test in V2. As when i talked 
about the  ftrace test i knew Li Wang is doing something reorg the ftrace  test.
So i just append the stress related 4 fix to his. as we guess this will make it be
simpler to be reviewed by you, and make it easier to be considered for organizing 
the case.

I also your replied the issues below. Thanks!

----- Original Message -----
> From: "Cyril Hrubis" <chrubis@suse.cz>
> To: "Li Wang" <liwang@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Friday, March 18, 2016 1:07:01 AM
> Subject: Re: [LTP] [PATCH RFC 6/9] ftrace_stress: skip unsupported tests
> 
> Hi!
> >  	if [ -e stack_max_size ]; then
> >  		old_stack_tracer_enabled=`cat /proc/sys/kernel/stack_tracer_enabled`
> >  	fi
> > @@ -86,7 +89,10 @@ restore_old_setting()
> >  
> >  	echo $old_buffer_size > buffer_size_kb
> >  	echo $old_tracing_on > tracing_on
> > -	echo $old_tracing_enabled > tracing_enabled
> > +
> > +	if [ -e tracing_enabled ];then
>                                   ^
> 				  missing space here

Will modify it in V2. Thanks.


> > a/testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh
> > b/testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh
> > index d7efdd4..d1a6bd3 100755
> > ---
> > a/testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh
> > +++
> > b/testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh
> > @@ -36,6 +36,8 @@ for ((; ;))
> >  
> >  	for event in `cat $TRACING_PATH/available_events`;
> >  	do
> > +		# ftrace event sys is special, skip it
> > +		[[ $event =~ ftrace:* ]] && continue
> This is bashism.


I just had a experience with bash. thanks for catching this issue. Will update it 
with something like:
 
if echo $event | grep "ftrace:*"; then
        continue;
fi


> > diff --git a/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
> > b/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
> > index beced43..d1be49a 100755
> > --- a/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
> > +++ b/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
> > @@ -21,82 +21,77 @@

> > -	kill -USR1 $pid12 || test_success=false
> > -	kill -KILL $pid13 || test_success=false
> > -	kill -KILL $pid14 || test_success=false
> > -	kill -KILL $pid15 || test_success=false
> > -	kill -KILL $pid16 || test_success=false
> > +	kill -USR1 ${pid0} || test_success=false
> > +
> > +	for ((p=1; p<NR_PIDS; p++))
> > +	{
> > +		local kill_pid=pid${p}
> > +		kill -KILL ${!kill_pid} || test_success=false
> > +	}
> 
> Again this is bashism loop over $(seq NR_PIDS).

Thanks for catching this.

Refer the style of  test.sh. I will modify this to use a while loop

        p=1;
        while [ p -lt $NR_PIDS ]; do 
                local kill_pid=pid${p}
                kill -KILL ${!kill_pid} || test_success=false 
                tst_record_childstatus ${!p}    
                p=$((p + 1))

        done

> 
> >  	sleep 2
> 
> We should wait on the pids here instead of the sleep, which would
> guarantee tha the processes have really finished.

Hi, 
Thx. I will try to update it using tst_record_childstatus as the above 
while loop did.



> >  	clean_up
> >  }
> >  
> > +test_stress()
> > +{
> > +	NR_PIDS=0
> > +	echo "Test targets: ${test_targets}"
> > +	get_skip_targets
> > +	for target in ${test_targets}; do
> > +		if should_skip_target $target; then
> > +			continue
> > +		fi
> > +		$SPATH/ftrace_${target}.sh &
> 
> The path to test binaries must be in $PATH before testcases are executed
> so you should just do ftrace_${target}.sh & instead.

Thanks. I will modify it in V2.
in ftrace_lib.sh, it executes : cd $LTPROOT/testcases/bin, So i need to cd
ftrace_stress dir first. then do as you mentioned, make the path shorter is
better.


> > +		eval pid${NR_PIDS}=$!
> > +		echo "Start pid${NR_PIDS}=$! $SPATH/ftrace_${target}.sh"
> > +		((NR_PIDS++))
> 
> Bashism. Portable way is a=$((a+1))

Thanks for reviewing this. Will update this in V2.


> > +	done
> > +	export_pids
> > +}
> > +
> > +export_pids()
> > +{
> > +	for ((i=0; i<NR_PIDS; i++))
> > +	{
> > +		export pid${i}
> > +	}
> 
> Bashism again.


Thx. Will modify it to use while [] in V2.


> > +	export NR_PIDS
> > +}
> >  
> >  # ----------------------------
> >  echo "Ftrace Stress Test Begin"
> > @@ -111,11 +106,11 @@ test_wait
> >  
> >  test_kill
> >  
> > -echo "Ftrace Stress Test End"
> > -
> >  if $test_success; then
> >  	tst_resm TPASS "finished running the test. Run dmesg to double-check for
> >  	bugs"
> >  else
> >  	tst_resm TFAIL "please check log message."
> >  	exit 1
> >  fi
> 
> Again the test should be really converted to test.sh library. That way
> we would exit with correct exit status at tst_exit instead of calling
> exit manually depending on some flag.

Thanks. have read the test.sh lib. that's really great. Will modify this in
V2.

> > +echo "Ftrace Stress Test End"
> 
> And ideally bashism should be fixed in the substests called from this
> tests. So that the test can run with dash or bussy box as well.

Thanks. I will try in V2, in fact, I was referring the old subcases,
not realizing the portable issue.

> --
> Cyril Hrubis
> chrubis@suse.cz
> 
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
> 

-- 
Regards,
Chunyu Hu


  reply	other threads:[~2016-03-18 13:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  8:24 [LTP] [PATCH RFC 0/9] tracing: make ftrace tests to be extended Li Wang
2016-03-04  8:24 ` [LTP] [PATCH RFC 1/9] ftrace_stress: remove the useless file ftrace_get_page_size.c Li Wang
2016-03-04  8:24   ` [LTP] [PATCH RFC 2/9] tracing[1]: reorganize ftrace-stress tests to general tests Li Wang
2016-03-04  8:24     ` [LTP] [PATCH RFC 3/9] tracing[2]: reorganize ftrace stress " Li Wang
2016-03-04  8:24       ` [LTP] [PATCH RFC 4/9] ftrace_regression: add new case to ftrace_regression/ dir Li Wang
2016-03-04  8:24         ` [LTP] [PATCH RFC 5/9] ftrace_regression: add a new testcase Li Wang
2016-03-04  8:24           ` [LTP] [PATCH RFC 6/9] ftrace_stress: skip unsupported tests Li Wang
2016-03-04  8:24             ` [LTP] [PATCH RFC 7/9] ftrace_stress: keep the name of testscipt in sync with tracing file Li Wang
2016-03-04  8:24               ` [LTP] [PATCH RFC 8/9] ftrace_stress: update the trace_options test Li Wang
2016-03-04  8:24                 ` [LTP] [PATCH RFC 9/9] ftrace_stress: add two new tests Li Wang
2016-03-17 18:08                   ` Cyril Hrubis
2016-03-18 14:08                     ` Chunyu Hu
2016-03-21 12:09                       ` Cyril Hrubis
2016-03-17 17:19                 ` [LTP] [PATCH RFC 8/9] ftrace_stress: update the trace_options test Cyril Hrubis
2016-03-17 17:28                   ` Cyril Hrubis
2016-03-18 13:24                     ` Chunyu Hu
2016-03-18 13:21                   ` Chunyu Hu
2016-03-17 17:07             ` [LTP] [PATCH RFC 6/9] ftrace_stress: skip unsupported tests Cyril Hrubis
2016-03-18 13:08               ` Chunyu Hu [this message]
2016-03-17 16:50           ` [LTP] [PATCH RFC 5/9] ftrace_regression: add a new testcase Cyril Hrubis
2016-03-18  7:57             ` Li Wang
2016-03-17 16:49         ` [LTP] [PATCH RFC 4/9] ftrace_regression: add new case to ftrace_regression/ dir Cyril Hrubis
2016-03-17 16:39       ` [LTP] [PATCH RFC 3/9] tracing[2]: reorganize ftrace stress tests to general tests Cyril Hrubis
2016-03-18 10:42         ` Li Wang
2016-03-21 12:21           ` Cyril Hrubis
2016-03-22  8:27             ` Li Wang
2016-03-17 16:29   ` [LTP] [PATCH RFC 1/9] ftrace_stress: remove the useless file ftrace_get_page_size.c Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2674277.29655623.1458306514829.JavaMail.zimbra@redhat.com \
    --to=chuhu@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox