Blame testcases/misc_tests/spinlock_tests.sh
|
Packit |
8681c6 |
#!/bin/bash
|
|
Packit |
8681c6 |
#
|
|
Packit |
8681c6 |
# COPYRIGHT (c) International Business Machines Corp. 2012-2017
|
|
Packit |
8681c6 |
#
|
|
Packit |
8681c6 |
# This program is provided under the terms of the Common Public License,
|
|
Packit |
8681c6 |
# version 1.0 (CPL-1.0). Any use, reproduction or distribution for this software
|
|
Packit |
8681c6 |
# constitutes recipient's acceptance of CPL-1.0 terms which can be found
|
|
Packit |
8681c6 |
# in the file LICENSE file or at https://opensource.org/licenses/cpl1.0.php
|
|
Packit |
8681c6 |
#
|
|
Packit |
8681c6 |
|
|
Packit |
8681c6 |
while getopts "s:p:l:" option
|
|
Packit |
8681c6 |
do
|
|
Packit |
8681c6 |
case $option in
|
|
Packit |
8681c6 |
"s")
|
|
Packit |
8681c6 |
slotid="$OPTARG"
|
|
Packit |
8681c6 |
;;
|
|
Packit |
8681c6 |
"p")
|
|
Packit |
8681c6 |
procnum="$OPTARG"
|
|
Packit |
8681c6 |
;;
|
|
Packit |
8681c6 |
"l")
|
|
Packit |
8681c6 |
loopcount="$OPTARG"
|
|
Packit |
8681c6 |
;;
|
|
Packit |
8681c6 |
[?])
|
|
Packit |
8681c6 |
echo "Usage: -s <slotid> -p <num_of_processes> -l <loopcount>"
|
|
Packit |
8681c6 |
exit
|
|
Packit |
8681c6 |
;;
|
|
Packit |
8681c6 |
esac
|
|
Packit |
8681c6 |
done
|
|
Packit |
8681c6 |
|
|
Packit |
8681c6 |
if [ -z $slotid ] || [ -z $procnum ] || [ -z $loopcount ]; then
|
|
Packit |
8681c6 |
echo "Usage: -s <slotid> -p <num_of_processes> -l <loopcount>"
|
|
Packit |
8681c6 |
exit
|
|
Packit |
8681c6 |
fi
|
|
Packit |
8681c6 |
|
|
Packit |
8681c6 |
while [ $procnum -gt 0 ]
|
|
Packit |
8681c6 |
do
|
|
Packit |
8681c6 |
echo "Starting child process #$procnum"
|
|
Packit |
8681c6 |
(./spinlock_child.sh -s $slotid -l $loopcount;) &
|
|
Packit |
8681c6 |
let procnum=procnum-1
|
|
Packit |
8681c6 |
done
|
|
Packit |
8681c6 |
|
|
Packit |
8681c6 |
wait
|
|
Packit |
8681c6 |
echo "Exiting parent loop"
|