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

Submitted by rongqing.li@windriver.com on Sept. 11, 2013, 9:17 a.m.

Details

Message ID dec697bffb0eebaeb34f5acd32929ba866174585.1378890742.git.rongqing.li@windriver.com
State Accepted
Commit 51c43e08b388ed15520c66977bbb49df18e5f124
Headers show

Commit Message

rongqing.li@windriver.com Sept. 11, 2013, 9:17 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(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-support/ptest-runner/files/ptest-runner b/meta/recipes-support/ptest-runner/files/ptest-runner
index 4f3c7ce..ccb0434 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*
 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"

Comments

Chris Larson Sept. 12, 2013, 8:45 p.m.
On Wed, Sep 11, 2013 at 2:17 AM, <rongqing.li@windriver.com> wrote:

> +    for x in `find -L ./ -name run-ptest -type f -perm /u+x,g+x`
> +    do
>

As far as I can tell, busybox find doesn't support -L, so this adds an
implicit, undeclared dependency upon findutils.
Björn Stenberg Sept. 17, 2013, 1:35 p.m.
Chris Larson wrote:
> On Wed, Sep 11, 2013 at 2:17 AM, <rongqing.li@windriver.com> wrote:
> 
> > +    for x in `find -L ./ -name run-ptest -type f -perm /u+x,g+x`
> > +    do
> >
> 
> As far as I can tell, busybox find doesn't support -L, so this adds an
> implicit, undeclared dependency upon findutils.

That is correct. Busybox find does however support -follow, which in turn GNU find does not...
Björn Stenberg Sept. 19, 2013, 11:47 a.m.
Chris Larson wrote:
> On Wed, Sep 11, 2013 at 2:17 AM, <rongqing.li@windriver.com> wrote:
> 
> > +    for x in `find -L ./ -name run-ptest -type f -perm /u+x,g+x`
> > +    do
> >
> 
> As far as I can tell, busybox find doesn't support -L, so this adds an
> implicit, undeclared dependency upon findutils.

Rongquing, are you planning on fixing this? As committed, ptest-runner can't run on busybox systems (which I'd argue are the majority of embedded systems).
Randy MacLeod Sept. 19, 2013, 3:04 p.m.
On 13-09-19 07:47 AM, Björn Stenberg wrote:
> Chris Larson wrote:
>> On Wed, Sep 11, 2013 at 2:17 AM, <rongqing.li@windriver.com> wrote:
>>
>>> +    for x in `find -L ./ -name run-ptest -type f -perm /u+x,g+x`
>>> +    do
>>>
>>
>> As far as I can tell, busybox find doesn't support -L, so this adds an
>> implicit, undeclared dependency upon findutils.
>
> Rongqing, are you planning on fixing this? As committed, ptest-runner can't run on busybox systems
>

Yes, Roy will fix this. He's on holiday for a few days.

I presume he'll add a check to see which arg to use for find
rather than add a dependency on findutils.

 > (which I'd argue are the majority of embedded systems).

That's becoming less true over time, IMO.
It seems that more and more embedded linux users are on bigger
targets that use the discrete GNU tools.
Björn Stenberg Sept. 20, 2013, 9:17 a.m.
Randy MacLeod wrote:
> Yes, Roy will fix this. He's on holiday for a few days.

Excellent.

> I presume he'll add a check to see which arg to use for find
> rather than add a dependency on findutils.

I suggest skipping the find command altogether. The run-ptest files are defined to always sit in ${libdir}/${PN}/ptest and thus don't really need to be searched for.

Also, 'pushd' is not available in the busybox shell.

(I should have spotted these during patch review, but I was temporarily unavailable. Sorry about that.)