1 | #
|
---|
2 | # MoleCuilder - creates and alters molecular systems
|
---|
3 | # Copyright (C) 2008-2012 University of Bonn
|
---|
4 | #
|
---|
5 | # This program is free software: you can redistribute it and/or modify
|
---|
6 | # it under the terms of the GNU General Public License as published by
|
---|
7 | # the Free Software Foundation, either version 3 of the License, or
|
---|
8 | # (at your option) any later version.
|
---|
9 | #
|
---|
10 | # This program is distributed in the hope that it will be useful,
|
---|
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | # GNU General Public License for more details.
|
---|
14 | #
|
---|
15 | # You should have received a copy of the GNU General Public License
|
---|
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | #
|
---|
18 | ### fragment the molecule and check the number of configs
|
---|
19 |
|
---|
20 | AT_SETUP([Fragmentation - Automation: MoleCuilder Action])
|
---|
21 | AT_KEYWORDS([fragmentation automation molecuilder server worker])
|
---|
22 |
|
---|
23 | # check that ports are unique over all tests such that they may run in parallel
|
---|
24 | WORKERPORT=11065
|
---|
25 | CONTROLLERPORT=11066
|
---|
26 | WORKERLISTENPORT=11067
|
---|
27 |
|
---|
28 | # create job files for stand-in mpqc
|
---|
29 | i=0
|
---|
30 | while test -e ${abs_top_srcdir}/tests/JobMarket/pre/BondFragment`printf %02d $i`.out; do
|
---|
31 | nr=`printf %02d $i`
|
---|
32 | echo "Creating Job${nr}.in"
|
---|
33 | echo "${abs_top_srcdir}/tests/JobMarket/pre/BondFragment${nr}.out" >Job${nr}.in
|
---|
34 | ((i+=1))
|
---|
35 | done
|
---|
36 |
|
---|
37 | # start service in background
|
---|
38 | ${AUTOTEST_PATH}/molecuilder_server --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
|
---|
39 | server_pid=$!
|
---|
40 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
|
---|
41 |
|
---|
42 | # enlist a worker to work on jobs
|
---|
43 | ${AUTOTEST_PATH}/molecuilder_poolworker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
|
---|
44 | worker_pid=$!
|
---|
45 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
46 |
|
---|
47 | # use molecuilder to add jobs, wait for their completion and obtain results
|
---|
48 | AT_CHECK([../../molecuilder -i ${abs_top_srcdir}/tests/JobMarket/pre/heptan.xyz -v 3 --fragment-automation --fragment-executable "../../mpqc" --fragment-path "${abs_top_srcdir}/tests/JobMarket/pre/" --fragment-jobs Job??.in --server-address 127.0.0.1 --server-port $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
|
---|
49 | AT_CHECK([fgrep "There are 7 fragments" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
50 | AT_CHECK([fgrep "There are 23 atoms" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
51 | AT_XFAIL_IF([/bin/true])
|
---|
52 | AT_CHECK([fgrep "Resulting energy is -279.837" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
53 | AT_CHECK([fgrep "Resulting forces are" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
54 | AT_XFAIL_IF([/bin/false])
|
---|
55 |
|
---|
56 | # removeall to remove workers, then shutdown for server itself
|
---|
57 | AT_CHECK([${AUTOTEST_PATH}/molecuilder_controller --server 127.0.0.1:$CONTROLLERPORT --command removeall], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
|
---|
58 | AT_CHECK([${AUTOTEST_PATH}/molecuilder_controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
|
---|
59 |
|
---|
60 | # check that server is truely down
|
---|
61 | AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
|
---|
62 | AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
|
---|
63 |
|
---|
64 | AT_CLEANUP
|
---|