All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
@ 2006-05-25 19:34 Niklaus Giger
  2006-05-26 13:52 ` Jan Kiszka
  0 siblings, 1 reply; 13+ messages in thread
From: Niklaus Giger @ 2006-05-25 19:34 UTC (permalink / raw)
  To: xenomai, Jim Cromie

[-- Attachment #1: Type: text/plain, Size: 2544 bytes --]

Hi

For my embedded target system I installed BusyBox as it was the easiest way to 
get a small GNU/Linux system to boot into a working shell. (But it takes less 
than 16 seconds from power on till the the familiar "login: " prompt.)

But I ran into the problem, that the xeno-*-applications did not run under the 
busybox environment. Here are some comment on my proposed changes.

1) To make a shell work under the busybox I had to specify #! /bin/sh instead 
of #! /bin/bash.

2) To make the run I run the xeno-*-applications on my Debian GNU/Linux 
PowerBook 
either as:
$ xeno-info
or as 
$ busybox sh xeno-info

3) Once all tests passed on my PowerBook, I switched to the embedded PPC405GPr 
board using a recent busybox (version 1.1.3).
This exposed some more not supported errors, eg.
fdformat: unrecognized option `--version'
Also on an embedded system a lot of the usual utilites like gcc, make, etc are 
not present. Therefore I checked for their existence with expressions like 
`which make`

4) As the BSD utility script is not present on my embedded system, 
xeno-test -L does not work.

5) The busybox shell does not know arrays. Also for unknown reasons the 
dd_jobs variable got not updated outside of the function generate_loads. 
Therefore I added a "killall dd" in the cleanup.

6) "trap CHLD" did not work under the BusyBox. Also (to be sure) called 
cleanup_load manually before exit.

7) Id did not ident the not busybox parts in xeno-info. This makes the patch 
smaller and more readable, but should probably be corrected before applying 
it.

8) Using `dirname $0` relative paths to make xeno-test work also if not called 
in /usr/xenomai/bin

9) Changing the e-mail address to xenomai-data@domain.hid is also included.

Checking the changes between running xeno-test (as bash or as busybox) and the 
old one did not reveal any significant changes. On my PPC405 system I could 
not complete this test as there segmentation faults running the invidual 
tests.

I would appreciate if these changes (or similar) could go -- after a review -- 
into the trunk (not necessarily before 2.2). I am specially interested in Jim 
Cromie's opinion. 

If anybody has a working target with a Xenomai + BusyBox combination and would 
be willing to test drive my changes, I would appreciate a feedback 
enormously.

These changes are a precondition to make the buildbot run xeno-test on the 
only board where I can easily and automatically switch the power off and on, 
without risking a family crisis.

Best regards
-- 
Niklaus Giger

[-- Attachment #2: scripts.patch --]
[-- Type: text/x-diff, Size: 9070 bytes --]

Index: scripts/xeno-config.in
===================================================================
--- scripts/xeno-config.in	(Revision 1135)
+++ scripts/xeno-config.in	(Arbeitskopie)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 
 staging=${DESTDIR}
 prefix="@prefix@"
Index: scripts/xeno-info
===================================================================
--- scripts/xeno-info	(Revision 1135)
+++ scripts/xeno-info	(Arbeitskopie)
@@ -1,31 +1,51 @@
-#!/bin/sh
+#! /bin/sh
 #
 # This file has been lifted 'as is' from linux/scripts/ver_linux.
-#
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH
 echo 'If some fields are empty or look unusual you may have an old version.'
 echo 'Compare to the current minimal requirements in Documentation/Changes.'
 echo ' '
 
+withBusybox=0
+if test -L $SHELL ; then # is sh a logical link to busybox
+    exeName=`ls -l $SHELL|cut -d\>  -f2`
+    if test "`basename $exeName`" = "busybox";  then
+	withBusybox=1; else echo 2.3
+    fi
+elif test -n "$_" -a "`basename $_`" = "busybox"; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+
+if test $withBusybox -eq 1; then busybox | grep -i "BusyBox v" ; fi
+
 uname -a
 echo ' '
 
+if test -n "`which gcc`" ; then
 gcc --version 2>&1| head -n 1 | grep -v gcc | awk \
 'NR==1{print "Gnu C                 ", $1}'
 
 gcc --version 2>&1| grep gcc | awk \
 'NR==1{print "Gnu C                 ", $3}'
+fi
 
+if test -n "`which gcc`" ; then
 make --version 2>&1 | awk -F, '{print $1}' | awk \
       '/GNU Make/{print "Gnu make              ",$NF}'
+fi
 
 ld -v 2>&1 | awk -F\) '{print $1}' | awk \
       '/BFD/{print "binutils              ",$NF}'
 
+if test 0 -eq $withBusybox ; then 
 fdformat --version | awk -F\- '{print "util-linux            ", $NF}'
 
 mount --version | awk -F\- '{print "mount                 ", $NF}'
+fi 
 
 depmod -V  2>&1 | awk 'NR==1 {print "module-init-tools     ",$NF}'
 
@@ -50,21 +70,26 @@
 isdnctrl 2>&1 | grep version | awk \
 'NR==1{print "isdn4k-utils          ", $NF}'
 
+if test -n "`which ldd`" ; then
 ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
 -e 's/\.so$//' | awk -F'[.-]'   '{print "Linux C Library        " \
 $(NF-2)"."$(NF-1)"."$NF}'
 
 ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n1 | awk \
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'
+fi
 
 ls -l /usr/lib/lib{g,stdc}++.so  2>/dev/null | awk -F. \
        '{print "Linux C++ Library      " $4"."$5"."$6}'
 
+if test 0 -eq $withBusybox ; then 
 ps --version 2>&1 | awk 'NR==1{print "Procps                ", $NF}'
+fi 
 
 ifconfig --version 2>&1 | grep tools | awk \
 'NR==1{print "Net-tools             ", $NF}'
 
+if test 0 -eq $withBusybox ; then 
 # Kbd needs 'loadkeys -h',
 loadkeys -h 2>&1 | awk \
 '(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'
@@ -74,6 +99,7 @@
 '(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools         ", $3}'
 
 expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'
+fi 
 
 if [ -e /proc/modules ]; then
     X=`cat /proc/modules | sed -e "s/ .*$//"`
Index: scripts/xeno-load.in
===================================================================
--- scripts/xeno-load.in	(Revision 1135)
+++ scripts/xeno-load.in	(Arbeitskopie)
@@ -1,7 +1,9 @@
-#! /bin/bash
+#! /bin/sh
 # Xenomai application loader script.
 # (Processes the .runinfo files)
 # June 2004, <rpm@xenomai.org>
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 usage='usage: xeno-load [[dir:]target]'
 prefix="@prefix@"
@@ -23,7 +25,7 @@
   shift
 fi
 
-if test "x$1" = x--; then
+if test -z "$1" || test "x$1" = x--; then
   target_dir=`pwd`
   target_name=default
 else
@@ -80,7 +82,7 @@
 
 eval $user_moddir
 
-if `$sudo $modprobe -nq xeno_nucleus >& /dev/null`; then
+if `$sudo $modprobe -nq xeno_nucleus > /dev/null 2>&1`; then
    target_deps="${target_deps}nucleus+"
 else
    target_deps=
@@ -92,8 +94,8 @@
 
 test $verbose = 1 && echo "Running $target_name from $run_info_file"
 
-if test \! "x`type -t sudo`" = x; then
-  sudo=sudo
+if test -n "`which sudo`"; then
+  sudo=`which sudo`
 fi
 
 if test \! "x$target_mesg" = x; then
@@ -161,7 +163,7 @@
 	   echo "ERROR: cannot load $xeno_moddir/xeno_$mod$modext"
 	   break
         fi
-     elif `$sudo $modprobe -n xeno_$mod >& /dev/null`; then
+     elif `$sudo $modprobe -n xeno_$mod > /dev/null 2>&1`; then
         test $verbose = 1 && echo "+ $modprobe xeno_$mod"
         $sudo $modprobe xeno_$mod
         inslist="xeno_$mod $inslist"
Index: scripts/xeno-test.in
===================================================================
--- scripts/xeno-test.in	(Revision 1135)
+++ scripts/xeno-test.in	(Arbeitskopie)
@@ -1,4 +1,6 @@
-#!/bin/bash
+#! /bin/sh
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-test 
 
 myusage() {
     cat >&1 <<EOF
@@ -19,7 +21,7 @@
 		name can be full or relative pathname
   -v		verbose
   -M <email>	sends output to given addr
-  -m		sends output to xenotest.output@domain.hid
+  -m		sends output to xenomai-data@domain.hid
   -U <url>	uploads output to given URL
 	
   # following options are passed thru to latency
@@ -40,6 +42,18 @@
 
 set -o notify	# see dd's finish immediately.(or not!)
 
+withBusybox=0
+if test -L $SHELL ; then # is sh a logical link to busybox
+    exeName=`ls -l $SHELL|cut -d\>  -f2`
+    if test "`basename $exeName`" = "busybox";  then
+	withBusybox=1; else echo 2.3
+    fi
+elif test -n "$_" -a "`basename $_`" = "busybox"; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+echo withBusybox ist $withBusybox
+
 loudly() {
     [ "$1" = "" ] && return
     # run task after announcing it
@@ -51,31 +65,39 @@
 
 # defaults for cpu workload 
 device=/dev/zero	
-typeset -a dd_jobs
-dd_jobs=()
+dd_jobs=
 
 # used in generate-loads
 mkload() { exec dd if=$device of=/dev/null $* ; }
 
 generate_loads() {
     local jobsct=$1; shift;
+    if test 0 -eq $withBusybox ; then
+	reaper() { echo something died a $! or $* ; sleep 1;  }
+	trap reaper CHLD
+    else
+	echo "dummy  reaper for $!"
+	reaper() { echo xx >/dev/null ; }
+    fi
+    trap cleanup_load EXIT	# under all exit conditions
 
-    reaper() { echo something died $*; }
-    trap reaper CHLD
-    trap cleanup_load EXIT	# under all exit conditions
-    
-    for (( ; $jobsct ; jobsct-- )) ; do
-	mkload &
-	dd_jobs[${#dd_jobs[*]}]=$!
+    for _j in $jobsct ; do
+ 	mkload &
+	dd_jobs="$dd_jobs $!"
+	break
     done;
 
-    echo dd workload started, pids ${dd_jobs[*]}
+    echo dd workload started, pids $dd_jobs
 }
 
 cleanup_load() {
     # kill the workload
-    echo killing workload pids ${dd_jobs[*]}
-    kill ${dd_jobs[*]};
+    echo killing workload pids ${dd_jobs}
+    for _j in ${dd_jobs}
+    do
+       kill $_j
+    done
+    killall dd
     unset dd_jobs;
 }
 
@@ -83,10 +105,9 @@
 
 
 boxinfo() { # static info, show once
+    loudly `dirname $0`/xeno-config --verbose
+    loudly `dirname $0`/xeno-info
 
-    loudly ./xeno-config --verbose
-    loudly ./xeno-info
-
     loudly cat /proc/cpuinfo	# bogomips changes under CPU_FREQ
 
     # how much of the config do we want ?
@@ -114,7 +135,11 @@
 	for f in /proc/xenomai/*/*; do [ -f $f ] && loudly cat $f; done
     fi
     [ -n "$prepost" ] && loudly $prepost
-    loudly top -bn1c | head -n $(( 12 + $workload ))
+    if test 0 -eq $withBusybox ; then
+	loudly top -bn1c | head -n $(( 12 + $workload ))
+    else
+	loudly top | head -n $(( 12 + $workload ))
+    fi
 }
 
 
@@ -126,15 +151,15 @@
     loudly generate_loads $workload
     boxstatus
     (
-	cd ../testsuite/latency
+        cd `dirname $0`/../testsuite/latency
 	loudly ./run --  $opts -t0
 	loudly ./run --  $opts -t1
 	loudly ./run --  $opts -t2
     )
-    (	cd ../testsuite/switch 
+    (	cd `dirname $0`/../testsuite/switch
 	loudly ./run --  '# switch'
     )
-    (	cd ../testsuite/cyclic
+    (	cd `dirname $0`/../testsuite/cyclic
 	loudly ./run -- -p 10 -n -l 1000 '# cyclictest'
     )
 
@@ -167,7 +192,7 @@
 logprefix=/tmp/	# someplace usually there
 prepost=	# command to run pre, and post test (ex ntpq -p)
 
-email='xenotest.output@domain.hid'	# until formalized
+email='xenomai-data@domain.hid'	
 sentby='xenotest.sender@domain.hid'
 url=
 sendit=		# send it by m-mail, u-url
@@ -175,15 +200,15 @@
 
 sendit() {
     local file=$1
-    
-    if [ "$sendit" == 'm' ]; then
+
+    if test "$sendit" = 'm' ; then
 	echo "mailing $file to $email"
-	if [ "$file" != '' ]; then
+	if test -n "$file" ; then
 	    mail -s 'xeno-test results' $email -- -F $sentby < $file
 	else
 	    cat - | mail -s 'xeno-test results' $email -- -F $sentby
 	fi
-    elif [ "$sendit" == 'u' ]; then
+    elif test "$sendit" = 'u' ; then
 	which curl && curl -T $file $url
 	# -x $proxy >/tmp/.submit_result
 	# which wget && curl -T $file $url \
@@ -263,6 +288,8 @@
     fi
 fi
 
+cleanup_load
+
 exit;
 
 

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-25 19:34 [Xenomai-core] Porting xeno-{info|load|test} to a busybox system Niklaus Giger
@ 2006-05-26 13:52 ` Jan Kiszka
  2006-05-26 16:52   ` Niklaus Giger
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Kiszka @ 2006-05-26 13:52 UTC (permalink / raw)
  To: niklaus.giger; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2979 bytes --]

Niklaus Giger wrote:
> ...
> If anybody has a working target with a Xenomai + BusyBox combination and would 
> be willing to test drive my changes, I would appreciate a feedback 
> enormously.

Did so, and here comes the result: :)

> Index: scripts/xeno-info
> ===================================================================
> --- scripts/xeno-info	(Revision 1135)
> +++ scripts/xeno-info	(Arbeitskopie)
> @@ -1,31 +1,51 @@
> -#!/bin/sh
> +#! /bin/sh
>  #
>  # This file has been lifted 'as is' from linux/scripts/ver_linux.
> -#
> +# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
> +# busybox sh xeno-info 
>  
>  PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH
>  echo 'If some fields are empty or look unusual you may have an old version.'
>  echo 'Compare to the current minimal requirements in Documentation/Changes.'
>  echo ' '
>  
> +withBusybox=0
> +if test -L $SHELL ; then # is sh a logical link to busybox
> +    exeName=`ls -l $SHELL|cut -d\>  -f2`
> +    if test "`basename $exeName`" = "busybox";  then
> +	withBusybox=1; else echo 2.3
> +    fi
> +elif test -n "$_" -a "`basename $_`" = "busybox"; then
> +    withBusybox=1;
> +# else running a real /bin/sh (bash) shell
> +fi

This may become fragile (and it already is on my hacked system). The
reason: plans exist to allow compiling bb into multiple binaries again,
thus sh will not be linked to busybox, but to ash e.g.

What about this:

withBusybox=0
if sh --help 2>&1| grep -q BusyBox; then
    withBusybox=1;
# else running a real /bin/sh (bash) shell
fi
echo withBusybox is $withBusybox


When using this variant, I get the following messages:

> /bin/xeno-test: /bin/xeno-test: 177: zgrep: not found

What about zcat | grep instead? Moreover, I failed to find a zgrep bb
applet. Did you copy that stuff on your box?

> /bin/xeno-test: /bin/xeno-test: 264: getopts: not found

getopts is off by default in bb. Is this essential for xeno-test? Then
you should state this requirement somewhere.

> /bin/xeno-test: shift: 267: Illegal number: -1

I guess this comes from the missing getopts...


Regarding workload: I typically run the cache calibrator [1] in a look,
together with some I/O load (hard disk where available, flood ping). The
loop looks like

while true; do calibrator <box-MHz> 8M /tmp/; done

<box-MHz> should be derivable from /proc/cpuinfo with some scripting. We
may just check if an inclusion of the calibrator source code is possible
(license terms...).


Lacking time right now, otherwise I would have hacked further to make
the test run. This test could be quite interesting for us here to
quickly check our processing boxes' hardware and to test new Xenomai
versions for elementary regressions when upgrading production systems
(fortunately only their CF-cards). Looking forward!

Jan


[1] http://homepages.cwi.nl/~manegold/Calibrator


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-26 13:52 ` Jan Kiszka
@ 2006-05-26 16:52   ` Niklaus Giger
  2006-05-27 16:42     ` Jan Kiszka
  2006-06-06 20:32     ` Jim Cromie
  0 siblings, 2 replies; 13+ messages in thread
From: Niklaus Giger @ 2006-05-26 16:52 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2586 bytes --]

Am Freitag, 26. Mai 2006 15:52 schrieb Jan Kiszka:
> Niklaus Giger wrote:
> > ...
> > If anybody has a working target with a Xenomai + BusyBox combination and
> > would be willing to test drive my changes, I would appreciate a feedback
> > enormously.
>
> Did so, and here comes the result: :)
Thanks a lot for your prompt feedback.
<..>
> This may become fragile (and it already is on my hacked system). The
> reason: plans exist to allow compiling bb into multiple binaries again,
> thus sh will not be linked to busybox, but to ash e.g.
Sure. It was just my first idea. But your proposed solution is better and 
already
<..>
> When using this variant, I get the following messages:
> > /bin/xeno-test: /bin/xeno-test: 177: zgrep: not found
> What about zcat | grep instead? Moreover, I failed to find a zgrep bb
> applet. Did you copy that stuff on your box?
Sorry. As I had segmentation faults, my run did not get so far/or I missed 
this error. Running it manually I confirmed your bug and the proposed 
solution works for me, too. Integrated in the new version (attached) of the 
patch.

> > /bin/xeno-test: /bin/xeno-test: 264: getopts: not found
>
> getopts is off by default in bb. Is this essential for xeno-test? Then
> you should state this requirement somewhere.
I checked out BusyBox 1.13, run "make defconfig", changed the cross-compiler 
and install path. But I verified that a "make defconfig" on the 1.00 version 
had "# CONFIG_ASH_GETOPTS is not set".

Could you try the attached patch using busybox with "CONFIG_ASH_GETOPTS=y"? 
 
> > /bin/xeno-test: shift: 267: Illegal number: -1
>
> I guess this comes from the missing getopts...
>
>
> Regarding workload: I typically run the cache calibrator [1] in a look,
> together with some I/O load (hard disk where available, flood ping). The
> loop looks like
>
> while true; do calibrator <box-MHz> 8M /tmp/; done
> <box-MHz> should be derivable from /proc/cpuinfo with some scripting. We
> may just check if an inclusion of the calibrator source code is possible
> (license terms...).
Didn't know this tool. But I think this is another suggestion to improve 
xeno-test.
>
> Lacking time right now, otherwise I would have hacked further to make
> the test run. This test could be quite interesting for us here to
> quickly check our processing boxes' hardware and to test new Xenomai
> versions for elementary regressions when upgrading production systems
> (fortunately only their CF-cards). Looking forward!
Nice to hear that. So could you please give my patch a second try with a 
modified busybox?

-- 
Niklaus Giger

[-- Attachment #2: scripts.patch --]
[-- Type: text/x-diff, Size: 9119 bytes --]

Index: scripts/xeno-config.in
===================================================================
--- scripts/xeno-config.in	(Revision 1137)
+++ scripts/xeno-config.in	(Arbeitskopie)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 
 staging=${DESTDIR}
 prefix="@prefix@"
Index: scripts/xeno-info
===================================================================
--- scripts/xeno-info	(Revision 1137)
+++ scripts/xeno-info	(Arbeitskopie)
@@ -1,31 +1,46 @@
-#!/bin/sh
+#! /bin/sh
 #
 # This file has been lifted 'as is' from linux/scripts/ver_linux.
-#
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH
 echo 'If some fields are empty or look unusual you may have an old version.'
 echo 'Compare to the current minimal requirements in Documentation/Changes.'
 echo ' '
 
+withBusybox=0
+if sh --help 2>&1| grep -q BusyBox; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+
+if test $withBusybox -eq 1; then busybox | grep -i "BusyBox v" ; fi
+
 uname -a
 echo ' '
 
+if test -n "`which gcc`" ; then
 gcc --version 2>&1| head -n 1 | grep -v gcc | awk \
 'NR==1{print "Gnu C                 ", $1}'
 
 gcc --version 2>&1| grep gcc | awk \
 'NR==1{print "Gnu C                 ", $3}'
+fi
 
+if test -n "`which gcc`" ; then
 make --version 2>&1 | awk -F, '{print $1}' | awk \
       '/GNU Make/{print "Gnu make              ",$NF}'
+fi
 
 ld -v 2>&1 | awk -F\) '{print $1}' | awk \
       '/BFD/{print "binutils              ",$NF}'
 
+if test 0 -eq $withBusybox ; then 
 fdformat --version | awk -F\- '{print "util-linux            ", $NF}'
 
 mount --version | awk -F\- '{print "mount                 ", $NF}'
+fi 
 
 depmod -V  2>&1 | awk 'NR==1 {print "module-init-tools     ",$NF}'
 
@@ -50,21 +65,26 @@
 isdnctrl 2>&1 | grep version | awk \
 'NR==1{print "isdn4k-utils          ", $NF}'
 
+if test -n "`which ldd`" ; then
 ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
 -e 's/\.so$//' | awk -F'[.-]'   '{print "Linux C Library        " \
 $(NF-2)"."$(NF-1)"."$NF}'
 
 ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n1 | awk \
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'
+fi
 
 ls -l /usr/lib/lib{g,stdc}++.so  2>/dev/null | awk -F. \
        '{print "Linux C++ Library      " $4"."$5"."$6}'
 
+if test 0 -eq $withBusybox ; then 
 ps --version 2>&1 | awk 'NR==1{print "Procps                ", $NF}'
+fi 
 
 ifconfig --version 2>&1 | grep tools | awk \
 'NR==1{print "Net-tools             ", $NF}'
 
+if test 0 -eq $withBusybox ; then 
 # Kbd needs 'loadkeys -h',
 loadkeys -h 2>&1 | awk \
 '(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'
@@ -74,6 +94,7 @@
 '(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools         ", $3}'
 
 expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'
+fi 
 
 if [ -e /proc/modules ]; then
     X=`cat /proc/modules | sed -e "s/ .*$//"`
Index: scripts/xeno-load.in
===================================================================
--- scripts/xeno-load.in	(Revision 1137)
+++ scripts/xeno-load.in	(Arbeitskopie)
@@ -1,7 +1,9 @@
-#! /bin/bash
+#! /bin/sh
 # Xenomai application loader script.
 # (Processes the .runinfo files)
 # June 2004, <rpm@xenomai.org>
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 usage='usage: xeno-load [[dir:]target]'
 prefix="@prefix@"
@@ -23,7 +25,7 @@
   shift
 fi
 
-if test "x$1" = x--; then
+if test -z "$1" || test "x$1" = x--; then
   target_dir=`pwd`
   target_name=default
 else
@@ -80,7 +82,7 @@
 
 eval $user_moddir
 
-if `$sudo $modprobe -nq xeno_nucleus >& /dev/null`; then
+if `$sudo $modprobe -nq xeno_nucleus > /dev/null 2>&1`; then
    target_deps="${target_deps}nucleus+"
 else
    target_deps=
@@ -92,8 +94,8 @@
 
 test $verbose = 1 && echo "Running $target_name from $run_info_file"
 
-if test \! "x`type -t sudo`" = x; then
-  sudo=sudo
+if test -n "`which sudo`"; then
+  sudo=`which sudo`
 fi
 
 if test \! "x$target_mesg" = x; then
@@ -161,7 +163,7 @@
 	   echo "ERROR: cannot load $xeno_moddir/xeno_$mod$modext"
 	   break
         fi
-     elif `$sudo $modprobe -n xeno_$mod >& /dev/null`; then
+     elif `$sudo $modprobe -n xeno_$mod > /dev/null 2>&1`; then
         test $verbose = 1 && echo "+ $modprobe xeno_$mod"
         $sudo $modprobe xeno_$mod
         inslist="xeno_$mod $inslist"
Index: scripts/xeno-test.in
===================================================================
--- scripts/xeno-test.in	(Revision 1137)
+++ scripts/xeno-test.in	(Arbeitskopie)
@@ -1,4 +1,6 @@
-#!/bin/bash
+#! /bin/sh
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-test 
 
 myusage() {
     cat >&1 <<EOF
@@ -19,7 +21,7 @@
 		name can be full or relative pathname
   -v		verbose
   -M <email>	sends output to given addr
-  -m		sends output to xenotest.output@domain.hid
+  -m		sends output to xenomai-data@domain.hid
   -U <url>	uploads output to given URL
 	
   # following options are passed thru to latency
@@ -40,6 +42,13 @@
 
 set -o notify	# see dd's finish immediately.(or not!)
 
+withBusybox=0
+if sh --help 2>&1| grep -q BusyBox; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+echo withBusybox is $withBusybox
+
 loudly() {
     [ "$1" = "" ] && return
     # run task after announcing it
@@ -51,31 +60,39 @@
 
 # defaults for cpu workload 
 device=/dev/zero	
-typeset -a dd_jobs
-dd_jobs=()
+dd_jobs=
 
 # used in generate-loads
 mkload() { exec dd if=$device of=/dev/null $* ; }
 
 generate_loads() {
     local jobsct=$1; shift;
+    if test 0 -eq $withBusybox ; then
+	reaper() { echo something died a $! or $* ; sleep 1;  }
+	trap reaper CHLD
+    else
+	echo "dummy  reaper for $!"
+	reaper() { echo xx >/dev/null ; }
+    fi
+    trap cleanup_load EXIT	# under all exit conditions
 
-    reaper() { echo something died $*; }
-    trap reaper CHLD
-    trap cleanup_load EXIT	# under all exit conditions
-    
-    for (( ; $jobsct ; jobsct-- )) ; do
-	mkload &
-	dd_jobs[${#dd_jobs[*]}]=$!
+    for _j in $jobsct ; do
+ 	mkload &
+	dd_jobs="$dd_jobs $!"
+	break
     done;
 
-    echo dd workload started, pids ${dd_jobs[*]}
+    echo dd workload started, pids $dd_jobs
 }
 
 cleanup_load() {
     # kill the workload
-    echo killing workload pids ${dd_jobs[*]}
-    kill ${dd_jobs[*]};
+    echo killing workload pids ${dd_jobs}
+    for _j in ${dd_jobs}
+    do
+       kill $_j
+    done
+    killall dd
     unset dd_jobs;
 }
 
@@ -83,14 +100,13 @@
 
 
 boxinfo() { # static info, show once
+    loudly `dirname $0`/xeno-config --verbose
+    loudly `dirname $0`/xeno-info
 
-    loudly ./xeno-config --verbose
-    loudly ./xeno-info
-
     loudly cat /proc/cpuinfo	# bogomips changes under CPU_FREQ
 
     # how much of the config do we want ?
-    local cmd="zgrep -E '$whatconf'"
+    local cmd="zcat | grep -E '$whatconf'"
     [ "$verbose" = 1 ] && cmd=cat
 
     if [ -f /proc/config.gz ]; then	# get the config
@@ -114,7 +130,11 @@
 	for f in /proc/xenomai/*/*; do [ -f $f ] && loudly cat $f; done
     fi
     [ -n "$prepost" ] && loudly $prepost
-    loudly top -bn1c | head -n $(( 12 + $workload ))
+    if test 0 -eq $withBusybox ; then
+	loudly top -bn1c | head -n $(( 12 + $workload ))
+    else
+	loudly top | head -n $(( 12 + $workload ))
+    fi
 }
 
 
@@ -126,15 +146,15 @@
     loudly generate_loads $workload
     boxstatus
     (
-	cd ../testsuite/latency
+        cd `dirname $0`/../testsuite/latency
 	loudly ./run --  $opts -t0
 	loudly ./run --  $opts -t1
 	loudly ./run --  $opts -t2
     )
-    (	cd ../testsuite/switch 
+    (	cd `dirname $0`/../testsuite/switch
 	loudly ./run --  '# switch'
     )
-    (	cd ../testsuite/cyclic
+    (	cd `dirname $0`/../testsuite/cyclic
 	loudly ./run -- -p 10 -n -l 1000 '# cyclictest'
     )
 
@@ -149,7 +169,7 @@
 
     # check/warn on problem configs
     
-    eval `zgrep CONFIG_CPU_FREQ /proc/config.gz`;
+    eval `zcat | grep CONFIG_CPU_FREQ /proc/config.gz`;
     if [ ! -z "$CONFIG_CPU_FREQ" ] ; then
 	echo "warning: CONFIG_CPU_FREQ=$CONFIG_CPU_FREQ may be problematic"
     fi
@@ -167,7 +187,7 @@
 logprefix=/tmp/	# someplace usually there
 prepost=	# command to run pre, and post test (ex ntpq -p)
 
-email='xenotest.output@domain.hid'	# until formalized
+email='xenomai-data@domain.hid'	
 sentby='xenotest.sender@domain.hid'
 url=
 sendit=		# send it by m-mail, u-url
@@ -175,15 +195,15 @@
 
 sendit() {
     local file=$1
-    
-    if [ "$sendit" == 'm' ]; then
+
+    if test "$sendit" = 'm' ; then
 	echo "mailing $file to $email"
-	if [ "$file" != '' ]; then
+	if test -n "$file" ; then
 	    mail -s 'xeno-test results' $email -- -F $sentby < $file
 	else
 	    cat - | mail -s 'xeno-test results' $email -- -F $sentby
 	fi
-    elif [ "$sendit" == 'u' ]; then
+    elif test "$sendit" = 'u' ; then
 	which curl && curl -T $file $url
 	# -x $proxy >/tmp/.submit_result
 	# which wget && curl -T $file $url \
@@ -263,6 +283,8 @@
     fi
 fi
 
+cleanup_load
+
 exit;
 
 

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-26 16:52   ` Niklaus Giger
@ 2006-05-27 16:42     ` Jan Kiszka
  2006-05-28 10:00       ` Niklaus Giger
  2006-06-06 20:32     ` Jim Cromie
  1 sibling, 1 reply; 13+ messages in thread
From: Jan Kiszka @ 2006-05-27 16:42 UTC (permalink / raw)
  To: niklaus.giger; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 4437 bytes --]

Niklaus Giger wrote:
>> When using this variant, I get the following messages:
>>> /bin/xeno-test: /bin/xeno-test: 177: zgrep: not found
>> What about zcat | grep instead? Moreover, I failed to find a zgrep bb
>> applet. Did you copy that stuff on your box?
> Sorry. As I had segmentation faults, my run did not get so far/or I missed 
> this error. Running it manually I confirmed your bug and the proposed 
> solution works for me, too. Integrated in the new version (attached) of the 
> patch.

Still broken:

> boxinfo() { # static info, show once
>     loudly `dirname $0`/xeno-config --verbose
>     loudly `dirname $0`/xeno-info
> 
>     loudly cat /proc/cpuinfo    # bogomips changes under CPU_FREQ
> 
>     # how much of the config do we want ?
>     local cmd="zcat | grep -E '$whatconf'"
>     [ "$verbose" = 1 ] && cmd=cat
> 
>     if [ -f /proc/config.gz ]; then     # get the config
>         loudly $cmd /proc/config.gz

Resolves to "zcat | grep -E '...' /proc/config.gz" or to "cat
/proc/config.gz". Both doesn't work. I would suggest this:

    local filter="| grep -E '$whatconf'"
    [ "$verbose" = 1 ] && filter=

    if [ -f /proc/config.gz ]; then     # get the config
        loudly zcat /proc/config.gz $filter

>     elif [ -f /lib/modules/`uname -r`/build/.config ]; then
>         loudly $cmd /lib/modules/`uname -r`/build/.config

And here we need

    loudly cat /lib/modules/`uname -r`/build/.config $filter

>     fi
> 

There is another occurrence of "zcat | grep" which needs fixing.

> 
>>> /bin/xeno-test: /bin/xeno-test: 264: getopts: not found
>> getopts is off by default in bb. Is this essential for xeno-test? Then
>> you should state this requirement somewhere.
> I checked out BusyBox 1.13, run "make defconfig", changed the cross-compiler 
> and install path. But I verified that a "make defconfig" on the 1.00 version 
> had "# CONFIG_ASH_GETOPTS is not set".
> 
> Could you try the attached patch using busybox with "CONFIG_ASH_GETOPTS=y"? 

Did so, and also awk need to be switched on. What about testing for
those features when bb was detected? Anyway, the latency tests work now
(in my qemu box). But I do not find the workload (dd?) in the process list:

root@domain.hid :/root# ps
  PID  Uid     VmSize Stat Command
    1 root        664 S   init
    2 root            SWN [ksoftirqd/0]
    3 root            SW  [watchdog/0]
    4 root            SW< [events/0]
    5 root            SW< [khelper]
    6 root            SW< [kthread]
    8 root            SW< [kblockd/0]
   41 root            SW< [gatekeeper/0]
   76 root            SW  [pdflush]
   77 root            SW  [pdflush]
   79 root            SW< [aio/0]
   78 root            SW  [kswapd0]
  663 root            SW< [kseriod]
  700 root            SW< [kpsmoused]
  787 root        212 S   dhcpcd eth0 -t 5 -h LIRE_home -I LIRE_home
  844 root       1020 S   /usr/sbin/sshd -f /etc/ssh/sshd_config
  874 root        648 S   /sbin/getty 38400 tty1
  877 root        644 S   /sbin/getty 38400 tty2
  880 root        648 S   /sbin/getty 38400 tty3
  883 root        640 S   /sbin/getty 38400 tty4
  886 root        644 S   /sbin/getty 38400 tty5
  889 root        648 S   /sbin/getty 38400 tty6
  890 root        644 S   /sbin/getty 38400 tty7
  891 root        636 S   /sbin/getty 38400 tty8
  898 root       2004 S   sshd: root@domain.hid
  902 root        820 S   -sh
  905 root        708 S   /bin/sh /bin/xeno-test
 1182 root        436 S   /bin/sh /bin/xeno-test
 1296 root       2004 S   sshd: root@domain.hid
 1300 root        884 S   -sh
 1321 root        272 S   /bin/sh /bin/xeno-test
 1322 root        632 S   /bin/sh ./run -- -q -s -T 120 -t1
 1323 root        680 S   /bin/sh //bin/xeno-load -- -q -s -T 120 -t1
 1364 root        436 S   /bin/sh //bin/xeno-load -- -q -s -T 120 -t1
 1426 root       1732 S   ./latency -q -s -T 120 -t1
 1430 root        744 R   ps

Instead I have this in the log:

[...]
Sat May 27 16:29:26 UTC 2006
running: cat /proc/ipipe/version
1.3-04

Sat May 27 16:29:26 UTC 2006
running: generate_loads 1
dummy  reaper for 1039
dd workload started, pids 1048
killing workload pids 1048
killall: dd: no process killed

Sat May 27 16:29:27 UTC 2006
running: cat /proc/interrupts
[...]

Or do I have to invoke xeno-test with some parameter (I did not pass any)?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-27 16:42     ` Jan Kiszka
@ 2006-05-28 10:00       ` Niklaus Giger
  2006-05-28 10:45         ` Jan Kiszka
  0 siblings, 1 reply; 13+ messages in thread
From: Niklaus Giger @ 2006-05-28 10:00 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 1950 bytes --]

Am Samstag, 27. Mai 2006 18:42 schrieb Jan Kiszka:
> Niklaus Giger wrote:
<..>
> Still broken:
<..>
Sorry for not catching this part, but my kernel config did not set 
CONFIG_IKCONFIG. Fixed now.
> Resolves to "zcat | grep -E '...' /proc/config.gz" or to "cat
> /proc/config.gz". Both doesn't work. I would suggest this:
>
>     local filter="| grep -E '$whatconf'"
>     [ "$verbose" = 1 ] && filter=
>
>     if [ -f /proc/config.gz ]; then     # get the config
>         loudly zcat /proc/config.gz $filter
>
> >     elif [ -f /lib/modules/`uname -r`/build/.config ]; then
> >         loudly $cmd /lib/modules/`uname -r`/build/.config
>
> And here we need
>
>     loudly cat /lib/modules/`uname -r`/build/.config $filter
>
> >     fi
Should be fixed with the attached patch
> There is another occurrence of "zcat | grep" which needs fixing.
This one too.
>
> >>> /bin/xeno-test: /bin/xeno-test: 264: getopts: not found
<..>
> Did so, and also awk need to be switched on. What about testing for
> those features when bb was detected? Anyway, the latency tests work now
> (in my qemu box). But I do not find the workload (dd?) in the process list:
Added to procedure checkUtilities and checkHelpers (after having parsed the 
options). Added them unconditionally as there might be even *nix systems 
around which are lacking coreutilities like awk, cut, curl, mail, script.

Added a "ps | grep $_j" to show whether a dd job is still running before 
killing it. Now, at least running under the busybox. the dd jobs get killed 
as they should. Therefore I added a "killall dd" for the case the dd_jobs 
variable is empty.

You should be able to xeno-test under the BusyBox without any parameter, I 
added however often a "-T 1" to make them run faster. 

Could you give this patch another try? Thanks for your patience, but the 
variability is very high as both the kernel and the busybox have a lot of 
config options.

Best regards

-- 
Niklaus Giger

[-- Attachment #2: scripts.patch --]
[-- Type: text/x-diff, Size: 12446 bytes --]

Index: scripts/xeno-config.in
===================================================================
--- scripts/xeno-config.in	(Revision 1142)
+++ scripts/xeno-config.in	(Arbeitskopie)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 
 staging=${DESTDIR}
 prefix="@prefix@"
Index: scripts/xeno-info
===================================================================
--- scripts/xeno-info	(Revision 1142)
+++ scripts/xeno-info	(Arbeitskopie)
@@ -1,31 +1,46 @@
-#!/bin/sh
+#! /bin/sh
 #
 # This file has been lifted 'as is' from linux/scripts/ver_linux.
-#
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH
 echo 'If some fields are empty or look unusual you may have an old version.'
 echo 'Compare to the current minimal requirements in Documentation/Changes.'
 echo ' '
 
+withBusybox=0
+if sh --help 2>&1| grep -q BusyBox; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+
+if test $withBusybox -eq 1; then busybox | grep -i "BusyBox v" ; fi
+
 uname -a
 echo ' '
 
+if test -n "`which gcc`" ; then
 gcc --version 2>&1| head -n 1 | grep -v gcc | awk \
 'NR==1{print "Gnu C                 ", $1}'
 
 gcc --version 2>&1| grep gcc | awk \
 'NR==1{print "Gnu C                 ", $3}'
+fi
 
+if test -n "`which gcc`" ; then
 make --version 2>&1 | awk -F, '{print $1}' | awk \
       '/GNU Make/{print "Gnu make              ",$NF}'
+fi
 
 ld -v 2>&1 | awk -F\) '{print $1}' | awk \
       '/BFD/{print "binutils              ",$NF}'
 
+if test 0 -eq $withBusybox ; then 
 fdformat --version | awk -F\- '{print "util-linux            ", $NF}'
 
 mount --version | awk -F\- '{print "mount                 ", $NF}'
+fi 
 
 depmod -V  2>&1 | awk 'NR==1 {print "module-init-tools     ",$NF}'
 
@@ -50,21 +65,26 @@
 isdnctrl 2>&1 | grep version | awk \
 'NR==1{print "isdn4k-utils          ", $NF}'
 
+if test -n "`which ldd`" ; then
 ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
 -e 's/\.so$//' | awk -F'[.-]'   '{print "Linux C Library        " \
 $(NF-2)"."$(NF-1)"."$NF}'
 
 ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n1 | awk \
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'
+fi
 
 ls -l /usr/lib/lib{g,stdc}++.so  2>/dev/null | awk -F. \
        '{print "Linux C++ Library      " $4"."$5"."$6}'
 
+if test 0 -eq $withBusybox ; then 
 ps --version 2>&1 | awk 'NR==1{print "Procps                ", $NF}'
+fi 
 
 ifconfig --version 2>&1 | grep tools | awk \
 'NR==1{print "Net-tools             ", $NF}'
 
+if test 0 -eq $withBusybox ; then 
 # Kbd needs 'loadkeys -h',
 loadkeys -h 2>&1 | awk \
 '(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'
@@ -74,6 +94,7 @@
 '(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools         ", $3}'
 
 expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'
+fi 
 
 if [ -e /proc/modules ]; then
     X=`cat /proc/modules | sed -e "s/ .*$//"`
Index: scripts/xeno-load.in
===================================================================
--- scripts/xeno-load.in	(Revision 1142)
+++ scripts/xeno-load.in	(Arbeitskopie)
@@ -1,7 +1,9 @@
-#! /bin/bash
+#! /bin/sh
 # Xenomai application loader script.
 # (Processes the .runinfo files)
 # June 2004, <rpm@xenomai.org>
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 usage='usage: xeno-load [[dir:]target]'
 prefix="@prefix@"
@@ -23,7 +25,7 @@
   shift
 fi
 
-if test "x$1" = x--; then
+if test -z "$1" || test "x$1" = x--; then
   target_dir=`pwd`
   target_name=default
 else
@@ -80,7 +82,7 @@
 
 eval $user_moddir
 
-if `$sudo $modprobe -nq xeno_nucleus >& /dev/null`; then
+if `$sudo $modprobe -nq xeno_nucleus > /dev/null 2>&1`; then
    target_deps="${target_deps}nucleus+"
 else
    target_deps=
@@ -92,8 +94,8 @@
 
 test $verbose = 1 && echo "Running $target_name from $run_info_file"
 
-if test \! "x`type -t sudo`" = x; then
-  sudo=sudo
+if test -n "`which sudo`"; then
+  sudo=`which sudo`
 fi
 
 if test \! "x$target_mesg" = x; then
@@ -161,7 +163,7 @@
 	   echo "ERROR: cannot load $xeno_moddir/xeno_$mod$modext"
 	   break
         fi
-     elif `$sudo $modprobe -n xeno_$mod >& /dev/null`; then
+     elif `$sudo $modprobe -n xeno_$mod > /dev/null 2>&1`; then
         test $verbose = 1 && echo "+ $modprobe xeno_$mod"
         $sudo $modprobe xeno_$mod
         inslist="xeno_$mod $inslist"
Index: scripts/xeno-test.in
===================================================================
--- scripts/xeno-test.in	(Revision 1142)
+++ scripts/xeno-test.in	(Arbeitskopie)
@@ -1,4 +1,7 @@
-#!/bin/bash
+#! /bin/sh
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-test 
+# A BusyBox >= 1.1.3 with a make defconfig should provide all needed applets.
 
 myusage() {
     cat >&1 <<EOF
@@ -19,7 +22,7 @@
 		name can be full or relative pathname
   -v		verbose
   -M <email>	sends output to given addr
-  -m		sends output to xenotest.output@domain.hid
+  -m		sends output to xenomai-data@domain.hid
   -U <url>	uploads output to given URL
 	
   # following options are passed thru to latency
@@ -40,6 +43,46 @@
 
 set -o notify	# see dd's finish immediately.(or not!)
 
+withBusybox=0
+if sh --help 2>&1| grep -q BusyBox; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+echo withBusybox is $withBusybox
+
+checkUtilities() {
+  # Check for needed helper utilities
+  local neededApplets="awk basename cut date dd dirname egrep grep
+		       getopt head kill mount sleep test top uname zcat"
+  local foundAll=1
+  for  _j in $neededApplets
+  do
+    if test -z `which $_j`; then
+      echo "Please build busybox with support for applet $_j"
+      foundAll=0
+    fi
+  done
+  if test $foundAll -eq 0 ; then exit 3 ; fi
+}
+
+checkHelpers() {
+  local foundAll=1
+  if test -z "`which script`" -a -n "$logging"; then
+      echo "You will not be able to log (-L option) as script is missing"
+      foundAll=0
+  fi
+  if test -z "`which mail`" -a "$sendit" = 'm' ; then
+      echo "You will not be able send mail (-m/-M options) as mail is missing"
+      foundAll=0
+  fi
+  if test -z "`which curl`" -a "$sendit" = 'm' ; then
+  # if test -z `which curl` -a "$sendit" = 'u' ; then
+      echo "You will not be able to upload (-U option) as curl is missing"
+      foundAll=0
+  fi
+  if test $foundAll -eq 0 ; then exit 3 ; fi
+}
+
 loudly() {
     [ "$1" = "" ] && return
     # run task after announcing it
@@ -51,31 +94,46 @@
 
 # defaults for cpu workload 
 device=/dev/zero	
-typeset -a dd_jobs
-dd_jobs=()
+dd_jobs=
 
 # used in generate-loads
-mkload() { exec dd if=$device of=/dev/null $* ; }
+mkload() { 
+    dd if=$device of=/dev/null $* &
+}
 
 generate_loads() {
-    local jobsct=$1; shift;
+    local jobsct=$1; 
+    # if test -z "$1"; then echo Skipping generate_loads; return; fi
+    shift 1
+    if test 0 -eq $withBusybox ; then
+	reaper() { echo something died a $! or $* ; sleep 1;  }
+	trap reaper CHLD
+    fi
+    trap cleanup_load EXIT	# under all exit conditions
 
-    reaper() { echo something died $*; }
-    trap reaper CHLD
-    trap cleanup_load EXIT	# under all exit conditions
-    
-    for (( ; $jobsct ; jobsct-- )) ; do
-	mkload &
-	dd_jobs[${#dd_jobs[*]}]=$!
+    for _j in $jobsct ; do
+	mkload
+	dd_jobs="$dd_jobs $!"
+	break
     done;
 
-    echo dd workload started, pids ${dd_jobs[*]}
+    echo dd workload started, pids $dd_jobs
 }
 
 cleanup_load() {
     # kill the workload
-    echo killing workload pids ${dd_jobs[*]}
-    kill ${dd_jobs[*]};
+    echo killing workload pids $dd_jobs
+    if test -z $dd_jobs ; then
+        echo "no dd_jobs found, calling killall dd"
+        killall dd
+    else
+	for _j in $dd_jobs
+	do
+	  ps | grep $_j
+	  echo kill workload pid $_j
+	  kill $_j
+	done
+    fi
     unset dd_jobs;
 }
 
@@ -83,20 +141,19 @@
 
 
 boxinfo() { # static info, show once
+    loudly `dirname $0`/xeno-config --verbose
+    loudly `dirname $0`/xeno-info
 
-    loudly ./xeno-config --verbose
-    loudly ./xeno-info
-
     loudly cat /proc/cpuinfo	# bogomips changes under CPU_FREQ
 
     # how much of the config do we want ?
-    local cmd="zgrep -E '$whatconf'"
-    [ "$verbose" = 1 ] && cmd=cat
-
-    if [ -f /proc/config.gz ]; then	# get the config
-	loudly $cmd /proc/config.gz
-    elif [ -f /lib/modules/`uname -r`/build/.config ]; then
-	loudly $cmd /lib/modules/`uname -r`/build/.config
+    local filter=" grep -E '$whatconf'"
+    [ "$verbose" = 1 ] && filter=
+    if test -f /proc/config.gz; then     # get the config
+         loudly zcat /proc/config.gz | $filter
+    elif test -f /lib/modules/`uname -r`/build/.config
+    then
+	loudly cat /lib/modules/`uname -r`/build/.config | $filter
     fi
 
     [ -d /proc/adeos ] && for f in /proc/adeos/*; do loudly cat $f; done
@@ -104,7 +161,6 @@
 }
 
 boxstatus() {     # get dynamic status
-
     loudly cat /proc/interrupts
     loudly cat /proc/loadavg
     loudly cat /proc/meminfo
@@ -114,7 +170,11 @@
 	for f in /proc/xenomai/*/*; do [ -f $f ] && loudly cat $f; done
     fi
     [ -n "$prepost" ] && loudly $prepost
-    loudly top -bn1c | head -n $(( 12 + $workload ))
+    if test 0 -eq $withBusybox ; then
+	loudly top -bn1c | head -n $(( 12 + $workload ))
+    else
+	loudly top | head -n $(( 12 + $workload ))
+    fi
 }
 
 
@@ -126,36 +186,36 @@
     loudly generate_loads $workload
     boxstatus
     (
-	cd ../testsuite/latency
+        cd `dirname $0`/../testsuite/latency
 	loudly ./run --  $opts -t0
 	loudly ./run --  $opts -t1
 	loudly ./run --  $opts -t2
     )
-    (	cd ../testsuite/switch 
+    (	cd `dirname $0`/../testsuite/switch
 	loudly ./run --  '# switch'
     )
-    (	cd ../testsuite/cyclic
+    (	cd `dirname $0`/../testsuite/cyclic
 	loudly ./run -- -p 10 -n -l 1000 '# cyclictest'
     )
 
     boxstatus
 }
 
-
 #####################
 # MAIN
+# echo will call checkHelpers
+# checkUtilities
 
 if [ -f /proc/config.gz ] ; then
 
     # check/warn on problem configs
-    
-    eval `zgrep CONFIG_CPU_FREQ /proc/config.gz`;
+    eval `zcat /proc/config.gz | grep CONFIG_CPU_FREQ` ;
     if [ ! -z "$CONFIG_CPU_FREQ" ] ; then
 	echo "warning: CONFIG_CPU_FREQ=$CONFIG_CPU_FREQ may be problematic"
     fi
-
 fi
 
+
 workload=1	# default = 1 job
 
 # *pass get all legit options, except -N, -L
@@ -167,7 +227,7 @@
 logprefix=/tmp/	# someplace usually there
 prepost=	# command to run pre, and post test (ex ntpq -p)
 
-email='xenotest.output@domain.hid'	# until formalized
+email='xenomai-data@domain.hid
 sentby='xenotest.sender@domain.hid'
 url=
 sendit=		# send it by m-mail, u-url
@@ -175,15 +235,15 @@
 
 sendit() {
     local file=$1
-    
-    if [ "$sendit" == 'm' ]; then
+
+    if test "$sendit" = 'm' ; then
 	echo "mailing $file to $email"
-	if [ "$file" != '' ]; then
+	if test -n "$file" ; then
 	    mail -s 'xeno-test results' $email -- -F $sentby < $file
 	else
 	    cat - | mail -s 'xeno-test results' $email -- -F $sentby
 	fi
-    elif [ "$sendit" == 'u' ]; then
+    elif test "$sendit" = 'u' ; then
 	which curl && curl -T $file $url
 	# -x $proxy >/tmp/.submit_result
 	# which wget && curl -T $file $url \
@@ -243,10 +303,11 @@
     esac
 done
 
+checkHelpers
+
 # all args have been handled, and split into 2 passthrus
 shift $(($OPTIND - 1));
 
-
 if [ "$logging" != "" ]; then
     # restart inside a script invocation, passing appropriate args
     wfile=$logprefix$logfile-`date +%y%m%d.%H%M%S`
@@ -263,6 +324,8 @@
     fi
 fi
 
+cleanup_load
+
 exit;
 
 
@@ -302,8 +365,12 @@
 xeno-test -L
 xeno-test -N foo -T 18 -l 6 -s
 xeno-test -L -N foo1-
+xeno-test -m
+xeno-test -T 1 -M $USER@localhost
 xeno-test -N foo0 -w0 -l 5 -T 30 -h
 xeno-test -L -N foo4- -w4
 xeno-test -L -N foo4W- -w4 -W 'dd if=/dev/hda1 of=/dev/null'
 
-3.
+3. Repeat the same tests under the BusyBox.
+
+4. Check for border cases like missing awk, curl, mail, script, /proc/config.gz

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-28 10:00       ` Niklaus Giger
@ 2006-05-28 10:45         ` Jan Kiszka
  2006-05-28 14:41           ` Niklaus Giger
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Kiszka @ 2006-05-28 10:45 UTC (permalink / raw)
  To: niklaus.giger; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 3465 bytes --]

Niklaus Giger wrote:
> Am Samstag, 27. Mai 2006 18:42 schrieb Jan Kiszka:
>> Niklaus Giger wrote:
> <..>
>> Still broken:
> <..>
> Sorry for not catching this part, but my kernel config did not set 
> CONFIG_IKCONFIG. Fixed now.
>> Resolves to "zcat | grep -E '...' /proc/config.gz" or to "cat
>> /proc/config.gz". Both doesn't work. I would suggest this:
>>
>>     local filter="| grep -E '$whatconf'"
>>     [ "$verbose" = 1 ] && filter=
>>
>>     if [ -f /proc/config.gz ]; then     # get the config
>>         loudly zcat /proc/config.gz $filter
>>
>>>     elif [ -f /lib/modules/`uname -r`/build/.config ]; then
>>>         loudly $cmd /lib/modules/`uname -r`/build/.config
>> And here we need
>>
>>     loudly cat /lib/modules/`uname -r`/build/.config $filter
>>
>>>     fi
> Should be fixed with the attached patch
>> There is another occurrence of "zcat | grep" which needs fixing.
> This one too.
>>>>> /bin/xeno-test: /bin/xeno-test: 264: getopts: not found
> <..>
>> Did so, and also awk need to be switched on. What about testing for
>> those features when bb was detected? Anyway, the latency tests work now
>> (in my qemu box). But I do not find the workload (dd?) in the process list:
> Added to procedure checkUtilities and checkHelpers (after having parsed the 
> options). Added them unconditionally as there might be even *nix systems 
> around which are lacking coreutilities like awk, cut, curl, mail, script.
> 
> Added a "ps | grep $_j" to show whether a dd job is still running before 
> killing it. Now, at least running under the busybox. the dd jobs get killed 
> as they should. Therefore I added a "killall dd" for the case the dd_jobs 
> variable is empty.

But there is still no load during the tests, correct?

> 
> You should be able to xeno-test under the BusyBox without any parameter, I 
> added however often a "-T 1" to make them run faster. 
> 
> Could you give this patch another try? Thanks for your patience, but the 
> variability is very high as both the kernel and the busybox have a lot of 
> config options.

Yeah, I know. Therefore it takes someone looking at it from different
perspectives. :)

Basically works now, but I found two oddities:

- special characters in line 152 of xeno-test:

> @@ -83,20 +141,19 @@
>
>
>  boxinfo() { # static info, show once
> +    loudly `dirname $0`/xeno-config --verbose
> +    loudly `dirname $0`/xeno-info
>
> -    loudly ./xeno-config --verbose
> -    loudly ./xeno-info
> -
>      loudly cat /proc/cpuinfo	# bogomips changes under CPU_FREQ
>
>      # how much of the config do we want ?
> -    local cmd="zgrep -E '$whatconf'"
> -    [ "$verbose" = 1 ] && cmd=cat
> -
> -    if [ -f /proc/config.gz ]; then	# get the config
> -	loudly $cmd /proc/config.gz
> -    elif [ -f /lib/modules/`uname -r`/build/.config ]; then
> -	loudly $cmd /lib/modules/`uname -r`/build/.config
> +    local filter=" grep -E '$whatconf'"
> +    [ "$verbose" = 1 ] && filter=
> +    if test -f /proc/config.gz; then     # get the config
                                        ^^^^

- the output of xeno-test contains this error:

running: cat /proc/cpuinfo
processor       : 0
[...]
bogomips        : 2628.76

/bin/xeno-test: /bin/xeno-test: 325:  : not found
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
CONFIG_PREEMPT_BKL=y
CONFIG_IPIPE=y

???

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-28 10:45         ` Jan Kiszka
@ 2006-05-28 14:41           ` Niklaus Giger
  2006-05-29 11:40             ` Jan Kiszka
  0 siblings, 1 reply; 13+ messages in thread
From: Niklaus Giger @ 2006-05-28 14:41 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]

Am Sonntag, 28. Mai 2006 12:45 schrieb Jan Kiszka:
> Niklaus Giger wrote:
> > Am Samstag, 27. Mai 2006 18:42 schrieb Jan Kiszka:
<..>
> > Added a "ps | grep $_j" to show whether a dd job is still running before
> > killing it. Now, at least running under the busybox. the dd jobs get
> > killed as they should. Therefore I added a "killall dd" for the case the
> > dd_jobs variable is empty.
>
> But there is still no load during the tests, correct?
Yes. But now it should. The dd_jobs got killed too early, as under the BusyBox 
the trap exit handler got called too early. I think there are some subtle 
differences between the trap of the BusyBox- and the Bash-shell.

Now I store the pids in a file under /var/lock. Tested it under bash and 
busybox, works okay for me. 

Options like "-4-W 'dd if=/dev/hda1 of=/dev/null'" should also be handled 
correctly.

Options -L -m -M not tested under the BusyBox PPC405 target, as there I do not 
have access to curl, script and mail.

<..>
> - special characters in line 152 of xeno-test:
Sorry. Corrected. I think kate did not handle a paste from your e-mail message 
correctly
<..>
> - the output of xeno-test contains this error:
<..>
> /bin/xeno-test: /bin/xeno-test: 325:  : not found
May be the result of above error? Could not reproduce it here. Could try again 
the attached patch?

Thanks a lot again.

Best regards

-- 
Niklaus Giger

[-- Attachment #2: scripts.patch --]
[-- Type: text/x-diff, Size: 12217 bytes --]

Index: scripts/xeno-config.in
===================================================================
--- scripts/xeno-config.in	(Revision 1142)
+++ scripts/xeno-config.in	(Arbeitskopie)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 
 staging=${DESTDIR}
 prefix="@prefix@"
Index: scripts/xeno-info
===================================================================
--- scripts/xeno-info	(Revision 1142)
+++ scripts/xeno-info	(Arbeitskopie)
@@ -1,31 +1,46 @@
-#!/bin/sh
+#! /bin/sh
 #
 # This file has been lifted 'as is' from linux/scripts/ver_linux.
-#
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH
 echo 'If some fields are empty or look unusual you may have an old version.'
 echo 'Compare to the current minimal requirements in Documentation/Changes.'
 echo ' '
 
+withBusybox=0
+if sh --help 2>&1| grep -q BusyBox; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+
+if test $withBusybox -eq 1; then busybox | grep -i "BusyBox v" ; fi
+
 uname -a
 echo ' '
 
+if test -n "`which gcc`" ; then
 gcc --version 2>&1| head -n 1 | grep -v gcc | awk \
 'NR==1{print "Gnu C                 ", $1}'
 
 gcc --version 2>&1| grep gcc | awk \
 'NR==1{print "Gnu C                 ", $3}'
+fi
 
+if test -n "`which gcc`" ; then
 make --version 2>&1 | awk -F, '{print $1}' | awk \
       '/GNU Make/{print "Gnu make              ",$NF}'
+fi
 
 ld -v 2>&1 | awk -F\) '{print $1}' | awk \
       '/BFD/{print "binutils              ",$NF}'
 
+if test 0 -eq $withBusybox ; then 
 fdformat --version | awk -F\- '{print "util-linux            ", $NF}'
 
 mount --version | awk -F\- '{print "mount                 ", $NF}'
+fi 
 
 depmod -V  2>&1 | awk 'NR==1 {print "module-init-tools     ",$NF}'
 
@@ -50,21 +65,26 @@
 isdnctrl 2>&1 | grep version | awk \
 'NR==1{print "isdn4k-utils          ", $NF}'
 
+if test -n "`which ldd`" ; then
 ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
 -e 's/\.so$//' | awk -F'[.-]'   '{print "Linux C Library        " \
 $(NF-2)"."$(NF-1)"."$NF}'
 
 ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n1 | awk \
 'NR==1{print "Dynamic linker (ldd)  ", $NF}'
+fi
 
 ls -l /usr/lib/lib{g,stdc}++.so  2>/dev/null | awk -F. \
        '{print "Linux C++ Library      " $4"."$5"."$6}'
 
+if test 0 -eq $withBusybox ; then 
 ps --version 2>&1 | awk 'NR==1{print "Procps                ", $NF}'
+fi 
 
 ifconfig --version 2>&1 | grep tools | awk \
 'NR==1{print "Net-tools             ", $NF}'
 
+if test 0 -eq $withBusybox ; then 
 # Kbd needs 'loadkeys -h',
 loadkeys -h 2>&1 | awk \
 '(NR==1 && ($3 !~ /option/)) {print "Kbd                   ", $3}'
@@ -74,6 +94,7 @@
 '(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools         ", $3}'
 
 expr --v 2>&1 | awk 'NR==1{print "Sh-utils              ", $NF}'
+fi 
 
 if [ -e /proc/modules ]; then
     X=`cat /proc/modules | sed -e "s/ .*$//"`
Index: scripts/xeno-load.in
===================================================================
--- scripts/xeno-load.in	(Revision 1142)
+++ scripts/xeno-load.in	(Arbeitskopie)
@@ -1,7 +1,9 @@
-#! /bin/bash
+#! /bin/sh
 # Xenomai application loader script.
 # (Processes the .runinfo files)
 # June 2004, <rpm@xenomai.org>
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-info 
 
 usage='usage: xeno-load [[dir:]target]'
 prefix="@prefix@"
@@ -23,7 +25,7 @@
   shift
 fi
 
-if test "x$1" = x--; then
+if test -z "$1" || test "x$1" = x--; then
   target_dir=`pwd`
   target_name=default
 else
@@ -80,7 +82,7 @@
 
 eval $user_moddir
 
-if `$sudo $modprobe -nq xeno_nucleus >& /dev/null`; then
+if `$sudo $modprobe -nq xeno_nucleus > /dev/null 2>&1`; then
    target_deps="${target_deps}nucleus+"
 else
    target_deps=
@@ -92,8 +94,8 @@
 
 test $verbose = 1 && echo "Running $target_name from $run_info_file"
 
-if test \! "x`type -t sudo`" = x; then
-  sudo=sudo
+if test -n "`which sudo`"; then
+  sudo=`which sudo`
 fi
 
 if test \! "x$target_mesg" = x; then
@@ -161,7 +163,7 @@
 	   echo "ERROR: cannot load $xeno_moddir/xeno_$mod$modext"
 	   break
         fi
-     elif `$sudo $modprobe -n xeno_$mod >& /dev/null`; then
+     elif `$sudo $modprobe -n xeno_$mod > /dev/null 2>&1`; then
         test $verbose = 1 && echo "+ $modprobe xeno_$mod"
         $sudo $modprobe xeno_$mod
         inslist="xeno_$mod $inslist"
Index: scripts/xeno-test.in
===================================================================
--- scripts/xeno-test.in	(Revision 1142)
+++ scripts/xeno-test.in	(Arbeitskopie)
@@ -1,5 +1,7 @@
-#!/bin/bash
-
+#! /bin/sh
+# Adapted to be run also under the BusyBox. If you want to test it under the BusyBox use
+# busybox sh xeno-test 
+# A BusyBox >= 1.1.3 with a make defconfig should provide all needed applets.
 myusage() {
     cat >&1 <<EOF
 xeno-test [options]
@@ -19,7 +21,7 @@
 		name can be full or relative pathname
   -v		verbose
   -M <email>	sends output to given addr
-  -m		sends output to xenotest.output@domain.hid
+  -m		sends output to xenomai-data@domain.hid
   -U <url>	uploads output to given URL
 	
   # following options are passed thru to latency
@@ -40,6 +42,46 @@
 
 set -o notify	# see dd's finish immediately.(or not!)
 
+withBusybox=0
+if sh --help 2>&1| grep -q BusyBox; then
+    withBusybox=1;
+# else running a real /bin/sh (bash) shell
+fi
+echo withBusybox is $withBusybox
+pidFile=/var/lock/`basename $0`.pids
+
+checkUtilities() {
+  # Check for needed helper utilities
+  local neededApplets="awk basename cut date dd dirname egrep grep
+		       getopt head kill mount sleep test top uname zcat"
+  local foundAll=1
+  for  _j in $neededApplets
+  do
+    if test -z "`which $_j`"; then
+      echo "Please build busybox with support for applet $_j"
+      foundAll=0
+    fi
+  done
+  if test $foundAll -eq 0 ; then exit 3 ; fi
+}
+
+checkHelpers() {
+  local foundAll=1
+  if test -z "`which script`" -a -n "$logging"; then
+      echo "You will not be able to log (-L option) as script is missing"
+      foundAll=0
+  fi
+  if test -z "`which mail`" -a "$sendit" = 'm' ; then
+      echo "You will not be able send mail (-m/-M options) as mail is missing"
+      foundAll=0
+  fi
+  if test -z "`which curl`" -a "$sendit" = 'm' ; then
+      echo "You will not be able to upload (-U option) as curl is missing"
+      foundAll=0
+  fi
+  if test $foundAll -eq 0 ; then exit 3 ; fi
+}
+
 loudly() {
     [ "$1" = "" ] && return
     # run task after announcing it
@@ -51,31 +93,49 @@
 
 # defaults for cpu workload 
 device=/dev/zero	
-typeset -a dd_jobs
-dd_jobs=()
+dd_jobs=
 
 # used in generate-loads
-mkload() { exec dd if=$device of=/dev/null $* ; }
+mkload() { dd if=$device of=/dev/null $* & }
 
 generate_loads() {
-    local jobsct=$1; shift;
+    local jobsct=$1; 
+    # if test -z "$1"; then echo Skipping generate_loads; return; fi
+    shift 1
+    if test 0 -eq $withBusybox ; then
+	reaper() { echo something died a $! or $* ; sleep 1;  }
+	trap reaper CHLD
+	trap cleanup_load EXIT	# under all exit conditions
+    fi
+    while test $jobsct -ge 1; do 
+        jobsct=$((jobsct-1)); 
+        mkload
+        dd_jobs="$dd_jobs $!" ;
+    done
 
-    reaper() { echo something died $*; }
-    trap reaper CHLD
-    trap cleanup_load EXIT	# under all exit conditions
-    
-    for (( ; $jobsct ; jobsct-- )) ; do
-	mkload &
-	dd_jobs[${#dd_jobs[*]}]=$!
-    done;
-
-    echo dd workload started, pids ${dd_jobs[*]}
+    echo dd workload started, pids $dd_jobs stored in $pidFile
+    echo  $dd_jobs > $pidFile
 }
 
 cleanup_load() {
     # kill the workload
-    echo killing workload pids ${dd_jobs[*]}
-    kill ${dd_jobs[*]};
+    echo killing workload pids $dd_jobs pidFile $pidFile
+    if test -z "$dd_jobs" -a -r $pidFile; then
+      dd_jobs=`cat $pidFile`
+      # echo Read pids from file $pidFile, now $dd_jobs
+      rm -f $pidFile
+    fi
+
+    if test -z "$dd_jobs" ; then
+        echo "no dd_jobs found"
+    else
+	for _j in $dd_jobs
+	do
+	  ps | grep $_j
+	  echo kill workload pid $_j
+	  kill $_j
+	done
+    fi
     unset dd_jobs;
 }
 
@@ -83,20 +143,19 @@
 
 
 boxinfo() { # static info, show once
+    loudly `dirname $0`/xeno-config --verbose
+    loudly `dirname $0`/xeno-info
 
-    loudly ./xeno-config --verbose
-    loudly ./xeno-info
-
     loudly cat /proc/cpuinfo	# bogomips changes under CPU_FREQ
 
     # how much of the config do we want ?
-    local cmd="zgrep -E '$whatconf'"
-    [ "$verbose" = 1 ] && cmd=cat
-
-    if [ -f /proc/config.gz ]; then	# get the config
-	loudly $cmd /proc/config.gz
-    elif [ -f /lib/modules/`uname -r`/build/.config ]; then
-	loudly $cmd /lib/modules/`uname -r`/build/.config
+    local filter=" grep -E '$whatconf'"
+    [ "$verbose" = 1 ] && filter=
+    if test -f /proc/config.gz; then # get the config
+         loudly zcat /proc/config.gz | $filter
+    elif test -f /lib/modules/`uname -r`/build/.config
+    then
+	loudly cat /lib/modules/`uname -r`/build/.config | $filter
     fi
 
     [ -d /proc/adeos ] && for f in /proc/adeos/*; do loudly cat $f; done
@@ -104,7 +163,6 @@
 }
 
 boxstatus() {     # get dynamic status
-
     loudly cat /proc/interrupts
     loudly cat /proc/loadavg
     loudly cat /proc/meminfo
@@ -114,7 +172,11 @@
 	for f in /proc/xenomai/*/*; do [ -f $f ] && loudly cat $f; done
     fi
     [ -n "$prepost" ] && loudly $prepost
-    loudly top -bn1c | head -n $(( 12 + $workload ))
+    if test 0 -eq $withBusybox ; then
+	loudly top -bn1c | head -n $(( 12 + $workload ))
+    else
+	loudly top | head -n $(( 12 + $workload ))
+    fi
 }
 
 
@@ -126,36 +188,35 @@
     loudly generate_loads $workload
     boxstatus
     (
-	cd ../testsuite/latency
+        cd `dirname $0`/../testsuite/latency
 	loudly ./run --  $opts -t0
 	loudly ./run --  $opts -t1
 	loudly ./run --  $opts -t2
     )
-    (	cd ../testsuite/switch 
+    (	cd `dirname $0`/../testsuite/switch
 	loudly ./run --  '# switch'
     )
-    (	cd ../testsuite/cyclic
+    (	cd `dirname $0`/../testsuite/cyclic
 	loudly ./run -- -p 10 -n -l 1000 '# cyclictest'
     )
 
     boxstatus
 }
 
-
 #####################
 # MAIN
+checkUtilities
 
 if [ -f /proc/config.gz ] ; then
 
     # check/warn on problem configs
-    
-    eval `zgrep CONFIG_CPU_FREQ /proc/config.gz`;
+    eval `zcat /proc/config.gz | grep CONFIG_CPU_FREQ` ;
     if [ ! -z "$CONFIG_CPU_FREQ" ] ; then
 	echo "warning: CONFIG_CPU_FREQ=$CONFIG_CPU_FREQ may be problematic"
     fi
-
 fi
 
+
 workload=1	# default = 1 job
 
 # *pass get all legit options, except -N, -L
@@ -167,7 +228,7 @@
 logprefix=/tmp/	# someplace usually there
 prepost=	# command to run pre, and post test (ex ntpq -p)
 
-email='xenotest.output@domain.hid'	# until formalized
+email='xenomai-data@domain.hid'	
 sentby='xenotest.sender@domain.hid'
 url=
 sendit=		# send it by m-mail, u-url
@@ -175,15 +236,15 @@
 
 sendit() {
     local file=$1
-    
-    if [ "$sendit" == 'm' ]; then
+
+    if test "$sendit" = 'm' ; then
 	echo "mailing $file to $email"
-	if [ "$file" != '' ]; then
+	if test -n "$file" ; then
 	    mail -s 'xeno-test results' $email -- -F $sentby < $file
 	else
 	    cat - | mail -s 'xeno-test results' $email -- -F $sentby
 	fi
-    elif [ "$sendit" == 'u' ]; then
+    elif test "$sendit" = 'u' ; then
 	which curl && curl -T $file $url
 	# -x $proxy >/tmp/.submit_result
 	# which wget && curl -T $file $url \
@@ -243,10 +304,11 @@
     esac
 done
 
+checkHelpers
+
 # all args have been handled, and split into 2 passthrus
 shift $(($OPTIND - 1));
 
-
 if [ "$logging" != "" ]; then
     # restart inside a script invocation, passing appropriate args
     wfile=$logprefix$logfile-`date +%y%m%d.%H%M%S`
@@ -263,6 +325,8 @@
     fi
 fi
 
+cleanup_load
+
 exit;
 
 
@@ -302,8 +366,12 @@
 xeno-test -L
 xeno-test -N foo -T 18 -l 6 -s
 xeno-test -L -N foo1-
+xeno-test -m
+xeno-test -T 1 -M $USER@localhost
 xeno-test -N foo0 -w0 -l 5 -T 30 -h
 xeno-test -L -N foo4- -w4
 xeno-test -L -N foo4W- -w4 -W 'dd if=/dev/hda1 of=/dev/null'
 
-3.
+3. Repeat the same tests under the BusyBox.
+
+4. Check for border cases like missing awk, curl, mail, script, /proc/config.gz

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-28 14:41           ` Niklaus Giger
@ 2006-05-29 11:40             ` Jan Kiszka
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Kiszka @ 2006-05-29 11:40 UTC (permalink / raw)
  To: niklaus.giger; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2058 bytes --]

Niklaus Giger wrote:
> Am Sonntag, 28. Mai 2006 12:45 schrieb Jan Kiszka:
>> Niklaus Giger wrote:
>>> Am Samstag, 27. Mai 2006 18:42 schrieb Jan Kiszka:
> <..>
>>> Added a "ps | grep $_j" to show whether a dd job is still running before
>>> killing it. Now, at least running under the busybox. the dd jobs get
>>> killed as they should. Therefore I added a "killall dd" for the case the
>>> dd_jobs variable is empty.
>> But there is still no load during the tests, correct?
> Yes. But now it should. The dd_jobs got killed too early, as under the BusyBox 
> the trap exit handler got called too early. I think there are some subtle 
> differences between the trap of the BusyBox- and the Bash-shell.
> 
> Now I store the pids in a file under /var/lock. Tested it under bash and 
> busybox, works okay for me. 
> 
> Options like "-4-W 'dd if=/dev/hda1 of=/dev/null'" should also be handled 
> correctly.

Default workload behaves as expected now, but specifying something
different here via -W let the script hang on the workload startup.

> 
> Options -L -m -M not tested under the BusyBox PPC405 target, as there I do not 
> have access to curl, script and mail.
> 
> <..>
>> - special characters in line 152 of xeno-test:
> Sorry. Corrected. I think kate did not handle a paste from your e-mail message 
> correctly
> <..>
>> - the output of xeno-test contains this error:
> <..>
>> /bin/xeno-test: /bin/xeno-test: 325:  : not found
> May be the result of above error? Could not reproduce it here. Could try again 
> the attached patch?

Basically, it runs fine. But I have two further suggestions:

o some kind of summary of the completed rt-tests on script termination.
  I know what to lock for in the logs, but will the newbie do so?

o a switch to control the test periods. I'm playing with a patch to
  control the aperiodic timer resolution. When I tune it to 1 ms e.g.,
  having an option to push the test tool periods at this level as well
  would be nice.

Thanks a lot for your effort!

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-05-26 16:52   ` Niklaus Giger
  2006-05-27 16:42     ` Jan Kiszka
@ 2006-06-06 20:32     ` Jim Cromie
  2006-06-12 20:33       ` Jan Kiszka
  1 sibling, 1 reply; 13+ messages in thread
From: Jim Cromie @ 2006-06-06 20:32 UTC (permalink / raw)
  To: niklaus.giger; +Cc: Jan Kiszka, xenomai

Niklaus Giger wrote:
> Am Freitag, 26. Mai 2006 15:52 schrieb Jan Kiszka:
>   
>> Niklaus Giger wrote:    ...
>> If anybody has a working target with a Xenomai + BusyBox combination and
>> would be willing to test drive my changes, I would appreciate a feedback
>> enormously.
>>   

I hope this isnt waiting on my 'approval'.
I think its a great idea, and has been on my (way too stagnant) list for 
a while.
Your work has at least urged me to install busybox on my xeno-box. ;-)

My only concern is whether we've sufficiently distinguished the issues:

1 - ash vs bash

Its not entirely clear to me which flavors of sh busybox has:
     ash / dash / not-bash
I gather u worked with ash, and it seems most valuable sh features
work there just fine ( shell-functions, even 'job-control' of a fashion)

2 - busybox 'executables' only

I coded in a lot of 'full linux' gimme's, like zgrep, script, etc.
Niklaus has repaired many of these.  I think a more thorough cleanup is 
possible,
esp if things like 'script' are jettisoned for a simpler shell-functions 
or helper scripts.
This all implies a re-write, which is on my list...
 (esp the job-control testing and repair)


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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-06-06 20:32     ` Jim Cromie
@ 2006-06-12 20:33       ` Jan Kiszka
  2006-06-12 21:23         ` [Xenomai-core] " Niklaus Giger
       [not found]         ` <448DD841.1040906@domain.hid>
  0 siblings, 2 replies; 13+ messages in thread
From: Jan Kiszka @ 2006-06-12 20:33 UTC (permalink / raw)
  To: Jim Cromie; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

Jim Cromie wrote:
> Niklaus Giger wrote:
>> Am Freitag, 26. Mai 2006 15:52 schrieb Jan Kiszka:
>>  
>>> Niklaus Giger wrote:    ...
>>> If anybody has a working target with a Xenomai + BusyBox combination and
>>> would be willing to test drive my changes, I would appreciate a feedback
>>> enormously.
>>>   
> 
> I hope this isnt waiting on my 'approval'.
> I think its a great idea, and has been on my (way too stagnant) list for
> a while.
> Your work has at least urged me to install busybox on my xeno-box. ;-)
> 
> My only concern is whether we've sufficiently distinguished the issues:
> 
> 1 - ash vs bash
> 
> Its not entirely clear to me which flavors of sh busybox has:
>     ash / dash / not-bash
> I gather u worked with ash, and it seems most valuable sh features
> work there just fine ( shell-functions, even 'job-control' of a fashion)
> 
> 2 - busybox 'executables' only
> 
> I coded in a lot of 'full linux' gimme's, like zgrep, script, etc.
> Niklaus has repaired many of these.  I think a more thorough cleanup is
> possible,
> esp if things like 'script' are jettisoned for a simpler shell-functions
> or helper scripts.
> This all implies a re-write, which is on my list...
> (esp the job-control testing and repair)

Just stumbled over this again while cleaning up my mailbox. What's the
status? Waiting for improvements, or waiting for /someone/ to type svn
ci (and improve the topics above later)?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

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

* [Xenomai-core] Re: Porting xeno-{info|load|test} to a busybox system
  2006-06-12 20:33       ` Jan Kiszka
@ 2006-06-12 21:23         ` Niklaus Giger
       [not found]         ` <448DD841.1040906@domain.hid>
  1 sibling, 0 replies; 13+ messages in thread
From: Niklaus Giger @ 2006-06-12 21:23 UTC (permalink / raw)
  To: xenomai

Jan Kiszka wrote:
<..> 
> Just stumbled over this again while cleaning up my mailbox. What's the
> status? Waiting for improvements, or waiting for /someone/ to type svn
> ci (and improve the topics above later)?

Yes and no. As I told there is no urgent need to apply this before 2.2.
And improvement/more insight into the whole busybox would be a great idea.

I am busy preparing the next step for the whole xeno-test/buildbot
infrastructure, which will feature:
- Small additions to my patch for xeno-test (done)
- Buildbot will run automatically xeno-test on my PPC405 board as the last
  build step (done). But it will at the moment only show, that there are
  problems with my PPC405 target (see a separat thread).
- Documentation rework (mostly done)
- Adding a test script to test xeno-test (may be a overkill, but xeno-test
  accumulated a lot of options, and I like unit test).

As nobody committed my patch, I will be much more confident to propose a
patch as soon as the unit tests for xeno-test work.

Best regards
---

Niklaus Giger



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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
       [not found]         ` <448DD841.1040906@domain.hid>
@ 2006-06-14 19:01           ` Jim Cromie
  2006-06-15 15:01             ` Philippe Gerum
  0 siblings, 1 reply; 13+ messages in thread
From: Jim Cromie @ 2006-06-14 19:01 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Jan Kiszka, xenomai

Philippe Gerum wrote:
> Jan Kiszka wrote:
>> Jim Cromie wrote:
>>
>>> Niklaus Giger wrote:
>>>
>>>> Am Freitag, 26. Mai 2006 15:52 schrieb Jan Kiszka:
>>>>
>>>>
>>>>> Niklaus Giger wrote:    ...
>>>>> If anybody has a working target with a Xenomai + BusyBox 
>>>>> combination and
>>>>> would be willing to test drive my changes, I would appreciate a 
>>>>> feedback
>>>>> enormously.
>>>>>  
>>>
>>> I hope this isnt waiting on my 'approval'.
>>> I think its a great idea, and has been on my (way too stagnant) list 
>>> for
>>> a while.
>>> Your work has at least urged me to install busybox on my xeno-box. ;-)
>>>
>>> My only concern is whether we've sufficiently distinguished the issues:
>>>
>>> 1 - ash vs bash
>>>
>>> Its not entirely clear to me which flavors of sh busybox has:
>>>    ash / dash / not-bash
>>> I gather u worked with ash, and it seems most valuable sh features
>>> work there just fine ( shell-functions, even 'job-control' of a 
>>> fashion)
>>>
>>> 2 - busybox 'executables' only
>>>
>>> I coded in a lot of 'full linux' gimme's, like zgrep, script, etc.
>>> Niklaus has repaired many of these.  I think a more thorough cleanup is
>>> possible,
>>> esp if things like 'script' are jettisoned for a simpler 
>>> shell-functions
>>> or helper scripts.
>>> This all implies a re-write, which is on my list...
>>> (esp the job-control testing and repair)
>>
>>
>> Just stumbled over this again while cleaning up my mailbox. What's the
>> status? Waiting for improvements, or waiting for /someone/ to type svn
>> ci (and improve the topics above later)?
>>
>
> It's queued for now, waiting for a combined ack to merge the current 
> patch from JimC and Niklaus.
>

AFAIC, Niklaus is in the lead atm.
Im trying to get some GPIO stuff ready for -mm.
( I'll post separately on this ..)

I ran his changes once, I dont even remember what it did.
(which suggests that it didnt explode ;-)
IMO, take it when Niklaus says its ready.
I have some local changes here, but Ill work them into shape after
Niks changes go in (maybe much later :-(

We should probly confer on the longer-term issues too.

- a rational option-pass-thru, or a means to avoid doing so.
if we assume OPTS_${TOOLNAME} exists, we could
grab it out of env, and pass it into the benchmark prog.
 - would require no prog mods, but gives us complete control
- would play nicer than assuming -T <secs> has meaning for all progs.





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

* Re: [Xenomai-core] Porting xeno-{info|load|test} to a busybox system
  2006-06-14 19:01           ` [Xenomai-core] " Jim Cromie
@ 2006-06-15 15:01             ` Philippe Gerum
  0 siblings, 0 replies; 13+ messages in thread
From: Philippe Gerum @ 2006-06-15 15:01 UTC (permalink / raw)
  To: Jim Cromie; +Cc: xenomai

Jim Cromie wrote:
> Philippe Gerum wrote:
> 
>> Jan Kiszka wrote:
>>
>>> Jim Cromie wrote:
>>>
>>>> Niklaus Giger wrote:
>>>>
>>>>> Am Freitag, 26. Mai 2006 15:52 schrieb Jan Kiszka:
>>>>>
>>>>>
>>>>>> Niklaus Giger wrote:    ...
>>>>>> If anybody has a working target with a Xenomai + BusyBox 
>>>>>> combination and
>>>>>> would be willing to test drive my changes, I would appreciate a 
>>>>>> feedback
>>>>>> enormously.
>>>>>>  
>>>>
>>>>
>>>> I hope this isnt waiting on my 'approval'.
>>>> I think its a great idea, and has been on my (way too stagnant) list 
>>>> for
>>>> a while.
>>>> Your work has at least urged me to install busybox on my xeno-box. ;-)
>>>>
>>>> My only concern is whether we've sufficiently distinguished the issues:
>>>>
>>>> 1 - ash vs bash
>>>>
>>>> Its not entirely clear to me which flavors of sh busybox has:
>>>>    ash / dash / not-bash
>>>> I gather u worked with ash, and it seems most valuable sh features
>>>> work there just fine ( shell-functions, even 'job-control' of a 
>>>> fashion)
>>>>
>>>> 2 - busybox 'executables' only
>>>>
>>>> I coded in a lot of 'full linux' gimme's, like zgrep, script, etc.
>>>> Niklaus has repaired many of these.  I think a more thorough cleanup is
>>>> possible,
>>>> esp if things like 'script' are jettisoned for a simpler 
>>>> shell-functions
>>>> or helper scripts.
>>>> This all implies a re-write, which is on my list...
>>>> (esp the job-control testing and repair)
>>>
>>>
>>>
>>> Just stumbled over this again while cleaning up my mailbox. What's the
>>> status? Waiting for improvements, or waiting for /someone/ to type svn
>>> ci (and improve the topics above later)?
>>>
>>
>> It's queued for now, waiting for a combined ack to merge the current 
>> patch from JimC and Niklaus.
>>
> 
> AFAIC, Niklaus is in the lead atm.
> Im trying to get some GPIO stuff ready for -mm.
> ( I'll post separately on this ..)
> 
> I ran his changes once, I dont even remember what it did.
> (which suggests that it didnt explode ;-)
> IMO, take it when Niklaus says its ready.
> I have some local changes here, but Ill work them into shape after
> Niks changes go in (maybe much later :-(
> 
> We should probly confer on the longer-term issues too.
> 
> - a rational option-pass-thru, or a means to avoid doing so.
> if we assume OPTS_${TOOLNAME} exists, we could
> grab it out of env, and pass it into the benchmark prog.
> - would require no prog mods, but gives us complete control
> - would play nicer than assuming -T <secs> has meaning for all progs.
> 
> 

Would this fit with an automated test 'bot? Niklaus?

-- 

Philippe.


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

end of thread, other threads:[~2006-06-15 15:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-25 19:34 [Xenomai-core] Porting xeno-{info|load|test} to a busybox system Niklaus Giger
2006-05-26 13:52 ` Jan Kiszka
2006-05-26 16:52   ` Niklaus Giger
2006-05-27 16:42     ` Jan Kiszka
2006-05-28 10:00       ` Niklaus Giger
2006-05-28 10:45         ` Jan Kiszka
2006-05-28 14:41           ` Niklaus Giger
2006-05-29 11:40             ` Jan Kiszka
2006-06-06 20:32     ` Jim Cromie
2006-06-12 20:33       ` Jan Kiszka
2006-06-12 21:23         ` [Xenomai-core] " Niklaus Giger
     [not found]         ` <448DD841.1040906@domain.hid>
2006-06-14 19:01           ` [Xenomai-core] " Jim Cromie
2006-06-15 15:01             ` Philippe Gerum

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.