Patchwork [1/1] ptest-runner: trivial fixes and refine

login
register
mail settings
Submitter rongqing.li@windriver.com
Date Sept. 11, 2013, 7:34 a.m.
Message ID <934e6208f68c0801666853fc81c3f67b39c368cb.1378884764.git.rongqing.li@windriver.com>
Download mbox | patch
Permalink /patch/57805/
State New
Headers show

Comments

rongqing.li@windriver.com - Sept. 11, 2013, 7:34 a.m.
From: Roy Li <rongqing.li@windriver.com>

1. ptest files may be installed under /usr/lib64/ for 64bit filesystem
or under /usr/lib/ for 64bit multilib filesystem, so we should check both
directories

2. If a soft link is linking to a directory under the same directory, we
only run once.

[YOCTO #5125]
[YOCTO #5126]

Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
 .../ptest-runner/files/ptest-runner                |   30 +++++++++++++++-----
 1 file changed, 23 insertions(+), 7 deletions(-)
Richard Purdie - Sept. 11, 2013, 8:40 a.m.
On Wed, 2013-09-11 at 15:34 +0800, rongqing.li@windriver.com wrote:
> From: Roy Li <rongqing.li@windriver.com>
> 
> 1. ptest files may be installed under /usr/lib64/ for 64bit filesystem
> or under /usr/lib/ for 64bit multilib filesystem, so we should check both
> directories
> 
> 2. If a soft link is linking to a directory under the same directory, we
> only run once.
> 
> [YOCTO #5125]
> [YOCTO #5126]
> 
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
>  .../ptest-runner/files/ptest-runner                |   30 +++++++++++++++-----
>  1 file changed, 23 insertions(+), 7 deletions(-)
> 
> diff --git a/meta/recipes-support/ptest-runner/files/ptest-runner b/meta/recipes-support/ptest-runner/files/ptest-runner
> index 4f3c7ce..724e066 100644
> --- a/meta/recipes-support/ptest-runner/files/ptest-runner
> +++ b/meta/recipes-support/ptest-runner/files/ptest-runner
> @@ -1,16 +1,32 @@
>  #!/bin/sh
>  
>  echo "START: $0"
> -cd /usr/lib
> -for x in *
> +
> +for libdir in /usr/lib/ /usr/lib64/


We shouldn't hard code this. To keep things simple, I think you need to
search /usr/lib*...

Cheers,

Richard

>  do
> -    if [ -x "/usr/lib/$x/ptest/run-ptest" ]; then
> -       date "+%Y-%m-%dT%H:%M"
> +
> +    [ ! -d "$libdir" ] && continue
> +
> +    cd "$libdir"
> +    for x in `find -L ./ -name run-ptest -type f -perm /u+x,g+x`
> +    do
> +        # test if a dir is linking to one that they are under same directory
> +        # like perl5-->perl
> +        ptestdir=`dirname $x|cut -f2 -d"/"`
> +        if [ -h "$ptestdir" ]; then
> +            linkdir=`readlink -f "$ptestdir"`
> +            if [ `dirname "$linkdir"`"/" = "$libdir" ]; then
> +                continue
> +            fi
> +        fi
> +    
> +        date "+%Y-%m-%dT%H:%M"
>          echo "BEGIN: $x"
> -        cd /usr/lib/$x/ptest
> +        pushd `dirname "$x"`
>          ./run-ptest
> +        popd
>          echo "END: $x"
> -       date "+%Y-%m-%dT%H:%M"
> -    fi
> +        date "+%Y-%m-%dT%H:%M"
> +    done
>  done
>  echo "STOP: $0"
rongqing.li@windriver.com - Sept. 11, 2013, 9:02 a.m.
On 09/11/2013 04:40 PM, Richard Purdie wrote:
> On Wed, 2013-09-11 at 15:34 +0800, rongqing.li@windriver.com wrote:
>> From: Roy Li <rongqing.li@windriver.com>
>>
>> 1. ptest files may be installed under /usr/lib64/ for 64bit filesystem
>> or under /usr/lib/ for 64bit multilib filesystem, so we should check both
>> directories
>>
>> 2. If a soft link is linking to a directory under the same directory, we
>> only run once.
>>
>> [YOCTO #5125]
>> [YOCTO #5126]
>>
>> Signed-off-by: Roy Li <rongqing.li@windriver.com>
>> ---
>>   .../ptest-runner/files/ptest-runner                |   30 +++++++++++++++-----
>>   1 file changed, 23 insertions(+), 7 deletions(-)
>>
>> diff --git a/meta/recipes-support/ptest-runner/files/ptest-runner b/meta/recipes-support/ptest-runner/files/ptest-runner
>> index 4f3c7ce..724e066 100644
>> --- a/meta/recipes-support/ptest-runner/files/ptest-runner
>> +++ b/meta/recipes-support/ptest-runner/files/ptest-runner
>> @@ -1,16 +1,32 @@
>>   #!/bin/sh
>>
>>   echo "START: $0"
>> -cd /usr/lib
>> -for x in *
>> +
>> +for libdir in /usr/lib/ /usr/lib64/
>
>
> We shouldn't hard code this. To keep things simple, I think you need to
> search /usr/lib*...
>
> Cheers,
>
> Richard

Thanks, I will change it

-Roy


>
>>   do
>> -    if [ -x "/usr/lib/$x/ptest/run-ptest" ]; then
>> -       date "+%Y-%m-%dT%H:%M"
>> +
>> +    [ ! -d "$libdir" ] && continue
>> +
>> +    cd "$libdir"
>> +    for x in `find -L ./ -name run-ptest -type f -perm /u+x,g+x`
>> +    do
>> +        # test if a dir is linking to one that they are under same directory
>> +        # like perl5-->perl
>> +        ptestdir=`dirname $x|cut -f2 -d"/"`
>> +        if [ -h "$ptestdir" ]; then
>> +            linkdir=`readlink -f "$ptestdir"`
>> +            if [ `dirname "$linkdir"`"/" = "$libdir" ]; then
>> +                continue
>> +            fi
>> +        fi
>> +
>> +        date "+%Y-%m-%dT%H:%M"
>>           echo "BEGIN: $x"
>> -        cd /usr/lib/$x/ptest
>> +        pushd `dirname "$x"`
>>           ./run-ptest
>> +        popd
>>           echo "END: $x"
>> -       date "+%Y-%m-%dT%H:%M"
>> -    fi
>> +        date "+%Y-%m-%dT%H:%M"
>> +    done
>>   done
>>   echo "STOP: $0"
>
>
>
>

Patch

diff --git a/meta/recipes-support/ptest-runner/files/ptest-runner b/meta/recipes-support/ptest-runner/files/ptest-runner
index 4f3c7ce..724e066 100644
--- a/meta/recipes-support/ptest-runner/files/ptest-runner
+++ b/meta/recipes-support/ptest-runner/files/ptest-runner
@@ -1,16 +1,32 @@ 
 #!/bin/sh
 
 echo "START: $0"
-cd /usr/lib
-for x in *
+
+for libdir in /usr/lib/ /usr/lib64/
 do
-    if [ -x "/usr/lib/$x/ptest/run-ptest" ]; then
-       date "+%Y-%m-%dT%H:%M"
+
+    [ ! -d "$libdir" ] && continue
+
+    cd "$libdir"
+    for x in `find -L ./ -name run-ptest -type f -perm /u+x,g+x`
+    do
+        # test if a dir is linking to one that they are under same directory
+        # like perl5-->perl
+        ptestdir=`dirname $x|cut -f2 -d"/"`
+        if [ -h "$ptestdir" ]; then
+            linkdir=`readlink -f "$ptestdir"`
+            if [ `dirname "$linkdir"`"/" = "$libdir" ]; then
+                continue
+            fi
+        fi
+    
+        date "+%Y-%m-%dT%H:%M"
         echo "BEGIN: $x"
-        cd /usr/lib/$x/ptest
+        pushd `dirname "$x"`
         ./run-ptest
+        popd
         echo "END: $x"
-       date "+%Y-%m-%dT%H:%M"
-    fi
+        date "+%Y-%m-%dT%H:%M"
+    done
 done
 echo "STOP: $0"