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 22RANDASYS_USER=daemon 23RANDASYS_UID=`id -u $RANDASYS_USER` 24RANDASYS_GROUP=daemon 25RANDASYS_GID=`id -u $RANDASYS_GROUP` 26 27# Try to find randasyscall on the system 28PROGRAM=`ls "$POUNDER_TMPDIR/randasys" 2> /dev/null` 29if [ -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 35fi 36 37trap '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 40chown $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 43cp "$PROGRAM" "/tmp" 44PROGRAM="/tmp/randasys" 45 46# Save a copy of dmesg 47dmesg > "$POUNDER_TMPDIR/randasys-before" 48 49# Start the program 50for ((k=0; k < $NR_CPUS; k++)) 51do 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 & 54done 55 56# Wait for this to finish (it won't) 57wait 58 59# Save another copy of dmesg 60dmesg > "$POUNDER_TMPDIR/randasys-after" 61echo "CECHK 5" 62 63# Diff 64DMESG_DIFF_LINES=`diff "$POUNDER_TMPDIR/randasys-before" "$POUNDER_TMPDIR/randasys-after" | wc -l` 65diff "$POUNDER_TMPDIR/randasys-before" "$POUNDER_TMPDIR/randasys-after" 66rm -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. 70exit 0 71