2012-01-08 18:52:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo '### Test niceload exit code'
|
|
|
|
niceload "perl -e 'exit(3)'" ; echo $? eq 3
|
|
|
|
niceload "perl -e 'exit(0)'" ; echo $? eq 0
|
2012-03-04 01:24:37 +00:00
|
|
|
|
2012-12-02 20:11:27 +00:00
|
|
|
# force load > 10
|
|
|
|
while uptime | grep -v age:.[1-9][0-9].[0-9][0-9] >/dev/null ; do (timeout 5 nice burnP6 2>/dev/null &) done
|
|
|
|
|
2012-03-04 01:24:37 +00:00
|
|
|
echo '### Test -p'
|
|
|
|
perl -e '$|=1;while($t++<3){sleep(1);print "."}' &
|
2012-12-02 23:02:51 +00:00
|
|
|
# The above will normally take 3.6 sec
|
|
|
|
# It should be suspended so it at least takes 5 seconds
|
|
|
|
stdout /usr/bin/time -f %e niceload -l 8 -p $! | perl -ne '$_ >= 5 and print "OK\n"'
|
|
|
|
|
|
|
|
echo "### Test --sensor -l negative"
|
2014-06-23 00:04:37 +00:00
|
|
|
# The test does not currently work on my laptop
|
|
|
|
#timeout 10 nice nice dd iflag=fullblock if=/dev/zero of=/dev/null bs=11G &
|
|
|
|
#niceload -t 1 --sensor 'free | field 3 | head -3|tail -1' -l -10000000 "free -g|egrep -q /.*1[0-9]. && echo more than 6 GB used"
|
2012-12-02 23:02:51 +00:00
|
|
|
|