Home | History | Annotate | Download | only in test_scripts
      1 #!/bin/bash
      2 
      3 # MP3-encode something
      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 # Try to find the program on the system
     23 PROGRAM=lame
     24 PROGFILE=`which $PROGRAM 2> /dev/null`
     25 
     26 if [ -z "$PROGFILE" ]; then
     27 	PROGFILE=`ls $POUNDER_OPTDIR/$PROGRAM*/frontend/$PROGRAM`
     28 	if [ -z "$PROGFILE" ]; then
     29 		echo "Cannot find $PROGRAM; did you run Install?"
     30 		exit -1
     31 	fi
     32 fi
     33 
     34 # Can we set processor affinities?
     35 TASKSET=`which taskset 2> /dev/null`
     36 if [ -z "$TASKSET" ]; then
     37 	TASKSET=`ls $POUNDER_OPTDIR/schedutils*/taskset`
     38 fi
     39 
     40 # Attach a process to each CPU
     41 for ((k=0; k < $NR_CPUS; k++))
     42 do
     43 	dd if=/dev/urandom bs=1024k count=200 | "$TASKSET" `echo -en "obase=16\n$((1 << k))\n" | bc` "$PROGFILE" - /dev/null &
     44 done
     45 
     46 # Wait for children (even though they won't die...)
     47 wait
     48 
     49 # If we don't crash the system, we're ok.
     50 # We actually don't care about the output. (mp3 encoded garbage?)
     51 exit 0
     52