Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
systemtests: use individual binary names per test
avoids the interference between different tests when stopping
the daemons.

Also refactored CMakeLists.txt
  • Loading branch information
pstorz committed Jan 15, 2020
1 parent 7c426c4 commit d420756
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 44 deletions.
3 changes: 2 additions & 1 deletion core/scripts/bareos-ctl-dir.in
Expand Up @@ -11,7 +11,8 @@ export AWK="@AWK@"
export PIDOF="@PIDOF@"
export PGREP="@PGREP@"

BAREOS_DIRECTOR_BINARY="${BAREOS_BIN_DIR:-@sbindir@/bareos-dir}"
PIDDIR=${PIDDIR:-@piddir@}
BAREOS_DIRECTOR_BINARY="${BAREOS_DIRECTOR_BINARY:-@sbindir@/bareos-dir}"
export BAREOS_CONFIG_DIR=${BAREOS_CONFIG_DIR:-@confdir@}
BAREOS_DIRECTOR_PORT=${BAREOS_DIRECTOR_PORT:-@dir_port@}
BAREOS_DIRECTOR_USER=${BAREOS_DIRECTOR_USER:-@dir_user@}
Expand Down
18 changes: 10 additions & 8 deletions core/scripts/bareos-ctl-fd.in
Expand Up @@ -22,8 +22,10 @@ AWK=@AWK@
# easier to "steal" this code for the development
# environment where they are different.
#
BIN=@sbindir@/bareos-fd
PIDDIR=@piddir@


BAREOS_FILEDAEMON_BINARY=${BAREOS_FILEDAEMON_BINARY:-@sbindir@/bareos-fd}
PIDDIR=${PIDDIR:-@piddir@}
SUBSYSDIR=@subsysdir@

BAREOS_CONFIG_DIR=${BAREOS_CONFIG_DIR:-@confdir@}
Expand All @@ -49,7 +51,7 @@ fi

case "$1" in
start)
if [ -x ${BIN} ]; then
if [ -x ${BAREOS_FILEDAEMON_BINARY} ]; then
echo "Starting the $Bareos File daemon"
OPTIONS=''
if [ "${BAREOS_FD_USER}" != '' ]; then
Expand All @@ -65,17 +67,17 @@ case "$1" in
fi

if [ "x${VALGRIND_FD}" = "x1" ]; then
valgrind --leak-check=full ${BIN} -v $2 $3 ${OPTIONS}
valgrind --leak-check=full ${BAREOS_FILEDAEMON_BINARY} -v $2 $3 ${OPTIONS}
else
${BIN} -v $2 $3 ${OPTIONS}
${BAREOS_FILEDAEMON_BINARY} -v $2 $3 ${OPTIONS}
fi
fi
;;

stop)
if [ -x ${BIN} ]; then
if [ -x ${BAREOS_FILEDAEMON_BINARY} ]; then
echo "Stopping the $Bareos File daemon"
killproc ${BIN} ${BAREOS_FD_PORT}
killproc ${BAREOS_FILEDAEMON_BINARY} ${BAREOS_FD_PORT}
fi
;;

Expand All @@ -86,7 +88,7 @@ case "$1" in
;;

status)
[ -x ${BIN} ] && status ${BIN} ${BAREOS_FD_PORT}
[ -x ${BAREOS_FILEDAEMON_BINARY} ] && status ${BAREOS_FILEDAEMON_BINARY} ${BAREOS_FD_PORT}
exit $?
;;

Expand Down
16 changes: 8 additions & 8 deletions core/scripts/bareos-ctl-sd.in
Expand Up @@ -22,8 +22,8 @@ AWK=@AWK@
# easier to "steal" this code for the development
# environment where they are different.
#
BIN=@sbindir@/bareos-sd
export PIDDIR=@piddir@
BAREOS_STORAGEDAEMON_BINARY=${BAREOS_STORAGEDAEMON_BINARY:-@sbindir@/bareos-sd}
PIDDIR=${PIDDIR:-@piddir@}
SUBSYSDIR=@subsysdir@

BAREOS_CONFIG_DIR=${BAREOS_CONFIG_DIR:-@confdir@}
Expand All @@ -49,7 +49,7 @@ fi

case "$1" in
start)
if [ -x ${BIN} ]; then
if [ -x ${BAREOS_STORAGEDAEMON_BINARY} ]; then
echo "Starting the $Bareos Storage daemon"
OPTIONS=''
if [ "${BAREOS_SD_USER}" != '' ]; then
Expand All @@ -65,17 +65,17 @@ case "$1" in
fi

if [ "x${VALGRIND_SD}" = "x1" ]; then
valgrind --leak-check=full ${BIN} -v $2 $3 ${OPTIONS}
valgrind --leak-check=full ${BAREOS_STORAGEDAEMON_BINARY} -v $2 $3 ${OPTIONS}
else
${BIN} -v $2 $3 ${OPTIONS}
${BAREOS_STORAGEDAEMON_BINARY} -v $2 $3 ${OPTIONS}
fi
fi
;;

stop)
if [ -x ${BIN} ]; then
if [ -x ${BAREOS_STORAGEDAEMON_BINARY} ]; then
echo "Stopping the $Bareos Storage daemon"
killproc ${BIN} ${BAREOS_SD_PORT}
killproc ${BAREOS_STORAGEDAEMON_BINARY} ${BAREOS_SD_PORT}
fi
;;

Expand All @@ -86,7 +86,7 @@ case "$1" in
;;

status)
[ -x ${BIN} ] && status ${BIN} ${BAREOS_SD_PORT}
[ -x ${BAREOS_STORAGEDAEMON_BINARY} ] && status ${BAREOS_STORAGEDAEMON_BINARY} ${BAREOS_SD_PORT}
exit $?
;;

Expand Down
68 changes: 41 additions & 27 deletions systemtests/CMakeLists.txt
Expand Up @@ -45,10 +45,6 @@ function(ConfigureFilesToSystemtest srcbasedir dirname globexpression
${configure_option}
)
endforeach()
# message(
# STATUS
# "Configured ${COUNT} files from ${srcbasedir}/${srcdirname} to ${dirname} with glob ${globexpression} ${configure_option}"
#)
endfunction()

# generic function to probe for a python module
Expand Down Expand Up @@ -200,14 +196,42 @@ macro(prepare_test)
file(MAKE_DIRECTORY ${confdir})
file(MAKE_DIRECTORY ${working_dir})
file(MAKE_DIRECTORY ${config_directory_dir_additional_test_config})
# create a bin/bareos and bin/bconsole script in every testdir for start/stop
# and bconsole
# create a bin/bareos and bin/bconsole script in every testdir for
# start/stop and bconsole
file(MAKE_DIRECTORY "${current_test_directory}/bin")
configure_file("bin/bconsole" "${current_test_directory}/bin/bconsole" COPYONLY)
configure_file(
"bin/bconsole" "${current_test_directory}/bin/bconsole" COPYONLY
)
configure_file("bin/bareos" "${current_test_directory}/bin/bareos" COPYONLY)

set(BAREOS_DIRECTOR_BINARY
${current_test_directory}/sbin/bareos-dir-${TEST_NAME}
)
set(BAREOS_STORAGEDAEMON_BINARY
${current_test_directory}/sbin/bareos-sd-${TEST_NAME}
)
set(BAREOS_FILEDAEMON_BINARY
${current_test_directory}/sbin/bareos-fd-${TEST_NAME}
)
file(MAKE_DIRECTORY "${current_test_directory}/sbin")
create_symlink(
"${CMAKE_CURRENT_BINARY_DIR}/sbin/bareos-dir" "${BAREOS_DIRECTOR_BINARY}"
)
create_symlink(
"${CMAKE_CURRENT_BINARY_DIR}/sbin/bareos-sd"
"${BAREOS_STORAGEDAEMON_BINARY}"
)
create_symlink(
"${CMAKE_CURRENT_BINARY_DIR}/sbin/bareos-fd"
"${BAREOS_FILEDAEMON_BINARY}"
)
endif()
endmacro()

macro(create_symlink target link)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${target} ${link})
endmacro()

# extract db version from cats.h
file(STRINGS ${CMAKE_SOURCE_DIR}/core/src/cats/cats.h DB_VERSION_STRING
REGEX .*BDB_VERSION.*
Expand Down Expand Up @@ -321,10 +345,7 @@ file(MAKE_DIRECTORY ${scripts})
file(MAKE_DIRECTORY ${working})
file(MAKE_DIRECTORY ${archivedir})

execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink ${scriptdir}/btraceback
${sbindir}/btraceback
)
create_symlink(${scriptdir}/btraceback ${sbindir}/btraceback)

file(REMOVE_RECURSE ${scripts}/ddl)
file(RENAME ${PROJECT_BINARY_DIR}/ddl ${scripts}/ddl)
Expand Down Expand Up @@ -580,10 +601,9 @@ set(BINARIES_TO_LINK_TO_SBIN

foreach(BINARY_SOURCEPATH ${BINARIES_TO_LINK_TO_SBIN})
get_filename_component(BINARY_NAME ${BINARY_SOURCEPATH} NAME)
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
${PROJECT_BINARY_DIR}/../core/src/${BINARY_SOURCEPATH}
${sbindir}/${BINARY_NAME}
create_symlink(
${PROJECT_BINARY_DIR}/../core/src/${BINARY_SOURCEPATH}
${sbindir}/${BINARY_NAME}
)
endforeach()

Expand All @@ -603,19 +623,13 @@ set(BINARIES_TO_LINK_TO_BIN

foreach(BINARY_SOURCEPATH ${BINARIES_TO_LINK_TO_BIN})
get_filename_component(BINARY_NAME ${BINARY_SOURCEPATH} NAME)
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
${PROJECT_BINARY_DIR}/../core/src/${BINARY_SOURCEPATH}
${bindir}/${BINARY_NAME}
create_symlink(
${PROJECT_BINARY_DIR}/../core/src/${BINARY_SOURCEPATH}
${bindir}/${BINARY_NAME}
)
endforeach()

execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
${PROJECT_BINARY_DIR}/../core/src/console/bconsole ${bindir}/bconsole
)

execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink ${scriptdir}/bareos
${bindir}/bareos
create_symlink(
${PROJECT_BINARY_DIR}/../core/src/console/bconsole ${bindir}/bconsole
)
create_symlink(${scriptdir}/bareos ${bindir}/bareos)
7 changes: 7 additions & 0 deletions systemtests/environment.in
Expand Up @@ -51,6 +51,13 @@ export BAREOS_DIRECTOR_PORT=@dir_port@
export BAREOS_STORAGE_PORT=@sd_port@
export BAREOS_STORAGE2_PORT=@sd2_port@
export BAREOS_FD_PORT=@fd_port@

export BAREOS_DIRECTOR_BINARY=@BAREOS_DIRECTOR_BINARY@
export BAREOS_FILEDAEMON_BINARY=@BAREOS_FILEDAEMON_BINARY@
export BAREOS_STORAGEDAEMON_BINARY=@BAREOS_STORAGEDAEMON_BINARY@



export PIDDIR=@piddir@

export archivedir
Expand Down

0 comments on commit d420756

Please sign in to comment.