[PATCH 2/3] hust_test: Add missing PWD variable and improve checking mechanism
Michal Simek
monstr at monstr.eu
Wed Aug 12 13:56:11 UTC 2009
Denys Vlasenko wrote:
> On Wed, Aug 12, 2009 at 11:29 AM, <monstr at monstr.eu> wrote:
>> From: Michal Simek <monstr at monstr.eu>
>>
>> Hush shell not create PWD env variable and script expect that exists.
>>
>> Add checking mechanism for correct pointing to busybox/hush shell.
>>
>> Check if .config file exist in current folder and in case that not
>> copy ../../.config file from source for systems which are able to
>> compile bysybox sources and report error for other cases.
>>
>> Signed-off-by: Michal Simek <monstr at monstr.eu>
>> ---
>> shell/hush_test/run-all | 24 ++++++++++++++++++++----
>> 1 files changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/shell/hush_test/run-all b/shell/hush_test/run-all
>> index 470adaa..6711414 100755
>> --- a/shell/hush_test/run-all
>> +++ b/shell/hush_test/run-all
>> @@ -10,13 +10,29 @@ unset LC_TIME
>> unset LC_ALL
>>
>> test -x hush || {
>> - echo "No ./hush - creating a link to ../../busybox"
>> - ln -s ../../busybox hush
>> + BUSYBOX=`which busybox`
>> + if test -n "$BUSYBOX" ; then
>> + echo "No ./hush - creating a link to $BUSYBOX"
>> + ln -s $BUSYBOX hush
>> + else
>> + echo "Busybox/Hush shell not exist"
>> + exit 1
>> + fi
>> }
>
> This will make it harder to run testsuite
> from inside freshly built tree: the above code
> will pick up installed hush instead, right?
Maybe worth do do just checking that ../../busybox exists and if not just
write any message and ends.
>
>> -if test -e ../../.config ; then
>> - eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' ../../.config)
>> +
>> +if test ! -e .config ; then
>> + if test -f ../../.config ; then
>> + cp ../../.config . || exit 1
>> + else
>> + echo "Missing .config file"
>> + exit 1
>> + fi
>> fi
>>
>> +eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config)
>> +
>> +PWD=`pwd`
>> +
>> PATH="$PWD:$PATH" # for hush and recho/zecho/printenv
>> export PATH
>
> This is ok, I will apply it - see attached patch.
I am trying to run ltp on hush and runltp use PWD too. It will be better if hush
will export PWD variable. I am not script specialist and don't have any statistic but seems to me it
is common thing and shell should provide it. What do you think?
Michal
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
More information about the busybox
mailing list