Index: ThirdParty/JobMarket/tests/CodeChecks/Makefile.am
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/Makefile.am	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/Makefile.am	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,61 @@
+AUTOM4TE = autom4te
+
+TESTSUITE = $(srcdir)/testsuite
+
+TESTSCRIPTS = \
+	testsuite-config_h.at \
+	testsuite-date_in_dox.at \
+	testsuite-header-dist.at \
+	testsuite-memdebug.at \
+	testsuite-project-disclaimer.at
+
+DISTCLEANFILES = atconfig
+
+EXTRA_DIST = \
+	atlocal.in \
+	package.m4 \
+	testsuite.at \
+	$(TESTSUITE) \
+	$(TESTSCRIPTS)
+
+max_jobs = 4
+ 
+check-local: atlocal package.m4 $(TESTSUITE)
+	nrjobs=; \
+	for flag in $$MAKEFLAGS; do \
+		case $$flag in \
+		--* | =*=) ;; \
+		*j*) nrjobs="-j$(max_jobs)" ;; \
+		esac; \
+	done; \
+	$(SHELL) '$(TESTSUITE)' $$nrjobs AUTOTEST_PATH='$(abs_top_builddir)/src' $(TESTSUITEFLAGS)
+
+installcheck-local: atconfig atlocal $(TESTSUITE)
+	nrjobs=; \
+	for flag in $$MAKEFLAGS; do \
+		case $$flag in \
+		--* | =*=) ;; \
+		*j*) nrjobs="-j$(max_jobs)" ;; \
+		esac; \
+	done; \
+	$(SHELL) '$(TESTSUITE)' $$nrjobs AUTOTEST_PATH='$(bindir)' $(TESTSUITEFLAGS)
+
+clean-local:
+	test ! -f '$(TESTSUITE)' || \
+	$(SHELL) '$(TESTSUITE)' --clean
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): $(srcdir)/testsuite.at package.m4 $(TESTSCRIPTS)
+	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+	mv $@.tmp $@
+
+# The `:;' works around a Bash 3.2 bug when the output is not writeable.
+package.m4: $(top_srcdir)/configure.ac
+	:;{ \
+		echo '# Signature of the current package.' && \
+		echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
+		echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
+		echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
+		echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
+		echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >'$(srcdir)/package.m4'
Index: ThirdParty/JobMarket/tests/CodeChecks/atlocal.in
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/atlocal.in	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/atlocal.in	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,1 @@
+abs_top_srcdir='@abs_top_srcdir@'
Index: ThirdParty/JobMarket/tests/CodeChecks/testsuite-config_h.at
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/testsuite-config_h.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/testsuite-config_h.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,25 @@
+AT_SETUP([Checking for present config.h include])
+AT_KEYWORDS([CodeCheck config_h])
+ok=""
+echo `pwd`
+echo "${#ok[*]} are ok to not contain config.h: ${ok[*]}."
+liste=`find ${abs_top_srcdir}/src -name '*.?pp'`
+for file in $liste
+do
+  # check whether its one of the excluded ones
+  found=0
+  for item in $ok
+  do
+    if test "$item" == "`basename $file`"
+    then
+      found=1
+      break
+    fi
+  done
+  # if not, check whether it contains the include
+  if test $found -eq 0
+  then
+    AT_CHECK([egrep -q '^#include.*config.h' $file], 0, [ignore], [ignore], [echo "Could not find config.h include in $file."])
+  fi
+done
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/CodeChecks/testsuite-date_in_dox.at
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/testsuite-date_in_dox.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/testsuite-date_in_dox.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,25 @@
+AT_SETUP([Checking for present date stamp in .dox files])
+AT_KEYWORDS([CodeCheck dox date_in_dox])
+ok=""
+echo `pwd`
+echo "${#ok[*]} are ok to not contain date in .dox: ${ok[*]}."
+liste=`find ${abs_top_srcdir}/src -name '*.dox'`
+for file in $liste
+do
+  # check whether its one of the excluded ones
+  found=0
+  for item in $ok
+  do
+    if test "$item" == "`basename $file`"
+    then
+      found=1
+      break
+    fi
+  done
+  # if not, check whether it contains the include
+  if test $found -eq 0
+  then
+    AT_CHECK([egrep -q '\date [[0-9]]{4}-[[0-2]][[0-9]]-[[0-3]][[0-9]]' $file], 0, [ignore], [ignore], [echo "Could not find date stamp in $file."])
+  fi
+done
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/CodeChecks/testsuite-header-dist.at
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/testsuite-header-dist.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/testsuite-header-dist.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,27 @@
+AT_SETUP([Checking that header files get distributed])
+AT_KEYWORDS([CodeCheck header])
+
+ok=""
+echo "${#ok[*]} are ok not to get distributed: ${ok[*]}."
+Makefiles=`find ${abs_top_srcdir}/src -name Makefile.am`
+liste=`find ${abs_top_srcdir}/src -name '*.hpp'`
+for header in $liste; do
+  filename=`basename $header`
+  # check whether it is one of the excluded ones
+  found=0
+  for item in $ok
+  do
+    if test x"$item" == x"$filename"
+    then
+      found=1
+      break
+    fi
+  done
+  # if not, check whether it contains the include
+  if test $found -eq 0
+  then
+    AT_CHECK([egrep -q $filename $Makefiles], 0, [ignore], [ignore], [echo "$filename is not present in any Makefile.am and thus won't get distributed. Either add to the module's Makefile.am's ..._SOURCES or at least to EXTRADIST."])
+  fi
+done
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/CodeChecks/testsuite-memdebug.at
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/testsuite-memdebug.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/testsuite-memdebug.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,28 @@
+AT_SETUP([Checking for present MemDebug.hpp include])
+AT_KEYWORDS([CodeCheck MemDebug])
+ok=""
+echo `pwd`
+echo "${#ok[*]} are ok to not contain MemDebug.hpp: ${ok[0]} ${ok[1]}."
+liste=`find ${abs_top_srcdir}/src -name '*.cpp'`
+for file in $liste
+do
+  # check whether its one of the excluded ones
+  found=0
+  for item in $ok
+  do
+    if test "$item" == "`basename $file`"
+    then
+      found=1
+      break
+    fi
+  done
+  # if not, check whether it contains the include if its NOT a unit test
+  if test -z `echo $file | grep unittests`
+  then
+    if test $found -eq 0
+    then
+      AT_CHECK([egrep -q '^#include.*MemDebug.hpp' $file], 0, [ignore], [ignore], [echo "Could not find MemDebug.hpp include in $file."])
+    fi
+  fi
+done
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/CodeChecks/testsuite-project-disclaimer.at
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/testsuite-project-disclaimer.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/testsuite-project-disclaimer.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,26 @@
+AT_SETUP([Checking for present project disclaimer])
+AT_KEYWORDS([CodeCheck disclaimer])
+ok=""
+echo `pwd`
+echo "${#ok[*]} are ok to not contain config.h: ${ok[*]}."
+liste=`find ${abs_top_srcdir}/src -name '*.cpp'`
+for file in $liste
+do
+  # check whether its one of the excluded ones
+  found=0
+  for item in $ok
+  do
+    if test "$item" == "`basename $file`"
+    then
+      found=1
+      break
+    fi
+  done
+  # if not, check whether it contains the include
+  if test $found -eq 0
+  then
+    AT_CHECK([egrep -q " * Project: JobMarket" $file], 0, [ignore], [ignore], [echo "Could not find project disclaimer in $file."])
+    AT_CHECK([egrep -q " * Copyright.* Frederik Heber" $file], 0, [ignore], [ignore], [echo "Could not find copyright in $file."])
+  fi
+done
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/CodeChecks/testsuite.at
===================================================================
--- ThirdParty/JobMarket/tests/CodeChecks/testsuite.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/CodeChecks/testsuite.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,23 @@
+# Process with autom4te to create an -*- Autotest -*- test suite.
+#
+# see regression/... subdirs wherein for each of the cases and each check (enumerated) is a pre and post dir. 
+# In pre initial files are placed, in post results can be found to be checked by diff in this testsuite.
+
+AT_INIT([Job Market])
+AT_TESTED(egrep find grep)
+
+# Use colored output with new-enough Autotest.
+m4_ifdef([AT_COLOR_TESTS], [AT_COLOR_TESTS])
+
+AT_BANNER([JobMarket - Code Checks])
+m4_include(atlocal)
+
+m4_include(testsuite-config_h.at)
+
+m4_include(testsuite-date_in_dox.at)
+
+m4_include(testsuite-memdebug.at)
+
+m4_include(testsuite-project-disclaimer.at)
+
+m4_include(testsuite-header-dist.at)
Index: ThirdParty/JobMarket/tests/Makefile.am
===================================================================
--- ThirdParty/JobMarket/tests/Makefile.am	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/Makefile.am	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,6 @@
+SUBDIRS =
+
+SUBDIRS += \
+	CodeChecks \
+	regression
+
Index: ThirdParty/JobMarket/tests/regression/Makefile.am
===================================================================
--- ThirdParty/JobMarket/tests/regression/Makefile.am	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/Makefile.am	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,67 @@
+AUTOM4TE = $(SHELL) $(top_srcdir)/build-aux/missing --run autom4te
+
+EXTRA_DIST = \
+	testsuite.at \
+	$(TESTSUITE) \
+	$(TESTSCRIPTS) \
+	atlocal.in \
+	$(srcdir)/package.m4
+
+TESTSUITE = $(srcdir)/testsuite
+
+DISTCLEANFILES = atconfig
+
+TESTSCRIPTS =
+
+TESTSCRIPTS += \
+	$(srcdir)/testsuite-addingjobs.at \
+	$(srcdir)/testsuite-checkstate.at \
+	$(srcdir)/testsuite-checkalive.at \
+	$(srcdir)/testsuite-completerun.at \
+	$(srcdir)/testsuite-enrollinpool.at \
+	$(srcdir)/testsuite-getresults.at \
+	$(srcdir)/testsuite-resubmitjobs.at \
+	$(srcdir)/testsuite-server-shutdown.at \
+	$(srcdir)/testsuite-server-worker.at
+
+max_jobs = 4
+ 
+check-local: atconfig atlocal $(TESTSUITE)
+	nrjobs=; \
+	for flag in $$MAKEFLAGS; do \
+		case $$flag in \
+		--* | =*=) ;; \
+		*j*) nrjobs="-j$(max_jobs)" ;; \
+		esac; \
+	done; \
+	$(SHELL) '$(TESTSUITE)' $$nrjobs AUTOTEST_PATH='$(abs_top_builddir)/src/JobMarket' $(TESTSUITEFLAGS)
+
+installcheck-local: atconfig atlocal $(TESTSUITE)
+	nrjobs=; \
+	for flag in $$MAKEFLAGS; do \
+		case $$flag in \
+		--* | =*=) ;; \
+		*j*) nrjobs="-j$(max_jobs)" ;; \
+		esac; \
+	done; \
+	$(SHELL) '$(TESTSUITE)' $$nrjobs AUTOTEST_PATH='$(bindir)' $(TESTSUITEFLAGS)
+
+clean-local:
+	test ! -f '$(TESTSUITE)' || \
+	$(SHELL) '$(TESTSUITE)' --clean
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): $(srcdir)/testsuite.at package.m4 $(TESTSCRIPTS)
+	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+	mv $@.tmp $@
+
+# The `:;' works around a Bash 3.2 bug when the output is not writeable.
+package.m4: $(top_srcdir)/configure.ac
+	:;{ \
+		echo '# Signature of the current package.' && \
+		echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
+		echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
+		echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
+		echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
+		echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >'$(srcdir)/package.m4'
Index: ThirdParty/JobMarket/tests/regression/atlocal.in
===================================================================
--- ThirdParty/JobMarket/tests/regression/atlocal.in	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/atlocal.in	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,1 @@
+abs_top_srcdir='@abs_top_srcdir@'
Index: ThirdParty/JobMarket/tests/regression/testsuite-addingjobs.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-addingjobs.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-addingjobs.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,36 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Adding jobs])
+AT_KEYWORDS([fragmentation automation server worker jobadder])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1035
+CONTROLLERPORT=1036
+WORKERLISTENPORT=1037
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# add one SystemCommandJob via JobAdder
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "cat" --jobcommand "Nothing"], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Sending 1 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
+
+# ann one NoOpJob
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Creating 1 new NoOpJob(s)." stdout], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Sending 1 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
+
+# clear all waiting jobs
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command removealljobs], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# shutdown
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-checkalive.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-checkalive.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-checkalive.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,50 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Dead Worker is removed])
+AT_KEYWORDS([fragmentation automation controller poolworker server checkalive])
+
+WORKERPORT=1075
+CONTROLLERPORT=1076
+WORKERLISTENPORT=1077
+
+TIMEOUT=3
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer -v 5 --workerport $WORKERPORT --controllerport $CONTROLLERPORT --timeout $TIMEOUT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# let worker enroll in pool
+${AUTOTEST_PATH}/JobMarketPoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
+worker_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# create script to call
+AT_DATA([sleep.sh], [#!/bin/bash
+sleep `cat <$1`
+])
+AT_CHECK([chmod +x sleep.sh], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+# add one jobs via JobAdder that needs at least TIMEOUT time
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "./sleep.sh" --jobcommand "3"], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Sending 1 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# send kill signal to worker such that it shuts down _not_ properly
+AT_CHECK([kill -9 $worker_pid], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# let more than timeout time pass
+let timetopass=2*$TIMEOUT
+AT_CHECK([sleep $timetopass], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# clear resubmit job from queue
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command removealljobs], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# shutdown server, should be without glitch as no worker is left
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# check that Server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-checkstate.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-checkstate.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-checkstate.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,26 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Checking results])
+AT_KEYWORDS([fragmentation automation server resultchecker])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1040
+CONTROLLERPORT=1041
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# check jobs
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command checkresults], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "0 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid])
+
+# shutdown
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-completerun.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-completerun.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-completerun.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,57 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Complete run])
+AT_KEYWORDS([fragmentation automation jobadder resultgetter resultchecker server shutdowner worker])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1050
+CONTROLLERPORT=1051
+WORKERLISTENPORT=1052
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# add thre jobs via JobAdder
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "cat" --jobcommand "Nothing" --times 3], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Sending 3 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
+
+# Checking results
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command checkresults], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "#3 are waiting in the queue and #0 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid])
+
+# enlist a worker to work on jobs
+${AUTOTEST_PATH}/JobMarketPoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
+worker_pid=$!
+AT_CHECK([sleep 2], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# send kill signal to worker such that it shuts down
+AT_CHECK([kill -INT $worker_pid], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# Checking results
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command checkresults], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep "#0 are waiting in the queue and #3 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# get "no" results
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command receiveresults], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep "Received 0 results" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# Checking results
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command checkresults], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep "#0 are waiting in the queue and #3 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# get results
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command receiveresults --ids 1 2 3], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep "Received 3 results" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep -c "Nothing" stdout], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([grep "3" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# shutdown
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-enrollinpool.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-enrollinpool.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-enrollinpool.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,38 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Worker enrolls in pool])
+AT_KEYWORDS([fragmentation automation controller poolworker server shutdown])
+
+WORKERPORT=1055
+CONTROLLERPORT=1056
+WORKERLISTENPORT=1057
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# check help of poolworker
+AT_CHECK([${AUTOTEST_PATH}/JobMarketPoolWorker -h], 1, [ignore], [ignore], [kill $server_pid])
+
+# let worker enroll in pool
+${AUTOTEST_PATH}/JobMarketPoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
+worker_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# add one jobs via JobAdder
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "cat" --jobcommand "Nothing"], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep "Sending 1 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# send kill signal to worker such that it shuts down properly
+AT_CHECK([kill -2 $worker_pid], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# shutdown server as well
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# check that Server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([kill $server_pid $worker_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-getresults.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-getresults.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-getresults.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,30 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Getting results])
+AT_KEYWORDS([fragmentation automation server resultgetter])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1045
+CONTROLLERPORT=1046
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# directly obtain 0 results
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command receiveresults], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Received 0 results" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# directly obtain non-present results
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command receiveresults --ids 1], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Received 0 results" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# shutdown
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-resubmitjobs.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-resubmitjobs.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-resubmitjobs.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,41 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Resubmitting failed jobs])
+AT_KEYWORDS([fragmentation automation server worker jobadder])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1070
+CONTROLLERPORT=1071
+WORKERLISTENPORT=1072
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# add one always failing job via JobAdder
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "/bin/false" --jobcommand "Nothing"], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Sending 1 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
+
+# enlist a worker to work on jobs
+${AUTOTEST_PATH}/JobMarketPoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT 2>workererr &
+worker_pid=$!
+AT_CHECK([sleep 2], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# send kill signal to worker such that it shuts down
+AT_CHECK([kill -INT $worker_pid], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# check that it truely failed for four times
+AT_CHECK([fgrep -c "Job 1 failed on executing" workererr], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([grep "4" stdout], 0, [ignore], [ignore])
+
+# shutdown
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [ignore], [ignore], [kill $server_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
+
+AT_CHECK([rm -f workererr], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-server-shutdown.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-server-shutdown.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-server-shutdown.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,22 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Server shutdown])
+AT_KEYWORDS([fragmentation automation server shutdowner])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1030
+CONTROLLERPORT=1031
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# shutdown server again
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid])
+
+# server shuts down as queue is empty
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite-server-worker.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite-server-worker.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite-server-worker.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,38 @@
+### fragment the molecule and check the number of configs
+
+AT_SETUP([Fragmentation - Automation: Server/Worker])
+AT_KEYWORDS([fragmentation automation server worker])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1025
+CONTROLLERPORT=1026
+WORKERLISTENPORT=1027
+
+# start service in background
+${AUTOTEST_PATH}/JobMarketServer --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# add one jobs 
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command createjobs --executable "cat" --jobcommand "Nothing"], 0, [ignore], [ignore], [kill $server_pid])
+
+# enlist a worker to work on jobs
+${AUTOTEST_PATH}/JobMarketPoolWorker -v 5 --signal 2 --server 127.0.0.1:${WORKERPORT} --hostname 127.0.0.1 --listen $WORKERLISTENPORT &
+worker_pid=$!
+AT_CHECK([sleep 2], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# send kill signal to worker such that it shuts down
+AT_CHECK([kill -INT $worker_pid], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# check number of done jobs
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command checkresults], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "#0 are waiting in the queue and #1 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid])
+
+# shutdown controller socket 
+AT_CHECK([${AUTOTEST_PATH}/JobMarketController --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: ThirdParty/JobMarket/tests/regression/testsuite.at
===================================================================
--- ThirdParty/JobMarket/tests/regression/testsuite.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
+++ ThirdParty/JobMarket/tests/regression/testsuite.at	(revision 363f2898862bc5529d83e0358237e36e9520c655)
@@ -0,0 +1,41 @@
+# Process with autom4te to create an -*- Autotest -*- test suite.
+#
+
+AT_INIT([JobMarket])
+AT_TESTED(diff grep egrep fgrep)
+
+# makes functions in CheckCommand.sh available within the tests
+# This is not yet working due to a bug in autotest (AC_CHECK cannot be used inside diversion)
+#m4_divert_push([PREPARE_TESTS])
+#m4_include([CheckCommand.sh])
+#m4_divert_pop([PREPARE_TESTS])
+
+# Use colored output with new-enough Autotest.
+m4_ifdef([AT_COLOR_TESTS], [AT_COLOR_TESTS])
+
+# check whether server shutdown works
+m4_include([testsuite-server-shutdown.at])
+
+# check whether poolworker may succesfully enroll in pool
+m4_include([testsuite-enrollinpool.at])
+
+# check whether adding jobs works
+m4_include([testsuite-addingjobs.at])
+
+# check whether dead busy poolworker is automatically removed
+m4_include([testsuite-checkalive.at])
+
+# check whether checking state works
+m4_include([testsuite-checkstate.at])
+
+# check whether getting results works
+m4_include([testsuite-getresults.at])
+
+# check whether Server/Client construct for automatized calculation is working
+m4_include([testsuite-server-worker.at])
+
+# check whether resubmitting of failed jobs works
+m4_include([testsuite-resubmitjobs.at])
+
+# check whether complete run works
+m4_include([testsuite-completerun.at])
