From: Richard W.M. Jones Date: Tue, 21 Feb 2012 16:04:14 +0000 (+0000) Subject: Add a test of many jobs running at once. X-Git-Tag: 0.0.1~7 X-Git-Url: http://git.annexia.org/?p=whenjobs.git;a=commitdiff_plain;h=390c7385b10707bef2f47df9915669eb46a40794;ds=sidebyside Add a test of many jobs running at once. --- diff --git a/tests/jobs/Makefile.am b/tests/jobs/Makefile.am index f6d0580..079a519 100644 --- a/tests/jobs/Makefile.am +++ b/tests/jobs/Makefile.am @@ -18,7 +18,7 @@ EXTRA_DIST = test_run.sh $(TESTS) TESTS_ENVIRONMENT = ./test_run.sh -TESTS = t100_counter.ml t101_updown.ml +TESTS = t100_counter.ml t101_updown.ml t102_manyjobs.ml OCAMLPACKAGES = -package unix,num,camlp4.lib,calendar,rpc -I ../../lib diff --git a/tests/jobs/t102_manyjobs.ml b/tests/jobs/t102_manyjobs.ml new file mode 100644 index 0000000..a586345 --- /dev/null +++ b/tests/jobs/t102_manyjobs.ml @@ -0,0 +1,62 @@ +(* whenjobs + * Copyright (C) 2012 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +when reloaded () : +<< + echo $JOBSERIAL $JOBNAME >\> $HOME/test_output + whenjobs --set counter 0 --type int +>> + +job "counter 1" +every second : +<< + echo $JOBSERIAL $JOBNAME >\> $HOME/test_output + whenjobs --set counter $(($counter+1)) --type int +>> + +job "counter 2" +every second : +<< + echo $JOBSERIAL $JOBNAME >\> $HOME/test_output + whenjobs --set counter $(($counter+1)) --type int +>> + +job "counter 3" +every second : +<< + echo $JOBSERIAL $JOBNAME >\> $HOME/test_output + whenjobs --set counter $(($counter+1)) --type int +>> + +job "counter 4" +every second : +<< + echo $JOBSERIAL $JOBNAME >\> $HOME/test_output + whenjobs --set counter $(($counter+1)) --type int +>> + +when increases counter : +<< + echo $JOBSERIAL $JOBNAME >\> $HOME/test_output +>> + +when counter == 10 : +<< + echo $JOBSERIAL $JOBNAME >\> $HOME/test_output + whenjobs --daemon-stop +>> diff --git a/tests/jobs/t102_manyjobs.ml.expected b/tests/jobs/t102_manyjobs.ml.expected new file mode 100644 index 0000000..bb94af7 --- /dev/null +++ b/tests/jobs/t102_manyjobs.ml.expected @@ -0,0 +1,53 @@ +1 job$1 +2 job$2 +3 counter 1 +4 counter 2 +5 counter 3 +6 counter 4 +7 job$2 +8 counter 1 +9 counter 2 +10 counter 3 +11 counter 4 +12 job$2 +13 counter 1 +14 counter 2 +15 counter 3 +16 counter 4 +17 job$2 +18 counter 1 +19 counter 2 +20 counter 3 +21 counter 4 +22 job$2 +23 counter 1 +24 counter 2 +25 counter 3 +26 counter 4 +27 job$2 +28 counter 1 +29 counter 2 +30 counter 3 +31 counter 4 +32 job$2 +33 counter 1 +34 counter 2 +35 counter 3 +36 counter 4 +37 job$2 +38 counter 1 +39 counter 2 +40 counter 3 +41 counter 4 +42 job$2 +43 counter 1 +44 counter 2 +45 counter 3 +46 counter 4 +47 job$2 +48 counter 1 +49 counter 2 +50 counter 3 +51 counter 4 +52 job$2 +53 job$3