public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/3] Add new test case for buffer size
  2015-12-15  7:23 [PATCH 1/3] Add new semko test case Zhou Wenjian
  2015-12-15  7:23 ` [PATCH 3/3] Add new case for stress test Zhou Wenjian
@ 2015-12-15  7:23 ` Zhou Wenjian
  2015-12-23 17:58   ` David Smith
  2015-12-23 17:59 ` [PATCH 1/3] Add new semko test case David Smith
  2 siblings, 1 reply; 8+ messages in thread
From: Zhou Wenjian @ 2015-12-15  7:23 UTC (permalink / raw)
  To: systemtap

	* testsuite/systemtap.base/stap_bufsize.exp: New test case
---
 testsuite/systemtap.base/stap_bufsize.exp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 testsuite/systemtap.base/stap_bufsize.exp

diff --git a/testsuite/systemtap.base/stap_bufsize.exp b/testsuite/systemtap.base/stap_bufsize.exp
new file mode 100644
index 0000000..30088ed
--- /dev/null
+++ b/testsuite/systemtap.base/stap_bufsize.exp
@@ -0,0 +1,23 @@
+# Check set buffer size
+set test "buffer size"
+if {![installtest_p]} { untested "$test"; return }
+
+set ret 0
+
+if {[catch { exec sh -c "stap -s 1 -vvv -e 'probe begin{exit();}' 2>&1 | grep -q 'module options: _stp_bufsize=1'"}]} {
+    set ret 1
+}
+
+if {[catch { exec sh -c "stap -s 64 -vvv -e 'probe begin{exit();}' 2>&1 | grep -q 'module options: _stp_bufsize=64'"}]} {
+    set ret 1
+}
+
+if {[catch { exec sh -c "stap -s 4096 -vvv -e 'probe begin{exit();}' 2>&1 | grep -q 'Invalid buffer size (should be 1-4095).'"}]} {
+    set ret 1
+}
+
+if { $ret == 0 } {
+	pass $test
+} else {
+	fail $test
+}
-- 
1.8.3.1



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

* [PATCH 1/3] Add new semko test case
@ 2015-12-15  7:23 Zhou Wenjian
  2015-12-15  7:23 ` [PATCH 3/3] Add new case for stress test Zhou Wenjian
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Zhou Wenjian @ 2015-12-15  7:23 UTC (permalink / raw)
  To: systemtap

	* testsuite/semko/var_definition.stp: New test case
---
 testsuite/semko/var_definition.stp | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100755 testsuite/semko/var_definition.stp

diff --git a/testsuite/semko/var_definition.stp b/testsuite/semko/var_definition.stp
new file mode 100755
index 0000000..62b7cf5
--- /dev/null
+++ b/testsuite/semko/var_definition.stp
@@ -0,0 +1,8 @@
+#! stap -p2
+
+# Variable identifier can't start with $.
+probe begin
+{
+	$var=2015
+	exit()
+}
-- 
1.8.3.1



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

* [PATCH 3/3] Add new case for stress test
  2015-12-15  7:23 [PATCH 1/3] Add new semko test case Zhou Wenjian
@ 2015-12-15  7:23 ` Zhou Wenjian
  2015-12-15 12:41   ` Frank Ch. Eigler
  2015-12-15  7:23 ` [PATCH 2/3] Add new test case for buffer size Zhou Wenjian
  2015-12-23 17:59 ` [PATCH 1/3] Add new semko test case David Smith
  2 siblings, 1 reply; 8+ messages in thread
From: Zhou Wenjian @ 2015-12-15  7:23 UTC (permalink / raw)
  To: systemtap

	* testsuite/systemtap.stress/parallel_exec.exp: New test case
---
 testsuite/systemtap.stress/parallel_exec.exp | 56 ++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 testsuite/systemtap.stress/parallel_exec.exp

diff --git a/testsuite/systemtap.stress/parallel_exec.exp b/testsuite/systemtap.stress/parallel_exec.exp
new file mode 100644
index 0000000..9fbefae
--- /dev/null
+++ b/testsuite/systemtap.stress/parallel_exec.exp
@@ -0,0 +1,56 @@
+#!/bin/expect -f
+
+set test "parallel execute"
+
+proc gen_load {} {
+    # if 'genload' from the ltp exists, use it to create a real load
+    set genload {/usr/local/ltp/testcases/bin/genload}
+    if [file executable $genload] {
+        exec $genload -c 10 -i 10 -m 10 -t 10
+        #                               ^^^^^ run for 10 seconds
+        #                         ^^^^^ 10 procs spinning on malloc
+        #                   ^^^^^ 10 procs spinning on sync
+        #             ^^^^^ 10 procs spinning on sqrt
+    } else {
+        # sleep for a bit
+        wait_n_secs 10
+    }
+    return 0
+}
+
+set process_num 10
+
+set script {
+	probe syscall.open
+	{
+		if (pid() != target()) next
+		log("open")
+	}
+
+	probe syscall.close
+	{
+		if (pid() != target()) next
+		log("close")
+	}
+}
+
+for { set i 0 } { $i < $process_num } { incr i } {
+	exec stap -e "$script" -c "cat /etc/hosts > /dev/null" >>/tmp/parallel_exec &
+}
+
+if {[eval gen_load] == 0} then {
+	pass "$test load generation"
+} else {
+	fail "$test load generation"
+}
+
+set num1 [exec stap -e "$script" -c "cat /etc/hosts > /dev/null" | grep \[open|close\] | wc -l]
+set num2 [exec grep \[open|close\] /tmp/parallel_exec | wc -l]
+
+exec rm -f /tmp/parallel_exec
+
+if {$num1 * $process_num != $num2} {
+	fail $test
+} else {
+	pass $test
+}
-- 
1.8.3.1



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

* Re: [PATCH 3/3] Add new case for stress test
  2015-12-15  7:23 ` [PATCH 3/3] Add new case for stress test Zhou Wenjian
@ 2015-12-15 12:41   ` Frank Ch. Eigler
  2015-12-16  5:54     ` "Zhou, Wenjian/周文剑"
  0 siblings, 1 reply; 8+ messages in thread
From: Frank Ch. Eigler @ 2015-12-15 12:41 UTC (permalink / raw)
  To: Zhou Wenjian; +Cc: systemtap


zhouwj-fnst wrote:

> [...]
> +proc gen_load {} {
> +    # if 'genload' from the ltp exists, use it to create a real load
> +    set genload {/usr/local/ltp/testcases/bin/genload}
> +    if [file executable $genload] {
> [...]

How about using the same logic used in lib/stap_run.exp looking for
/usr/bin/stress?  Or $PATH searching?  That /usr/local/ltp path is
just not a good fit for general installations.

- FChE

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

* Re: [PATCH 3/3] Add new case for stress test
  2015-12-15 12:41   ` Frank Ch. Eigler
@ 2015-12-16  5:54     ` "Zhou, Wenjian/周文剑"
  2015-12-23 17:46       ` David Smith
  0 siblings, 1 reply; 8+ messages in thread
From: "Zhou, Wenjian/周文剑" @ 2015-12-16  5:54 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: systemtap

On 12/15/2015 08:41 PM, Frank Ch. Eigler wrote:
>
> zhouwj-fnst wrote:
>
>> [...]
>> +proc gen_load {} {
>> +    # if 'genload' from the ltp exists, use it to create a real load
>> +    set genload {/usr/local/ltp/testcases/bin/genload}
>> +    if [file executable $genload] {
>> [...]
>
> How about using the same logic used in lib/stap_run.exp looking for
> /usr/bin/stress?  Or $PATH searching?  That /usr/local/ltp path is
> just not a good fit for general installations.
>

Hello Frank,

+proc gen_load {} {
+    # if 'genload' from the ltp exists, use it to create a real load
+    set genload {/usr/local/ltp/testcases/bin/genload}
+    if [file executable $genload] {
+        exec $genload -c 10 -i 10 -m 10 -t 10
+        #                               ^^^^^ run for 10 seconds
+        #                         ^^^^^ 10 procs spinning on malloc
+        #                   ^^^^^ 10 procs spinning on sync
+        #             ^^^^^ 10 procs spinning on sqrt
+    } else {
+        # sleep for a bit
+        wait_n_secs 10

"wait_n_secs" is the function in stap_run.exp.
If /usr/local/ltp/testcases/bin/genload is not exist, it will look for /usr/bin/stress.
I just use the same logic of the other tests in stress.
Do you mean "set genload" should be removed ?

+    }
+    return 0
+}

-- 
Thanks
Zhou


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

* Re: [PATCH 3/3] Add new case for stress test
  2015-12-16  5:54     ` "Zhou, Wenjian/周文剑"
@ 2015-12-23 17:46       ` David Smith
  0 siblings, 0 replies; 8+ messages in thread
From: David Smith @ 2015-12-23 17:46 UTC (permalink / raw)
  To: Zhou, Wenjian/周文剑, Frank Ch. Eigler; +Cc: systemtap

On 12/15/2015 11:52 PM, "Zhou, Wenjian/周文剑" wrote:
> On 12/15/2015 08:41 PM, Frank Ch. Eigler wrote:
>>
>> zhouwj-fnst wrote:
>>
>>> [...]
>>> +proc gen_load {} {
>>> +    # if 'genload' from the ltp exists, use it to create a real load
>>> +    set genload {/usr/local/ltp/testcases/bin/genload}
>>> +    if [file executable $genload] {
>>> [...]
>>
>> How about using the same logic used in lib/stap_run.exp looking for
>> /usr/bin/stress?  Or $PATH searching?  That /usr/local/ltp path is
>> just not a good fit for general installations.
>>
> 
> Hello Frank,
> 
> +proc gen_load {} {
> +    # if 'genload' from the ltp exists, use it to create a real load
> +    set genload {/usr/local/ltp/testcases/bin/genload}
> +    if [file executable $genload] {
> +        exec $genload -c 10 -i 10 -m 10 -t 10
> +        #                               ^^^^^ run for 10 seconds
> +        #                         ^^^^^ 10 procs spinning on malloc
> +        #                   ^^^^^ 10 procs spinning on sync
> +        #             ^^^^^ 10 procs spinning on sqrt
> +    } else {
> +        # sleep for a bit
> +        wait_n_secs 10
> 
> "wait_n_secs" is the function in stap_run.exp.
> If /usr/local/ltp/testcases/bin/genload is not exist, it will look for
> /usr/bin/stress.

I think Frank means we should search the path for 'genload', instead of
just looking for it in /usr/local/ltp/testcases/bin. The easiest way to
do that would be to look at the output of 'which genload'. If that was
empty, you could then look in /usr/local/ltp/testcases/bin.

> I just use the same logic of the other tests in stress.
> Do you mean "set genload" should be removed ?

It looks like testsuite/systemtap.stress/all_kernel_functions.exp and
testsuite/systemtap.stress/current.exp also have a genload function.
Perhaps we should move/combine them all the genload functions into a new
file in testsuite/lib that the 2 existing tests and your new test use.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

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

* Re: [PATCH 2/3] Add new test case for buffer size
  2015-12-15  7:23 ` [PATCH 2/3] Add new test case for buffer size Zhou Wenjian
@ 2015-12-23 17:58   ` David Smith
  0 siblings, 0 replies; 8+ messages in thread
From: David Smith @ 2015-12-23 17:58 UTC (permalink / raw)
  To: Zhou Wenjian, systemtap

On 12/15/2015 01:21 AM, Zhou Wenjian wrote:
> 	* testsuite/systemtap.base/stap_bufsize.exp: New test case

I've checked this one in - thanks.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

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

* Re: [PATCH 1/3] Add new semko test case
  2015-12-15  7:23 [PATCH 1/3] Add new semko test case Zhou Wenjian
  2015-12-15  7:23 ` [PATCH 3/3] Add new case for stress test Zhou Wenjian
  2015-12-15  7:23 ` [PATCH 2/3] Add new test case for buffer size Zhou Wenjian
@ 2015-12-23 17:59 ` David Smith
  2 siblings, 0 replies; 8+ messages in thread
From: David Smith @ 2015-12-23 17:59 UTC (permalink / raw)
  To: Zhou Wenjian, systemtap

On 12/15/2015 01:21 AM, Zhou Wenjian wrote:
> 	* testsuite/semko/var_definition.stp: New test case

I've checked this one in - thanks.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

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

end of thread, other threads:[~2015-12-23 17:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-15  7:23 [PATCH 1/3] Add new semko test case Zhou Wenjian
2015-12-15  7:23 ` [PATCH 3/3] Add new case for stress test Zhou Wenjian
2015-12-15 12:41   ` Frank Ch. Eigler
2015-12-16  5:54     ` "Zhou, Wenjian/周文剑"
2015-12-23 17:46       ` David Smith
2015-12-15  7:23 ` [PATCH 2/3] Add new test case for buffer size Zhou Wenjian
2015-12-23 17:58   ` David Smith
2015-12-23 17:59 ` [PATCH 1/3] Add new semko test case David Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).