[3/3] scripts: arch dependent to get the syscall_list

Message ID 1381316186-8562-4-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell Oct. 9, 2013, 10:56 a.m.
ARCH may be changed in the enviroment

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 scripts/find.sh                           | 10 +++++++++-
 scripts/test-all-syscalls-parallel.sh     | 10 +++++++++-
 scripts/test-all-syscalls-sequentially.sh | 10 +++++++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

Comments

Dave Jones Oct. 9, 2013, 4:41 p.m. | #1
On Wed, Oct 09, 2013 at 12:56:26PM +0200, Anders Roxell wrote:
 > ARCH may be changed in the enviroment
 > 
 > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
 > ---
 >  scripts/find.sh                           | 10 +++++++++-
 >  scripts/test-all-syscalls-parallel.sh     | 10 +++++++++-
 >  scripts/test-all-syscalls-sequentially.sh | 10 +++++++++-
 >  3 files changed, 27 insertions(+), 3 deletions(-)
 > 
 > diff --git a/scripts/find.sh b/scripts/find.sh
 > index 3f10c58..717beb1 100755
 > --- a/scripts/find.sh
 > +++ b/scripts/find.sh
 > @@ -8,6 +8,14 @@
 >  TRINITY_PATH=${TRINITY_PATH:-.}
 >  TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
 >  
 > +if [ $ARCH = "arm" ]; then
 > +    $TRINITY_PATH/trinity -L | grep -v AVOID | \
 > +        awk '{ print $2 }' | sort -u> $TRINITY_TMP/syscall_list
 > +else
 > +    $TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | \
 > +        awk '{ print $4 }' | sort -u> $TRINITY_TMP/syscall_list
 > +fi
 
Ugh. How about we just change the format of the output of -L so it's
more similar on both uniarch and biarch ?

Changing to to be..

on biarch=true:

entrypoint 0 restart_syscall [32-bit] : Enabled AVOID
entrypoint 1 exit [32-bit] : Enabled AVOID
..
entrypoint 312 kcmp [64-bit]
entrypoint 313 finit_module [64-bit]


And then the !biarch case would just lack the *-bit tags, allowing the awk to
pluck out column 2 regardless of arch.

Does that sound better ?

	Dave
Anders Roxell Oct. 10, 2013, 8:45 a.m. | #2
On 2013-10-09 12:41, Dave Jones wrote:
> On Wed, Oct 09, 2013 at 12:56:26PM +0200, Anders Roxell wrote:
>  > ARCH may be changed in the enviroment
>  > 
>  > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>  > ---
>  >  scripts/find.sh                           | 10 +++++++++-
>  >  scripts/test-all-syscalls-parallel.sh     | 10 +++++++++-
>  >  scripts/test-all-syscalls-sequentially.sh | 10 +++++++++-
>  >  3 files changed, 27 insertions(+), 3 deletions(-)
>  > 
>  > diff --git a/scripts/find.sh b/scripts/find.sh
>  > index 3f10c58..717beb1 100755
>  > --- a/scripts/find.sh
>  > +++ b/scripts/find.sh
>  > @@ -8,6 +8,14 @@
>  >  TRINITY_PATH=${TRINITY_PATH:-.}
>  >  TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
>  >  
>  > +if [ $ARCH = "arm" ]; then
>  > +    $TRINITY_PATH/trinity -L | grep -v AVOID | \
>  > +        awk '{ print $2 }' | sort -u> $TRINITY_TMP/syscall_list
>  > +else
>  > +    $TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | \
>  > +        awk '{ print $4 }' | sort -u> $TRINITY_TMP/syscall_list
>  > +fi
>  
> Ugh. How about we just change the format of the output of -L so it's
> more similar on both uniarch and biarch ?
> 
> Changing to to be..
> 
> on biarch=true:
> 
> entrypoint 0 restart_syscall [32-bit] : Enabled AVOID
> entrypoint 1 exit [32-bit] : Enabled AVOID
> ..
> entrypoint 312 kcmp [64-bit]
> entrypoint 313 finit_module [64-bit]
> 
> 
> And then the !biarch case would just lack the *-bit tags, allowing the awk to
> pluck out column 2 regardless of arch.
> 
> Does that sound better ?
That sound great!

I will redo and send patchv2.

    Anders
> 
> 	Dave
>

Patch

diff --git a/scripts/find.sh b/scripts/find.sh
index 3f10c58..717beb1 100755
--- a/scripts/find.sh
+++ b/scripts/find.sh
@@ -8,6 +8,14 @@ 
 TRINITY_PATH=${TRINITY_PATH:-.}
 TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
 
+if [ $ARCH = "arm" ]; then
+    $TRINITY_PATH/trinity -L | grep -v AVOID | \
+        awk '{ print $2 }' | sort -u> $TRINITY_TMP/syscall_list
+else
+    $TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | \
+        awk '{ print $4 }' | sort -u> $TRINITY_TMP/syscall_list
+fi
+
 check_tainted()
 {
     if [ "$(cat /proc/sys/kernel/tainted)" != $TAINT ]; then
@@ -27,7 +35,7 @@  while [ 1 ];
 do
 
 
-for sc in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
+for sc in $(cat $TRINITY_TMP/syscall_list)
 do
   mkdir -p tmp.$i
   pushd tmp.$i
diff --git a/scripts/test-all-syscalls-parallel.sh b/scripts/test-all-syscalls-parallel.sh
index 312fd2a..e229702 100755
--- a/scripts/test-all-syscalls-parallel.sh
+++ b/scripts/test-all-syscalls-parallel.sh
@@ -3,12 +3,20 @@ 
 TRINITY_PATH=${TRINITY_PATH:-.}
 TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
 
+if [ $ARCH = "arm" ]; then
+    $TRINITY_PATH/trinity -L | grep -v AVOID | \
+        awk '{ print $2 }' | sort -u> $TRINITY_TMP/syscall_list
+else
+    $TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | \
+        awk '{ print $4 }' | sort -u> $TRINITY_TMP/syscall_list
+fi
+
 chmod 755 $TRINITY_TMP
 cd $TRINITY_TMP
 
 while [ 1 ];
 do
-  for syscall in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
+  for syscall in $(cat $TRINITY_TMP/syscall_list)
   do
 	MALLOC_CHECK_=2 $TRINITY_PATH/trinity -q -c $syscall -D &
   done
diff --git a/scripts/test-all-syscalls-sequentially.sh b/scripts/test-all-syscalls-sequentially.sh
index 2b726fc..1b56a0c 100755
--- a/scripts/test-all-syscalls-sequentially.sh
+++ b/scripts/test-all-syscalls-sequentially.sh
@@ -6,6 +6,14 @@ 
 TRINITY_PATH=${TRINITY_PATH:-.}
 TRINITY_TMP=$(mktemp -d /tmp/trinity.XXXXXX)
 
+if [ $ARCH = "arm" ]; then
+    $TRINITY_PATH/trinity -L | grep -v AVOID | \
+        awk '{ print $2 }' | sort -u> $TRINITY_TMP/syscall_list
+else
+    $TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | \
+        awk '{ print $4 }' | sort -u> $TRINITY_TMP/syscall_list
+fi
+
 check_tainted()
 {
     if [ "$(cat /proc/sys/kernel/tainted)" != $TAINT ]; then
@@ -18,7 +26,7 @@  TAINT=$(cat /proc/sys/kernel/tainted)
 
 while [ 1 ]
 do
-for syscall in $($TRINITY_PATH/trinity -L | grep entrypoint | grep -v AVOID | awk '{ print $4 }' | sort -u)
+for syscall in $(cat $TRINITY_TMP/syscall_list)
 do
 	chmod 755 $TRINITY_TMP
 	pushd $TRINITY_TMP