Home | History | Annotate | Download | only in test_scripts
      1 #!/bin/bash
      2 
      3 # Pound on syscall interface
      4 
      5 # Copyright (C) 2003-2006 IBM
      6 #
      7 # This program is free software; you can redistribute it and/or
      8 # modify it under the terms of the GNU General Public License as
      9 # published by the Free Software Foundation; either version 2 of the
     10 # License, or (at your option) any later version.
     11 #
     12 # This program is distributed in the hope that it will be useful, but
     13 # WITHOUT ANY WARRANTY; without even the implied warranty of
     14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 # General Public License for more details.
     16 #
     17 # You should have received a copy of the GNU General Public License
     18 # along with this program; if not, write to the Free Software
     19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     20 # 02111-1307, USA.
     21 
     22 RANDASYS_USER=daemon
     23 RANDASYS_UID=`id -u $RANDASYS_USER`
     24 RANDASYS_GROUP=daemon
     25 RANDASYS_GID=`id -u $RANDASYS_GROUP`
     26 
     27 # Try to find randasyscall on the system
     28 PROGRAM=`ls "$POUNDER_TMPDIR/randasys" 2> /dev/null`
     29 if [ -z "$PROGRAM" ]; then
     30 	PROGRAM=`ls "$POUNDER_SRCDIR/randasyscall/randasys"`
     31 	if [ -z "$PROGRAM" ]; then
     32 		echo "Cannot find randasys; did you run Install?"
     33 		exit -1
     34 	fi
     35 fi
     36 
     37 trap 'rm -rf "$POUNDER_TMPDIR/randasys"; kill -9 `pgrep -P $$` 2> /dev/null; exit 0' 1 2 15
     38 
     39 # Change the permissions on the log file
     40 chown $RANDASYS_USER `ls -la /proc/$$/fd/1 | awk -F " " '{print $11}'`
     41 
     42 # We need to dump this somewhere where the daemon user can read this
     43 cp "$PROGRAM" "/tmp"
     44 PROGRAM="/tmp/randasys"
     45 
     46 # Save a copy of dmesg
     47 dmesg > "$POUNDER_TMPDIR/randasys-before"
     48 
     49 # Start the program
     50 for ((k=0; k < $NR_CPUS; k++))
     51 do
     52 	"$POUNDER_HOME/fancy_timed_loop" 900 $RANDASYS_UID $RANDASYS_GID 9 "$PROGRAM" &
     53 	"$POUNDER_HOME/fancy_timed_loop" 900 $RANDASYS_UID $RANDASYS_GID 9 "$PROGRAM" -z &
     54 done
     55 
     56 # Wait for this to finish (it won't)
     57 wait
     58 
     59 # Save another copy of dmesg
     60 dmesg > "$POUNDER_TMPDIR/randasys-after"
     61 echo "CECHK 5"
     62 
     63 # Diff
     64 DMESG_DIFF_LINES=`diff "$POUNDER_TMPDIR/randasys-before" "$POUNDER_TMPDIR/randasys-after" | wc -l`
     65 diff "$POUNDER_TMPDIR/randasys-before" "$POUNDER_TMPDIR/randasys-after"
     66 rm -rf "$POUNDER_TMPDIR/randasys-before" "$POUNDER_TMPDIR/randasys-after"
     67 
     68 # Failures will show up in the test output.  Or better yet,
     69 # panic/oops/BUG the machine.
     70 exit 0
     71