2012-11-19 23:39:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# force load > 10
|
2014-11-22 20:31:34 +00:00
|
|
|
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-11-19 23:39:25 +00:00
|
|
|
|
2014-03-03 18:26:19 +00:00
|
|
|
int() {
|
|
|
|
perl -pe 's/(\d+\.\d*)/int($1)/e'
|
|
|
|
}
|
|
|
|
export -f int
|
|
|
|
|
2014-07-15 00:40:38 +00:00
|
|
|
cat <<'EOF' | stdout parallel -k -vj0 -L1
|
2014-11-09 23:29:42 +00:00
|
|
|
# The seq 30000000 should take > 1 cpu sec to run.
|
2012-11-19 23:39:25 +00:00
|
|
|
echo '### --soft -f and test if child is actually suspended and thus takes longer'
|
2014-11-09 23:29:42 +00:00
|
|
|
niceload --soft -f 0.5 'seq 30000000 | nice wc;echo This should finish last' &
|
|
|
|
(sleep 1; seq 30000000 | nice wc;echo This should finish first) &
|
2014-03-03 18:26:19 +00:00
|
|
|
wait
|
|
|
|
|
2012-12-10 20:57:00 +00:00
|
|
|
echo '### niceload with no arguments should give no output'
|
|
|
|
niceload
|
2014-03-03 18:26:19 +00:00
|
|
|
|
|
|
|
echo '### Test -t and -s'
|
2014-11-09 23:29:42 +00:00
|
|
|
# This should sleep 2*1s and run 2*2s
|
2014-03-03 18:26:19 +00:00
|
|
|
niceload -v -t 1 -s 2 sleep 4.5
|
|
|
|
|
2014-03-22 11:38:45 +00:00
|
|
|
echo 'bug #38908: niceload: Ctrl-C/TERM should resume jobs if using -p - Order may change, but not output'
|
2014-03-03 18:26:19 +00:00
|
|
|
# This should take 10 seconds to run + delay from niceload
|
|
|
|
# niceload killed after 1 sec => The delay from niceload should be no more than 1 second
|
|
|
|
stdout /usr/bin/time -f %e perl -e 'for(1..100) { select(undef, undef, undef, 0.1); } print "done\n"' | int &
|
|
|
|
niceload -vt 1 -s 10 -p $! &
|
|
|
|
export A=$!;
|
|
|
|
sleep 2;
|
|
|
|
kill -s TERM $A;
|
2014-03-22 11:38:45 +00:00
|
|
|
wait;
|
|
|
|
echo Finished
|
2014-03-03 18:26:19 +00:00
|
|
|
|
|
|
|
echo 'bug #38908: niceload: Ctrl-C should resume jobs if using -p'
|
|
|
|
# This should take 10 seconds to run + delay from niceload
|
|
|
|
# niceload killed after 1 sec => The delay from niceload should be no more than 1 second
|
|
|
|
stdout /usr/bin/time -f %e perl -e 'for(1..100) { select(undef, undef, undef, 0.1); } print "done\n"' | int &
|
|
|
|
niceload -vt 1 -s 10 -p $! &
|
|
|
|
export A=$!;
|
|
|
|
sleep 2;
|
|
|
|
kill -s INT $A;
|
|
|
|
wait
|
|
|
|
|
2012-11-19 23:39:25 +00:00
|
|
|
EOF
|
|
|
|
|
2013-11-22 17:24:09 +00:00
|
|
|
# TODO test -f + -t
|
|
|
|
|