Eu tenho este erro quando executo o script bash que executa outros scripts bash e executa-se recursivamente.
Em scripts eu uso xdotool
, crie contadores e em cada script eu uso $RANDOM
call (mesmo é um arquivo que chama $RANDOM
em while-loop: max 20 iteration)
E cada comando é salvo com echo 'command' redirecionando stream para o arquivo.
Isso me dá esse erro:
./somescript.sh: fork: Cannot allocate memory
Sobre o SO: Antergos 64bit + Openbox + 8Gb RAM
Foi aberto: qtcreator, lxterminal, meu aplicativo qt (100Mb)
Agora o tamanho do arquivo de log é de 3,5 МіB.
Meu ulimit -a
:
[user@workstation MonkeyClicker]$ ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31856
max locked memory (kbytes, -l) 1024
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31856
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Meu script run.sh
:
#!/bin/bash
if [ -z $1 ]
then
echo ' '
echo '***************MONKEY TESTING TOOL HELP***************'
echo ' '
echo 'command: run.sh [start delay]'
echo '[start delay] - means that you have X seconds to start your program'
echo 'for example : run.sh 3s 0.1s'
echo ' '
else
mkdir -p logScript
./monkeyTestingTool.sh $1 > $PWD/logScript/script.sh
fi
Meu script monkeyTestingTool.sh
:
!/bin/bash
if [ $1 ]
then
echo '#Started in:' $date
echo '#MONKEY TESTING START, BE CAREFUL!'
echo '#You have' $1 'seconds to open your app for testing ...'
sleep $1
fi
echo $(xdotool getmouselocation --shell)
echo 'xdotool mousemove --sync $X $Y'
RANGE=7
CHOOSE=$RANDOM
let "CHOOSE %= $RANGE"
case $CHOOSE in
0) sh ./move.sh
;;
1) sh ./callContextMenu.sh
;;
2) sh ./typeRandom.sh
;;
3) xdotool click 1 #this is leftMouseClick
;;
4) sh ./keyPressing.sh
;;
5) sh ./move.sh
;;
6) sh ./dragDrop.sh
#*) TODO: drag and drop
esac
./monkeyTestingTool.sh
E, por exemplo, meu script callContextMenu.sh
:
#!/bin/bash
echo $(xdotool getmouselocation --shell)
echo 'xdotool mousemove --sync $X $Y'
echo 'xdotool click 3'
xdotool click 3
LASTKEY=0
RANGESTEPS=20
STEPS=$RANDOM
let "STEPS %= $RANGESTEPS"
while [ $STEPS != 0 ]; do
RANGE=5
CHOOSE=$RANDOM
let "CHOOSE %= $RANGE"
let STEPS=STEPS-1
LASTKEY=$CHOOSE
case $CHOOSE in
0) xdotool key Up
echo 'xdotool key Up'
;;
1) xdotool key Left
echo 'xdotool key Left'
;;
2) xdotool key Down
echo 'xdotool key Down'
;;
3) if [ $STEPS == 1 ]
then
echo 'xdotool key Return'
xdotool key Return
fi
;;
4) xdotool key Right
echo 'xdotool key Right'
;;
esac
done
if [ $LASTKEY != 3 ]
then
echo 'xdotool key Return'
xdotool key Return
else
echo 'xdotool key Down'
echo 'xdotool Return'
xdotool key Down
xdotool key Return
fi