summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/ChangeLog7
-rw-r--r--testsuite/systemtap.samples/tcptest.exp44
-rwxr-xr-xtestsuite/systemtap.samples/tcptest.tcl30
3 files changed, 45 insertions, 36 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 93d82e7a..e0bdd0d1 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-02 Thang Nguyen <thang.p.nguyen@intel.com>
+
+ * systemtap.samples/tcptest.exp: Put TCP load gen into a
+ a seperate script.
+ * systemtap.samples/tcptest.tcl: new script for TCP load
+ gen.
+
2006-10-30 Josh Stone <joshua.i.stone@intel.com>
* systemtap.maps/pmap_agg_overflow.stp: Use
diff --git a/testsuite/systemtap.samples/tcptest.exp b/testsuite/systemtap.samples/tcptest.exp
index 4f424416..0c40f93d 100644
--- a/testsuite/systemtap.samples/tcptest.exp
+++ b/testsuite/systemtap.samples/tcptest.exp
@@ -1,39 +1,11 @@
-#!/usr/bin/tclsh
-# Test the functionality of the tcp probes
+# Test TCP probes
+load_lib "stap_run.exp"
set test "tcptest"
-set host localhost
-set port 11900
-
-proc start_server {sock addr port} {
- set resp_str "Nice to meet you"
- fconfigure $sock -encoding binary -buffersize 16
- while {[read $sock 16] != {}} {
- puts -nonewline $sock $resp_str ;
- }
- exit
-}
-
-proc start_client { } {
- set hello_str "Hello New World!"
- after 2000
- while {[catch {set sock [socket $::host $::port]}]} {}
- fconfigure $sock -encoding binary -buffersize 16
- for {set i 6400} {$i > 0} {incr i -1} {
- puts -nonewline $sock $hello_str;
- read $sock 16
- }
- return 0
-}
-
-if {[llength $argv] == 0} {
- socket -server start_server $port
- after 30000 set thirty_secs timeout
- vwait thirty_secs
-} else {
- load_lib "stap_run.exp"
- exec chmod a+x $srcdir/$subdir/tcptest.exp
- exec $srcdir/$subdir/tcptest.exp &
- set output_string "\\mTCP totalbytes: \\d+\\M"
- stap_run $srcdir/$subdir/$test.stp start_client $output_string
+set tcp_tcl "$srcdir/$subdir/tcptest.tcl"
+proc tcp_gen { } {
+ exec $::tcp_tcl 1
+ return 0
}
+set output_string "\\mTCP totalbytes: \\d+\\M"
+stap_run $srcdir/$subdir/$test.stp tcp_gen $output_string
diff --git a/testsuite/systemtap.samples/tcptest.tcl b/testsuite/systemtap.samples/tcptest.tcl
new file mode 100755
index 00000000..18d92593
--- /dev/null
+++ b/testsuite/systemtap.samples/tcptest.tcl
@@ -0,0 +1,30 @@
+#!/usr/bin/tclsh
+
+set host localhost
+set port 11900
+
+proc receiver {sock addr port} {
+ fconfigure $sock -encoding binary -buffersize 16
+ while {[read $sock 16] != {}} { }
+ exit
+}
+
+proc sender { } {
+ set tst_str "1234567890123456"
+ after 2000
+ while {[catch {set sock [socket $::host $::port]}]} {}
+ fconfigure $sock -encoding binary -buffersize 16
+ for {set i 6400} {$i > 0} {incr i -1} {
+ puts -nonewline $sock $tst_str;
+ }
+ return 0
+}
+
+if {[llength $argv] == 0} {
+ socket -server receiver $port
+ after 30000 set thirty_secs timeout
+ vwait thirty_secs
+} else {
+ exec $argv0 &
+ sender
+}