Skip to content

run systemtests on installed packages#400

Merged
pstorz merged 27 commits intomasterfrom
dev/pstorz/master/run-systemtests-on-installed-packages
Jan 28, 2020
Merged

run systemtests on installed packages#400
pstorz merged 27 commits intomasterfrom
dev/pstorz/master/run-systemtests-on-installed-packages

Conversation

@pstorz
Copy link
Member

@pstorz pstorz commented Jan 24, 2020

This pull request enables the system tests to be optionally run on installed binaries like from packages.

Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a bit more than the description of the PR suggest, but OK.
The cmake formatting needs a quick review though.

. ./environment
${scripts}/bareos-config initialize_database_driver
${scripts}/bareos $@
${rscripts}/bareos $@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was that an intentional change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was intended. When running on installed files, some of the scripts are taken from the installation (scripts) and some are not part of the packages so need to be taken from the source tree (rscripts).

bareossql
PROPERTIES VERSION "${BAREOS_NUMERIC_VERSION}" SOVERSION
"${BAREOS_VERSION_MAJOR}"
bareossql PROPERTIES VERSION "${BAREOS_NUMERIC_VERSION}" SOVERSION
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something seems to be weird with cmake-format here, it seems to have formatted in a different way for you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that my cmake-format does it that way.

pstorz added 24 commits January 24, 2020 15:01
@pstorz pstorz force-pushed the dev/pstorz/master/run-systemtests-on-installed-packages branch from bb088e3 to f31fb90 Compare January 24, 2020 14:04
Copy link
Contributor

@franku franku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. However, some missing quotes here and there.

static std::string getenv_std_string(std::string env_var)
{
auto v{std::getenv(env_var.c_str())};
const char* v=(std::getenv(env_var.c_str()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const char* v=(std::getenv(env_var.c_str()));
const char* v = (std::getenv(env_var.c_str()));

{
std::vector<char> stime;
auto jcr{directordaemon::NewDirectorJcr()};
auto jcr=directordaemon::NewDirectorJcr();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto jcr=directordaemon::NewDirectorJcr();
auto jcr = directordaemon::NewDirectorJcr();

@@ -2,4 +2,4 @@
# script to start and stop daemons for individual test
. ./environment
${scripts}/bareos-config initialize_database_driver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${scripts}/bareos-config initialize_database_driver
"${scripts}"/bareos-config initialize_database_driver

# wrapper script to start/stop bconsole for each individual test
. ./environment
${bin}/bconsole -c ${conf} "$@"
${BAREOS_BCONSOLE_BINARY} -c ${conf} "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${BAREOS_BCONSOLE_BINARY} -c ${conf} "$@"
"${BAREOS_BCONSOLE_BINARY}" -c "${conf}" "$@"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BAREOS_BCONSOLE_BINARY and others should all be quoted accordingly.

PROJECT_BINARY_DIR=@PROJECT_BINARY_DIR@
bin=${PROJECT_BINARY_DIR}/bin
sbin=${PROJECT_BINARY_DIR}/sbin
bin=@bin@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bin=@bin@
bin="@bin@"


dumps=${current_test_directory}/dumps
plugindir=${PROJECT_BINARY_DIR}/plugins
plugindir=@plugins@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
plugindir=@plugins@
plugindir="@plugins@"

echo "running $0"
${scripts}/bareos-config initialize_database_driver
. ${scripts}/functions
. ${rscripts}/functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. ${rscripts}/functions
. "${rscripts}/functions"

END_OF_DATA

if ! ${bin}/bconsole -c "${conf}" -p etc/user1.cred < $tmp/bconcmds >${tmp}/log1.out 2>${tmp}/err1.out; then
if ! ${BAREOS_BCONSOLE_BINARY} -c "${conf}" -p etc/user1.cred < $tmp/bconcmds >${tmp}/log1.out 2>${tmp}/err1.out; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ! ${BAREOS_BCONSOLE_BINARY} -c "${conf}" -p etc/user1.cred < $tmp/bconcmds >${tmp}/log1.out 2>${tmp}/err1.out; then
if ! "${BAREOS_BCONSOLE_BINARY}" -c "${conf}" -p etc/user1.cred < $tmp/bconcmds >${tmp}/log1.out 2>${tmp}/err1.out; then

print_debug "OK: login as user1 succeeded."

if ${bin}/bconsole -c "${conf}" -p etc/user2.cred < $tmp/bconcmds >${tmp}/log2.out 2>${tmp}/err2.out; then
if ${BAREOS_BCONSOLE_BINARY} -c "${conf}" -p etc/user2.cred < $tmp/bconcmds >${tmp}/log2.out 2>${tmp}/err2.out; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ${BAREOS_BCONSOLE_BINARY} -c "${conf}" -p etc/user2.cred < $tmp/bconcmds >${tmp}/log2.out 2>${tmp}/err2.out; then
if "${BAREOS_BCONSOLE_BINARY}" -c "${conf}" -p etc/user2.cred < $tmp/bconcmds >${tmp}/log2.out 2>${tmp}/err2.out; then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check other occurences as well, please



if ! ${scripts}/bareos-ctl-dir status >/dev/null; then
if ! ${rscripts}/bareos-ctl-dir status >/dev/null; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ! ${rscripts}/bareos-ctl-dir status >/dev/null; then
if ! "${rscripts}"/bareos-ctl-dir status >/dev/null; then

- moved common reload-xxx-test functions into one script
- quoting of variables
- enable shellcheck to follow sourced files
- added missing function parameters
- fix order of output redirection
- set /bin/bash as shell where required
@pstorz pstorz force-pushed the dev/pstorz/master/run-systemtests-on-installed-packages branch from 28d4137 to f98f608 Compare January 28, 2020 07:57
. ./environment
${BAREOS_BCONSOLE_BINARY} -c ${conf} "$@"

"${BAREOS_BCONSOLE_BINARY}" -c ${conf} "$@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${conf} -> "${conf}"

rm -rf "${working:?}"/CLEANUPMARKER
rm -rf "${working:?}"/plugins/*
rm -rf "${archivedir:?}"/*
rm -f "${config_directory_dir_additional_test_config}"/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

fi

if [ $bstat != 0 -o $rstat != 0 ] ; then
if [ $bstat != 0 ] || [ $rstat != 0 ] ; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"!=" does a string-comparison, numerically not-equal is "-ne"

exit 1
fi
if [ "$dstat" != "0" -o "$bstat" != "0" -o "$rstat" != "0" ] ; then
if [ "$dstat" != "0" ] || [ "$bstat" != "0" ] || [ "$rstat" != "0" ] ; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. Should be -ne instead of !=

echo " !!!!! $TestName failed!!! $ENDDATE !!!!! " >>test.out
echo " Status: zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
if [ $bstat != 0 -o $rstat != 0 ] ; then
if [ $bstat != 0 ] || [ $rstat != 0 ] ; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. Should be -ne instead of !=

#shellcheck source=../environment.in
. ./environment

JobName=backup-bareos-fd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this correct? The original JobName was "bconsole-status-client"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JobName is irrelevant here as no job is run at all in this test.

num_eos=$(grep -c '^End Job Session Record:$' "$tmp/bscan.out")
if [ "$num_eos" -ne 1 ]; then
echo "Found $eum_sos end of session records instead of 1"
echo "Found $num_sos end of session records instead of 1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, must be $num_eos

num_eos=$(grep -c '^End Job Session Record:$' "$tmp/bscan.out")
if [ "$num_eos" -ne 1 ]; then
echo "Found $eum_sos end of session records instead of 1"
echo "Found $num_sos end of session records instead of 1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, must be $num_eos

grep "Using Device \"MultiFileStorage0003\"" ${tmp}/log1.out 2>&1 >/dev/null
grep "Using Device \"MultiFileStorage0001\"" ${tmp}/log1.out >/dev/null 2>&1 &&
grep "Using Device \"MultiFileStorage0002\"" ${tmp}/log1.out >/dev/null 2>&1 &&
grep "Using Device \"MultiFileStorage0003\"" ${tmp}/log1.out >/dev/null 2>&1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$tmp should be quoted

num_eos=$(grep -c '^End Job Session Record:$' "$tmp/bscan.out")
if [ "$num_eos" -ne 1 ]; then
echo "Found $eum_sos end of session records instead of 1"
echo "Found $num_sos end of session records instead of 1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$num_eos again

@pstorz pstorz merged commit ee457bb into master Jan 28, 2020
@pstorz pstorz deleted the dev/pstorz/master/run-systemtests-on-installed-packages branch January 28, 2020 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants