From 6a360389833ddecb4e818860d4c18ca63a08705e Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Fri, 22 Apr 2022 11:50:44 +0200 Subject: [PATCH 1/7] ua_configure.cc: quote director name when calling `configure export` --- core/src/dird/ua_configure.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/dird/ua_configure.cc b/core/src/dird/ua_configure.cc index be632afb954..1f34c371c6c 100644 --- a/core/src/dird/ua_configure.cc +++ b/core/src/dird/ua_configure.cc @@ -1,7 +1,7 @@ /* BAREOS® - Backup Archiving REcovery Open Sourced - Copyright (C) 2015-2021 Bareos GmbH & Co. KG + Copyright (C) 2015-2022 Bareos GmbH & Co. KG This program is Free Software; you can redistribute it and/or modify it under the terms of version three of the GNU Affero General Public @@ -232,7 +232,9 @@ static inline bool ConfigureCreateFdResourceString(UaContext* ua, password = &client->password_; resource.strcat("Director {\n"); - config_add_directive(NULL, NULL, "Name", me->resource_name_, resource); + + Mmsg(temp, "\"%s\"", me->resource_name_); + config_add_directive(NULL, NULL, "Name", temp.c_str(), resource); switch (password->encoding) { case p_encoding_clear: From 7e520c6bedf3c8bc5c6350534ef7ccb2f668b04d Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Fri, 22 Apr 2022 14:02:37 +0200 Subject: [PATCH 2/7] added `configure export` unit test --- core/src/tests/CMakeLists.txt | 17 +++++-- .../bareos-dir.d/client/bareos-fd.conf | 5 ++ .../bareos-dir.d/director/bareos-dir.conf | 4 ++ core/src/tests/configure.cc | 50 +++++++++++++++++++ 4 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 core/src/tests/configs/configure/bareos-dir.d/client/bareos-fd.conf create mode 100644 core/src/tests/configs/configure/bareos-dir.d/director/bareos-dir.conf create mode 100644 core/src/tests/configure.cc diff --git a/core/src/tests/CMakeLists.txt b/core/src/tests/CMakeLists.txt index 090d2fd204b..00f78690db2 100644 --- a/core/src/tests/CMakeLists.txt +++ b/core/src/tests/CMakeLists.txt @@ -466,13 +466,22 @@ if(NOT client-only) endif() # NOT client-only if(NOT client-only) - bareos_add_test(select_functions LINK_LIBRARIES dird_objects bareosfind bareossql GTest::gtest_main) + bareos_add_test( + select_functions LINK_LIBRARIES dird_objects bareosfind bareossql + GTest::gtest_main + ) endif() # NOT client-only if(NOT client-only) bareos_add_test( - dir_fd_connection - LINK_LIBRARIES testing_common dird_objects bareos bareossql bareosfind - GTest::gtest_main + dir_fd_connection LINK_LIBRARIES testing_common dird_objects bareos + bareossql bareosfind GTest::gtest_main + ) +endif() # NOT client-only + +if(NOT client-only) + bareos_add_test( + configure LINK_LIBRARIES testing_common dird_objects bareosfind bareossql + GTest::gtest_main ) endif() # NOT client-only diff --git a/core/src/tests/configs/configure/bareos-dir.d/client/bareos-fd.conf b/core/src/tests/configs/configure/bareos-dir.d/client/bareos-fd.conf new file mode 100644 index 00000000000..e2ee8181e0d --- /dev/null +++ b/core/src/tests/configs/configure/bareos-dir.d/client/bareos-fd.conf @@ -0,0 +1,5 @@ +Client { + Name = bareos-fd + Address = localhost + Password = "[md5]9999" +} diff --git a/core/src/tests/configs/configure/bareos-dir.d/director/bareos-dir.conf b/core/src/tests/configs/configure/bareos-dir.d/director/bareos-dir.conf new file mode 100644 index 00000000000..a6b9ecda314 --- /dev/null +++ b/core/src/tests/configs/configure/bareos-dir.d/director/bareos-dir.conf @@ -0,0 +1,4 @@ +Director { + Name = "bareos director" + Password = "" +} diff --git a/core/src/tests/configure.cc b/core/src/tests/configure.cc new file mode 100644 index 00000000000..fa48f005073 --- /dev/null +++ b/core/src/tests/configure.cc @@ -0,0 +1,50 @@ +/* + BAREOS® - Backup Archiving REcovery Open Sourced + + Copyright (C) 2022-2022 Bareos GmbH & Co. KG + + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero 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. +*/ + +#include "testing_dir_common.h" + +#include "dird/ua.h" +#include "include/jcr.h" +#include "dird/ua_configure.cc" + +TEST(ConfigureExport, ReturnsQuotedNameAndPassword) +{ + InitDirGlobals(); + std::string path_to_config + = std::string(RELATIVE_PROJECT_SOURCE_DIR "/configs/configure"); + PConfigParser client_config(DirectorPrepareResources(path_to_config)); + if (!client_config) { return; } + + + JobControlRecord jcr{}; + directordaemon::UaContext* ua = directordaemon::new_ua_context(&jcr); + PoolMem resource(PM_MESSAGE); + ConfigureCreateFdResourceString(ua, resource, "bareos-fd"); + std::string expected_output{ + "Director {\n" + " Name = \"bareos director\"\n" + " Password = \"[md5]9999\"\n" + "}\n"}; + + EXPECT_EQ(resource.c_str(), expected_output); + + FreeUaContext(ua); +} From c0273bb8dd9fec83b7d05883d096bcb794d5a891 Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Fri, 22 Apr 2022 11:46:26 +0200 Subject: [PATCH 3/7] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe73a60ced8..a414797e99f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https: - cats: make `.bvfs_update` and `.bvfs_versions` take archive jobs into consideration [PR #1152] - Fix `always-incremental-consolidate` systemtest sporadic fails, and rename it. [PR #1154] - packaging: FreeBSD place all scripts into "normal" location /usr/local/lib/bareos/scripts [PR #1163] +- [Issue #1445] adding quotes to director name when using `configure export`[PR #1171] ### Changed - contrib: rename Python modules to satisfy PEP8 [PR #768] From c0cd8fc207b9fab5981b2d6a7b5008c709091ee9 Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Fri, 22 Apr 2022 12:06:56 +0200 Subject: [PATCH 4/7] fixing headers and renaming --- core/src/tests/testing_common.h | 7 +++---- core/src/tests/testing_dir_common.h | 6 +++--- core/src/tests/testing_sd_common.cc | 6 +++--- core/src/tests/testing_sd_common.h | 27 ++++++++++++++++++++++++--- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/core/src/tests/testing_common.h b/core/src/tests/testing_common.h index 45fd05030f9..0e4258619b4 100644 --- a/core/src/tests/testing_common.h +++ b/core/src/tests/testing_common.h @@ -19,19 +19,18 @@ 02110-1301, USA. */ -#ifndef TESTING_COMMON_H -#define TESTING_COMMON_H +#ifndef BAREOS_TESTS_TESTING_COMMON_H_ +#define BAREOS_TESTS_TESTING_COMMON_H_ #if defined(HAVE_MINGW) # include "include/bareos.h" #endif #include "gtest/gtest.h" -#include "gmock/gmock.h" #include "lib/parse_conf.h" typedef std::unique_ptr PConfigParser; -#endif // TESTING_COMMON_H +#endif // BAREOS_TESTS_TESTING_COMMON_H_ diff --git a/core/src/tests/testing_dir_common.h b/core/src/tests/testing_dir_common.h index d355360a9d9..f6c98bc5f6d 100644 --- a/core/src/tests/testing_dir_common.h +++ b/core/src/tests/testing_dir_common.h @@ -19,8 +19,8 @@ 02110-1301, USA. */ -#ifndef TESTING_DIR_COMMON_H -#define TESTING_DIR_COMMON_H +#ifndef BAREOS_TESTS_TESTING_DIR_COMMON_H_ +#define BAREOS_TESTS_TESTING_DIR_COMMON_H_ #include "testing_common.h" @@ -31,4 +31,4 @@ void InitDirGlobals(); PConfigParser DirectorPrepareResources(const std::string& path_to_config); -#endif // TESTING_DIR_COMMON_H +#endif // BAREOS_TESTS_TESTING_DIR_COMMON_H_ diff --git a/core/src/tests/testing_sd_common.cc b/core/src/tests/testing_sd_common.cc index baa780fd209..32663063b03 100644 --- a/core/src/tests/testing_sd_common.cc +++ b/core/src/tests/testing_sd_common.cc @@ -40,9 +40,9 @@ PConfigParser StoragePrepareResources(const std::string& path_to_config) EXPECT_NE(storage_config.get(), nullptr); if (!storage_config) { return nullptr; } - bool parse_director_config_ok = storage_config->ParseConfig(); - EXPECT_TRUE(parse_director_config_ok) << "Could not parse storage config"; - if (!parse_director_config_ok) { return nullptr; } + bool parse_storage_config_ok = storage_config->ParseConfig(); + EXPECT_TRUE(parse_storage_config_ok) << "Could not parse storage config"; + if (!parse_storage_config_ok) { return nullptr; } Dmsg0(200, "Start UA server\n"); storagedaemon::me diff --git a/core/src/tests/testing_sd_common.h b/core/src/tests/testing_sd_common.h index 804857c0cdc..563757e0f41 100644 --- a/core/src/tests/testing_sd_common.h +++ b/core/src/tests/testing_sd_common.h @@ -1,5 +1,26 @@ -#ifndef TESTING_SD_COMMON_H -#define TESTING_SD_COMMON_H +/* + BAREOS® - Backup Archiving REcovery Open Sourced + + Copyright (C) 2021-2022 Bareos GmbH & Co. KG + + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + 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 + Affero General Public License for more details. + + You should have received a copy of the GNU Affero 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. +*/ + +#ifndef BAREOS_TESTS_TESTING_SD_COMMON_H_ +#define BAREOS_TESTS_TESTING_SD_COMMON_H_ #include "testing_common.h" @@ -10,4 +31,4 @@ void InitSdGlobals(); PConfigParser StoragePrepareResources(const std::string& path_to_config); -#endif // TESTING_SD_COMMON_H +#endif // BAREOS_TESTS_TESTING_SD_COMMON_H_ From d06eefabac67c68d70cca898e9d863b0ac595750 Mon Sep 17 00:00:00 2001 From: Bruno Friedmann Date: Mon, 25 Apr 2022 11:48:57 +0200 Subject: [PATCH 5/7] Update CHANGELOG.md with links Signed-off-by: Bruno Friedmann --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a414797e99f..321567e32d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https: - Fix `always-incremental-consolidate` systemtest sporadic fails, and rename it. [PR #1154] - packaging: FreeBSD place all scripts into "normal" location /usr/local/lib/bareos/scripts [PR #1163] - [Issue #1445] adding quotes to director name when using `configure export`[PR #1171] +- [BUG #1445] adding quotes to director name when using `configure export`. [PR #1171] ### Changed - contrib: rename Python modules to satisfy PEP8 [PR #768] @@ -157,5 +158,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https: [PR #1149]: https://github.com/bareos/bareos/pull/1149 [PR #1152]: https://github.com/bareos/bareos/pull/1152 [PR #1153]: https://github.com/bareos/bareos/pull/1153 +[PR #1154]: https://github.com/bareos/bareos/pull/1154 [PR #1155]: https://github.com/bareos/bareos/pull/1155 +[PR #1171]: https://github.com/bareos/bareos/pull/1171 [unreleased]: https://github.com/bareos/bareos/tree/master From d49f8506d936a33662232ec0df8843412670364b Mon Sep 17 00:00:00 2001 From: Bruno Friedmann Date: Mon, 25 Apr 2022 16:10:46 +0200 Subject: [PATCH 6/7] core: tests/CMakeLists.txt group blocks and reorder tests alphabetically. Signed-off-by: Bruno Friedmann --- core/src/tests/CMakeLists.txt | 494 +++++++++++++++------------------- 1 file changed, 218 insertions(+), 276 deletions(-) diff --git a/core/src/tests/CMakeLists.txt b/core/src/tests/CMakeLists.txt index 00f78690db2..3d3255e2d0b 100644 --- a/core/src/tests/CMakeLists.txt +++ b/core/src/tests/CMakeLists.txt @@ -78,21 +78,6 @@ endmacro() # bareos_add_test include(GoogleTest) -if(HAVE_WIN32) - link_libraries( - kernel32 - user32 - gdi32 - winspool - shell32 - ole32 - oleaut32 - uuid - comdlg32 - advapi32 - ) -endif() # HAVE_WIN32 - if(HAVE_OPENSSL) set(SSL_UNIT_TEST_FILES init_openssl.cc) endif() @@ -107,11 +92,22 @@ endif() # set some path variables used during test compilation if(HAVE_WIN32) + link_libraries( + kernel32 + user32 + gdi32 + winspool + shell32 + ole32 + oleaut32 + uuid + comdlg32 + advapi32 + ) set(RELATIVE_PROJECT_SOURCE_DIR "Z:${CMAKE_CURRENT_SOURCE_DIR}") set(TEST_ORIGINAL_FILE_DIR Z:${CMAKE_CURRENT_SOURCE_DIR}/statefile) set(TEST_TEMP_DIR Z:${CMAKE_CURRENT_BINARY_DIR}/statefile_tmp) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/statefile_tmp/write-test) - set(CERTDIR Z:${CMAKE_CURRENT_SOURCE_DIR}/configs/test_bsock/tls) else() # NOT HAVE_WIN32 file(RELATIVE_PATH RELATIVE_PROJECT_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR} @@ -120,7 +116,6 @@ else() # NOT HAVE_WIN32 set(TEST_ORIGINAL_FILE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/statefile) set(TEST_TEMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/statefile_tmp) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/statefile_tmp/write-test) - set(CERTDIR ${CMAKE_CURRENT_SOURCE_DIR}/configs/test_bsock/tls) endif() # HAVE_WIN32 @@ -134,194 +129,201 @@ add_library(testing_common STATIC ${COMMON_SRC}) target_link_libraries(testing_common PRIVATE ${LINK_LIBRARIES}) + +if(HAVE_BIG_ENDIAN) + set_tests_properties(gtest:statefile.read PROPERTIES DISABLED TRUE) + set_tests_properties(gtest:statefile.write PROPERTIES DISABLED TRUE) + set_tests_properties( + gtest:statefile.handle_truncated_jobs PROPERTIES DISABLED TRUE + ) + set_tests_properties( + gtest:statefile.handle_truncated_headers PROPERTIES DISABLED TRUE + ) + set_tests_properties( + gtest:statefile.handle_nonexisting_file PROPERTIES DISABLED TRUE + ) +endif() + +#Keep alphabetically ordered if(NOT client-only) bareos_add_test( - run_on_incoming_connect_interval - LINK_LIBRARIES dird_objects bareos bareosfind bareossql + addresses_and_ports + LINK_LIBRARIES bareos dird_objects bareosfind bareossql testing_common $<$:${PAM_LIBRARIES}> GTest::gtest_main ) -endif() # NOT client-only - -if(NOT client-only) bareos_add_test( - scheduler - LINK_LIBRARIES dird_objects bareos bareosfind bareossql + berrno_test + LINK_LIBRARIES bareos dird_objects bareosfind bareossql $<$:${PAM_LIBRARIES}> GTest::gtest_main ) -endif() # NOT client-only - -if(NOT client-only) bareos_add_test( - scheduler_job_item_queue LINK_LIBRARIES dird_objects bareos bareosfind - bareossql GTest::gtest_main + bool_string LINK_LIBRARIES bareos GTest::gtest_main ) -endif() # NOT client-only - -bareos_add_test(test_acl_entry_syntax LINK_LIBRARIES bareos GTest::gtest_main) - -if(NOT client-only) bareos_add_test( - test_db_list_ctx LINK_LIBRARIES bareos bareossql GTest::gtest_main + bsock_test_connection_setup + ADDITIONAL_SOURCES ${SSL_UNIT_TEST_FILES} + LINK_LIBRARIES testing_common ${LINK_LIBRARIES} ) -endif() - -if(NOT client-only) bareos_add_test( - test_dir_plugins + catalog + LINK_LIBRARIES bareos dird_objects bareosfind bareossql + $<$:${PAM_LIBRARIES}> GTest::gtest_main + SKIP_GTEST + ) + bareos_add_test( + configure LINK_LIBRARIES testing_common dird_objects bareosfind bareossql + GTest::gtest_main + ) + bareos_add_test( + dir_fd_connection LINK_LIBRARIES testing_common dird_objects bareos + bareossql bareosfind GTest::gtest_main + ) + bareos_add_test( + dir_statistics_thread LINK_LIBRARIES testing_common dird_objects bareos + bareossql bareosfind GTest::gtest_main + ) + bareos_add_test( + globbing_test + LINK_LIBRARIES bareos dird_objects bareosfind bareossql + $<$:${PAM_LIBRARIES}> GTest::gtest_main + ) + bareos_add_test( + lib_tests ADDITIONAL_SOURCES - ${PROJECT_SOURCE_DIR}/src/dird/dir_plugins.cc - ${PROJECT_SOURCE_DIR}/src/dird/dird_conf.cc - ${PROJECT_SOURCE_DIR}/src/dird/dird_globals.cc - ${PROJECT_SOURCE_DIR}/src/dird/run_conf.cc - ${PROJECT_SOURCE_DIR}/src/dird/inc_conf.cc - ${PROJECT_SOURCE_DIR}/src/dird/ua_acl.cc - ${PROJECT_SOURCE_DIR}/src/dird/ua_audit.cc - LINK_LIBRARIES bareos bareossql bareosfind GTest::gtest_main - ${OPENSSL_LIBRARIES} + alist_test.cc bareos_test_sockets.cc bsys_test.cc dlist_test.cc + htable_test.cc qualified_resource_name_type_converter_test.cc + ${PROJECT_SOURCE_DIR}/src/filed/evaluate_job_command.cc + LINK_LIBRARIES stored_objects bareossd bareos GTest::gtest_main ) -endif() # NOT client-only - -bareos_add_test( - test_fd_plugins - ADDITIONAL_SOURCES ${PROJECT_SOURCE_DIR}/src/filed/fd_plugins.cc - ${PROJECT_SOURCE_DIR}/src/filed/fileset.cc - LINK_LIBRARIES bareos bareosfind GTest::gtest_main -) - -bareos_add_test(test_is_name_valid LINK_LIBRARIES bareos GTest::gtest_main) - -bareos_add_test(test_output_formatter LINK_LIBRARIES GTest::gtest_main bareos) - -if(NOT client-only) bareos_add_test( - test_sd_plugins LINK_LIBRARIES bareos bareossd GTest::gtest_main + messages_resource + LINK_LIBRARIES bareos dird_objects bareosfind bareossql + $<$:${PAM_LIBRARIES}> GTest::gtest_main + SKIP_GTEST + ) + bareos_add_test( + multicolumn_prompts + LINK_LIBRARIES bareos dird_objects bareosfind bareossql + $<$:${PAM_LIBRARIES}> GTest::gtest_main + ) + bareos_add_test( + multiplied_device_test LINK_LIBRARIES ${LINK_LIBRARIES} ) -endif() # NOT client-only - -bareos_add_test(version_strings LINK_LIBRARIES bareos GTest::gtest_main) - -bareos_add_test(job_control_record LINK_LIBRARIES bareos GTest::gtest_main) - -bareos_add_test( - cram_md5 - LINK_LIBRARIES bareos Threads::Threads GTest::gtest_main - ADDITIONAL_SOURCES bareos_test_sockets.cc -) - -if(NOT client-only) - bareos_add_test(multiplied_device_test LINK_LIBRARIES ${LINK_LIBRARIES}) -endif() - -if(NOT client-only) bareos_add_test( ndmp_address_translate_test ADDITIONAL_SOURCES ../dird/ndmp_slot2elemaddr.cc LINK_LIBRARIES ${LINK_LIBRARIES} ) -endif() # NOT client-only - -bareos_add_test( - statefile - LINK_LIBRARIES bareos GTest::gtest_main - COMPILE_DEFINITIONS TEST_TEMP_DIR=\"${TEST_TEMP_DIR}\" - TEST_ORIGINAL_FILE_DIR=\"${TEST_ORIGINAL_FILE_DIR}\" -) - -if(HAVE_BIG_ENDIAN) - set_tests_properties(gtest:statefile.read PROPERTIES DISABLED TRUE) - set_tests_properties(gtest:statefile.write PROPERTIES DISABLED TRUE) - set_tests_properties( - gtest:statefile.handle_truncated_jobs PROPERTIES DISABLED TRUE - ) - set_tests_properties( - gtest:statefile.handle_truncated_headers PROPERTIES DISABLED TRUE - ) - set_tests_properties( - gtest:statefile.handle_nonexisting_file PROPERTIES DISABLED TRUE + bareos_add_test( + run_on_incoming_connect_interval + LINK_LIBRARIES dird_objects bareos bareosfind bareossql + $<$:${PAM_LIBRARIES}> GTest::gtest_main ) -endif() - -if(NOT client-only) bareos_add_test( show_cmd_available_resources_equals_config_resources LINK_LIBRARIES dird_objects bareos bareosfind bareossql GTest::gtest_main ) -endif() # NOT client-only - -if(ENABLE_BCONSOLE) bareos_add_test( - test_config_parser_console LINK_LIBRARIES console_objects bareos bareosfind - GTest::gtest_main + scheduler + LINK_LIBRARIES dird_objects bareos bareosfind bareossql + $<$:${PAM_LIBRARIES}> GTest::gtest_main + ) + bareos_add_test( + scheduler_job_item_queue LINK_LIBRARIES dird_objects bareos bareosfind + bareossql GTest::gtest_main + ) + bareos_add_test( + sd_backend LINK_LIBRARIES ${LINK_LIBRARIES} + ) + if(TARGET droplet) + target_compile_definitions(sd_backend PRIVATE HAVE_DROPLET) + endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") # disable on solaris + set(disable "DISABLE") + else() + set(disable "") + endif() + bareos_add_test( + sd_reservation + ${disable} + LINK_LIBRARIES stored_objects bareossd bareos GTest::gtest_main + GTest::gmock + ) + bareos_add_test( + sd_statistics_thread + LINK_LIBRARIES testing_common dird_objects bareos bareossql bareosfind + Threads::Threads GTest::gtest_main + ) + bareos_add_test( + select_functions LINK_LIBRARIES dird_objects bareosfind bareossql + GTest::gtest_main + ) + bareos_add_test( + setdevice + LINK_LIBRARIES bareos dird_objects bareosfind bareossql + $<$:${PAM_LIBRARIES}> GTest::gtest_main + ) + bareos_add_test( + sort_stringvector LINK_LIBRARIES bareos GTest::gtest_main ) -endif() - -if(NOT client-only) bareos_add_test( test_config_parser_dir LINK_LIBRARIES dird_objects bareos bareosfind bareossql GTest::gtest_main ) -endif() # NOT client-only - -bareos_add_test( - test_config_parser_fd LINK_LIBRARIES fd_objects bareos bareosfind - GTest::gtest_main -) - -if(NOT client-only) + bareos_add_test( + test_crc32 + ADDITIONAL_SOURCES ../stored/crc32/crc32.cc + LINK_LIBRARIES bareos GTest::gtest_main + ) bareos_add_test( test_config_parser_sd LINK_LIBRARIES stored_objects bareossd bareos GTest::gtest_main ) -endif() # NOT client-only - -if(NOT client-only) bareos_add_test( - test_crc32 - ADDITIONAL_SOURCES ../stored/crc32/crc32.cc - LINK_LIBRARIES bareos GTest::gtest_main + test_db_list_ctx LINK_LIBRARIES bareos bareossql GTest::gtest_main + ) + bareos_add_test( + test_dir_plugins + ADDITIONAL_SOURCES + ${PROJECT_SOURCE_DIR}/src/dird/dir_plugins.cc + ${PROJECT_SOURCE_DIR}/src/dird/dird_conf.cc + ${PROJECT_SOURCE_DIR}/src/dird/dird_globals.cc + ${PROJECT_SOURCE_DIR}/src/dird/run_conf.cc + ${PROJECT_SOURCE_DIR}/src/dird/inc_conf.cc + ${PROJECT_SOURCE_DIR}/src/dird/ua_acl.cc + ${PROJECT_SOURCE_DIR}/src/dird/ua_audit.cc + LINK_LIBRARIES bareos bareossql bareosfind GTest::gtest_main + ${OPENSSL_LIBRARIES} ) - bareos_add_test( test_fileindex_list LINK_LIBRARIES dird_objects bareos bareosfind bareossql $<$:${PAM_LIBRARIES}> GTest::gtest_main ) -endif() # NOT client-only - -if(NOT client-only) + bareos_add_test( + test_sd_plugins LINK_LIBRARIES bareos bareossd GTest::gtest_main + ) bareos_add_test( test_setdebug LINK_LIBRARIES dird_objects bareos bareosfind bareossql $<$:${PAM_LIBRARIES}> GTest::gtest_main ) -endif() # NOT client-only - -bareos_add_test(thread_list LINK_LIBRARIES bareos GTest::gtest_main) -set_tests_properties( - gtest:thread_list.thread_list_startup_and_shutdown PROPERTIES LABELS broken -) - -bareos_add_test( - thread_specific_data LINK_LIBRARIES bareos Threads::Threads GTest::gtest_main -) - -bareos_add_test(timer_thread LINK_LIBRARIES bareos GTest::gtest_main) - -if(NOT client-only) bareos_add_test( - catalog + time_format_test LINK_LIBRARIES bareos dird_objects bareosfind bareossql $<$:${PAM_LIBRARIES}> GTest::gtest_main - SKIP_GTEST ) -endif() + +endif() # NOT client-only if(HAVE_EXECINFO_H AND HAVE_BACKTRACE AND HAVE_BACKTRACE_SYMBOLS ) - bareos_add_test(test_backtrace LINK_LIBRARIES bareos GTest::gtest_main) - # Backtrace doesn't work correctly when ASan is enabled, do we shoudn't test + bareos_add_test( + test_backtrace LINK_LIBRARIES bareos GTest::gtest_main + ) + # Backtrace doesn't work correctly when ASan is enabled, do we shouldn't test # in that case if(CMAKE_CXX_FLAGS MATCHES "-fsanitize=address") set_tests_properties( @@ -330,47 +332,6 @@ if(HAVE_EXECINFO_H endif() endif() # HAVE_EXECINFO_H .. -if(NOT client-only) - if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS") # disable on solaris - set(disable "DISABLE") - else() - set(disable "") - endif() - bareos_add_test( - sd_reservation - ${disable} - LINK_LIBRARIES stored_objects bareossd bareos GTest::gtest_main - GTest::gmock - ) -endif() - -if(NOT client-only) - bareos_add_test(sd_backend LINK_LIBRARIES ${LINK_LIBRARIES}) - if(TARGET droplet) - target_compile_definitions(sd_backend PRIVATE HAVE_DROPLET) - endif() -endif() - -if(NOT client-only) - bareos_add_test( - lib_tests - ADDITIONAL_SOURCES - alist_test.cc bareos_test_sockets.cc bsys_test.cc dlist_test.cc - htable_test.cc qualified_resource_name_type_converter_test.cc - ${PROJECT_SOURCE_DIR}/src/filed/evaluate_job_command.cc - LINK_LIBRARIES stored_objects bareossd bareos GTest::gtest_main - ) - - bareos_add_test( - bsock_test_connection_setup - ADDITIONAL_SOURCES ${SSL_UNIT_TEST_FILES} - LINK_LIBRARIES testing_common ${LINK_LIBRARIES} - ) - - bareos_add_test(bool_string LINK_LIBRARIES bareos GTest::gtest_main) - -endif() # NOT client-only - if(NOT HAVE_WIN32 AND NOT client-only) bareos_add_test( test_bsock @@ -381,107 +342,88 @@ if(NOT HAVE_WIN32 AND NOT client-only) LINK_LIBRARIES ${LINK_LIBRARIES} COMPILE_DEFINITIONS -DCERTDIR=\"${CERTDIR}\" ) - bareos_add_test(watchdog_timer LINK_LIBRARIES bareos GTest::gtest_main) + bareos_add_test( + watchdog_timer LINK_LIBRARIES bareos GTest::gtest_main + ) endif() # NOT HAVE_WIN32 AND NOT client-only -if(NOT client-only) - bareos_add_test(sort_stringvector LINK_LIBRARIES bareos GTest::gtest_main) -endif() # NOT client-only - -if(NOT client-only) +if(ENABLE_BCONSOLE) bareos_add_test( - messages_resource - LINK_LIBRARIES bareos dird_objects bareosfind bareossql - $<$:${PAM_LIBRARIES}> GTest::gtest_main - SKIP_GTEST + test_config_parser_console LINK_LIBRARIES console_objects bareos bareosfind + GTest::gtest_main ) -endif() # NOT client-only +endif() -bareos_add_test(test_edit LINK_LIBRARIES bareos GTest::gtest_main) +#Keep alphabetically ordered +bareos_add_test( + cram_md5 + LINK_LIBRARIES bareos Threads::Threads GTest::gtest_main + ADDITIONAL_SOURCES bareos_test_sockets.cc +) -if(NOT client-only) - bareos_add_test( - setdevice - LINK_LIBRARIES bareos dird_objects bareosfind bareossql - $<$:${PAM_LIBRARIES}> GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + job_control_record LINK_LIBRARIES bareos GTest::gtest_main +) -if(NOT client-only) - bareos_add_test( - time_format_test - LINK_LIBRARIES bareos dird_objects bareosfind bareossql - $<$:${PAM_LIBRARIES}> GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + test_acl_entry_syntax LINK_LIBRARIES bareos GTest::gtest_main +) -if(NOT client-only) - bareos_add_test( - multicolumn_prompts - LINK_LIBRARIES bareos dird_objects bareosfind bareossql - $<$:${PAM_LIBRARIES}> GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + test_bsnprintf LINK_LIBRARIES bareos GTest::gtest_main +) -if(NOT client-only) - bareos_add_test( - globbing_test - LINK_LIBRARIES bareos dird_objects bareosfind bareossql - $<$:${PAM_LIBRARIES}> GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + test_config_parser_fd LINK_LIBRARIES fd_objects bareos bareosfind + GTest::gtest_main +) -if(NOT client-only) - bareos_add_test( - addresses_and_ports - LINK_LIBRARIES bareos dird_objects bareosfind bareossql testing_common - $<$:${PAM_LIBRARIES}> GTest::gtest_main - ) -endif() # NOT client-only -if(NOT client-only) - bareos_add_test( - berrno_test - LINK_LIBRARIES bareos dird_objects bareosfind bareossql - $<$:${PAM_LIBRARIES}> GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + test_edit LINK_LIBRARIES bareos GTest::gtest_main +) -bareos_add_test(test_poolmem LINK_LIBRARIES bareos GTest::gtest_main) -bareos_add_test(test_bsnprintf LINK_LIBRARIES bareos GTest::gtest_main) +bareos_add_test( + test_fd_plugins + ADDITIONAL_SOURCES ${PROJECT_SOURCE_DIR}/src/filed/fd_plugins.cc + ${PROJECT_SOURCE_DIR}/src/filed/fileset.cc + LINK_LIBRARIES bareos bareosfind GTest::gtest_main +) -if(NOT client-only) - bareos_add_test( - dir_statistics_thread LINK_LIBRARIES testing_common dird_objects bareos - bareossql bareosfind GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + test_is_name_valid LINK_LIBRARIES bareos GTest::gtest_main +) -if(NOT client-only) - bareos_add_test( - sd_statistics_thread - LINK_LIBRARIES testing_common dird_objects bareos bareossql bareosfind - Threads::Threads GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + test_poolmem LINK_LIBRARIES bareos GTest::gtest_main +) -if(NOT client-only) - bareos_add_test( - select_functions LINK_LIBRARIES dird_objects bareosfind bareossql - GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + test_output_formatter LINK_LIBRARIES GTest::gtest_main bareos +) -if(NOT client-only) - bareos_add_test( - dir_fd_connection LINK_LIBRARIES testing_common dird_objects bareos - bareossql bareosfind GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + statefile + LINK_LIBRARIES bareos GTest::gtest_main + COMPILE_DEFINITIONS TEST_TEMP_DIR=\"${TEST_TEMP_DIR}\" + TEST_ORIGINAL_FILE_DIR=\"${TEST_ORIGINAL_FILE_DIR}\" +) -if(NOT client-only) - bareos_add_test( - configure LINK_LIBRARIES testing_common dird_objects bareosfind bareossql - GTest::gtest_main - ) -endif() # NOT client-only +bareos_add_test( + thread_list LINK_LIBRARIES bareos GTest::gtest_main +) +set_tests_properties( + gtest:thread_list.thread_list_startup_and_shutdown PROPERTIES LABELS broken +) + +bareos_add_test( + thread_specific_data LINK_LIBRARIES bareos Threads::Threads GTest::gtest_main +) + +bareos_add_test( + timer_thread LINK_LIBRARIES bareos GTest::gtest_main +) + +bareos_add_test( + version_strings LINK_LIBRARIES bareos GTest::gtest_main +) From d1e44d186c5f0436d0da9b316198ea22dcfdefc3 Mon Sep 17 00:00:00 2001 From: Bruno Friedmann Date: Tue, 26 Apr 2022 13:26:18 +0200 Subject: [PATCH 7/7] update CHANGELOG.md Signed-off-by: Bruno Friedmann --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 321567e32d5..398d241b902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,6 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https: - cats: make `.bvfs_update` and `.bvfs_versions` take archive jobs into consideration [PR #1152] - Fix `always-incremental-consolidate` systemtest sporadic fails, and rename it. [PR #1154] - packaging: FreeBSD place all scripts into "normal" location /usr/local/lib/bareos/scripts [PR #1163] -- [Issue #1445] adding quotes to director name when using `configure export`[PR #1171] - [BUG #1445] adding quotes to director name when using `configure export`. [PR #1171] ### Changed @@ -160,5 +159,6 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https: [PR #1153]: https://github.com/bareos/bareos/pull/1153 [PR #1154]: https://github.com/bareos/bareos/pull/1154 [PR #1155]: https://github.com/bareos/bareos/pull/1155 +[PR #1163]: https://github.com/bareos/bareos/pull/1163 [PR #1171]: https://github.com/bareos/bareos/pull/1171 [unreleased]: https://github.com/bareos/bareos/tree/master