From: Michal Nowikowski Date: Thu, 7 Mar 2019 09:30:08 +0000 (+0100) Subject: changes after review: updated comments and did other small improvements X-Git-Tag: 465-add-subnet4-update-and-subnet6-update-commands-to-subnet-cmds-hook_base2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fee053c5487b7b69ff848777d33bc22d662bf6a7;p=thirdparty%2Fkea.git changes after review: updated comments and did other small improvements --- diff --git a/ChangeLog b/ChangeLog index c085ff6c44..d16a5ea70c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1537. [func] godfryd + Improved handling unix sockets in unit tests. Now by default + they are created in temporary folder under /tmp folder. This + fixes the issue with creating sockets with too long path + in the case when source folder is deeply nested. + (Gitlab #357,!258, git a45e2f68d7d1848adb0cf755954a3d76c9dff338) + 1536. [build] tomek Many changes in keactrl, kea-admin, cql_config and sysrepo_config scripts. ISC is now using shellcheck to verify portability of diff --git a/doc/devel/unit-tests.dox b/doc/devel/unit-tests.dox index 937502ed82..a7edb9fa05 100644 --- a/doc/devel/unit-tests.dox +++ b/doc/devel/unit-tests.dox @@ -40,10 +40,9 @@ The following environment variable can affect the unit tests: - KEA_SOCKET_TEST_DIR - if set, it specifies the directory where Unix sockets are created. There is an operating system limitation on how long a Unix socket path can be, typically slightly over 100 - characters. If you happen to build and run unit-tests in deeply nested - directories, this may become a problem. KEA_SOCKET_TEST_DIR can be - specified to instruct unit-test to use a different directory. It must - not end with slash. + characters. By default unit-tests create sockets in temporary folder + under /tmp folder. KEA_SOCKET_TEST_DIR can be specified to instruct + unit-tests to use a different directory. It must not end with slash. @section unitTestsDatabaseConfig Databases Configuration for Unit Tests @@ -265,5 +264,5 @@ local all postgres trust [cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4] Use HELP for help. cqlsh> @endverbatim\n - + */ diff --git a/src/lib/testutils/sandbox.h b/src/lib/testutils/sandbox.h index 115108e350..13aab6ed5c 100644 --- a/src/lib/testutils/sandbox.h +++ b/src/lib/testutils/sandbox.h @@ -11,8 +11,9 @@ #include #include -#include -#include +#include +#include +#include #include namespace isc { @@ -25,14 +26,12 @@ namespace test { /// in unit test setup phase, and then it is deleted with its content /// in destructor ie. in unit test tear down phase. class Sandbox { +private: /// Path to temporary folder std::string path_; /// @brief Method for deleting files and folders, used in nftw traversal function. - static int rmFile(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) { - (void)sb; - (void)typeflag; - (void)ftwbuf; + static int rmFile(const char *fpath, const struct stat *, int , struct FTW *) { return(remove(fpath)); } @@ -51,9 +50,11 @@ public: } } - // @brief Join sandbox path with indicated file subpath. + /// @brief Join sandbox path with indicated file subpath. + /// + /// @param file A path to file that should be joined to base path of sandbox. std::string join(std::string file) { - return path_ + "/" + file; + return(path_ + "/" + file); } };