Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix visibility for Windows #337

Merged
merged 3 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions testing/include/ignition/common/testing/BazelTestPaths.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string>

#include "ignition/common/testing/TestPaths.hh"
#include "ignition/common/testing/Export.hh"

namespace ignition::common::testing
{
Expand All @@ -41,13 +42,15 @@ class BazelTestPaths: public TestPaths
public: using TestPaths::TestPaths;

/// \brief Destructor
public: ~BazelTestPaths() override;
public: IGNITION_COMMON_TESTING_VISIBLE ~BazelTestPaths() override;

/// Documentation inherited
public: bool ProjectSourcePath(std::string &_sourceDir) override;
public: bool IGNITION_COMMON_TESTING_VISIBLE
ProjectSourcePath(std::string &_sourceDir) override;

/// Documentation inherited
public: bool TestTmpPath(std::string &_tmpDir) override;
public: bool IGNITION_COMMON_TESTING_VISIBLE
TestTmpPath(std::string &_tmpDir) override;
};

} // namespace ignition::common::testing
Expand Down
9 changes: 6 additions & 3 deletions testing/include/ignition/common/testing/CMakeTestPaths.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string>

#include "ignition/common/testing/TestPaths.hh"
#include "ignition/common/testing/Export.hh"

namespace ignition::common::testing
{
Expand All @@ -33,13 +34,15 @@ class CMakeTestPaths: public TestPaths
public: using TestPaths::TestPaths;

/// \brief Destructor
public: ~CMakeTestPaths() override;
public: IGNITION_COMMON_TESTING_VISIBLE ~CMakeTestPaths() override;

/// Documentation inherited
public: bool ProjectSourcePath(std::string &_sourceDir) override;
public: bool IGNITION_COMMON_TESTING_VISIBLE
ProjectSourcePath(std::string &_sourceDir) override;

/// Documentation inherited
public: bool TestTmpPath(std::string &_tmpDir) override;
public: bool IGNITION_COMMON_TESTING_VISIBLE
TestTmpPath(std::string &_tmpDir) override;
};
} // namespace ignition::common::testing
#endif // IGNITION_COMMON_TESTING_CMAKETESTPATHS_HH_
19 changes: 14 additions & 5 deletions testing/include/ignition/common/testing/TestPaths.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "ignition/common/TempDirectory.hh"
#include "ignition/common/Util.hh"

#include "ignition/common/testing/Export.hh"

#ifndef TESTING_PROJECT_SOURCE_DIR
#define TESTING_PROJECT_SOURCE_DIR ""
#endif
Expand All @@ -44,7 +46,7 @@ constexpr char kTestingProjectSourceDir[] = TESTING_PROJECT_SOURCE_DIR;

//////////////////////////////////////////////////
/// \brief List of buildsystem types
enum class BuildType
enum class IGNITION_COMMON_TESTING_VISIBLE BuildType
{
kUnknown,
kCMake,
Expand All @@ -60,21 +62,25 @@ enum class BuildType
class TestPaths
{
/// \brief Constructor
public: explicit TestPaths(const std::string &_projectSourcePath =
public: IGNITION_COMMON_TESTING_VISIBLE
explicit TestPaths(const std::string &_projectSourcePath =
kTestingProjectSourceDir);

/// \brief Destructor
public: virtual ~TestPaths() = 0;
public: IGNITION_COMMON_TESTING_VISIBLE
virtual ~TestPaths() = 0;

/// brief Populate the path to the root project source directory
/// \param[out] _sourceDir path to the root project source directory
/// \return True if path successfully found and set, false otherwise
public: virtual bool ProjectSourcePath(std::string &_sourceDir) = 0;
public: virtual bool IGNITION_COMMON_TESTING_VISIBLE
ProjectSourcePath(std::string &_sourceDir) = 0;

/// \brief Populate the path to a temporary directory
/// \param[out] _tmpDir path to the root temporary directory
/// \return True if path successfully found and set, false otherwise
public: virtual bool TestTmpPath(std::string &_tmpDir) = 0;
public: virtual bool IGNITION_COMMON_TESTING_VISIBLE
TestTmpPath(std::string &_tmpDir) = 0;

/// \brief Path to the root of the project source
protected: std::string projectSourcePath;
Expand All @@ -92,6 +98,7 @@ class TestPaths
/// be cleaned as part of the destructor
/// \return Shared pointer to TempDirectory
std::shared_ptr<ignition::common::TempDirectory>
IGNITION_COMMON_TESTING_VISIBLE
MakeTestTempDirectoryImpl(const std::string &_projectSourcePath,
const std::string &_prefix = "test",
const std::string &_subDir = "ignition",
Expand Down Expand Up @@ -126,6 +133,7 @@ MakeTestTempDirectory(const std::string &_prefix = "test",
/// \param[in] _projectSourcePath Root of project source or empty
/// \return The current build type
BuildType
IGNITION_COMMON_TESTING_VISIBLE
TestBuildType(
const std::string &_projectSourcePath = kTestingProjectSourceDir);

Expand All @@ -135,6 +143,7 @@ TestBuildType(
/// \param[in] _projectSourcePath Root of project source or empty
/// \return TestPaths implementation for the current build type
std::unique_ptr<TestPaths>
IGNITION_COMMON_TESTING_VISIBLE
TestPathFactory(
const std::string &_projectSourcePath = kTestingProjectSourceDir);

Expand Down
10 changes: 8 additions & 2 deletions testing/include/ignition/common/testing/Utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,26 @@
#include <cstdint>
#include <string>

#include "ignition/common/testing/Export.hh"

namespace ignition::common::testing
{

/////////////////////////////////////////////////
/// \brief Get a random number based on an integer converted to string.
/// \return A random integer converted to string.
std::string getRandomNumber(int32_t _min = 0, int32_t _max = INT_MAX);
std::string
IGNITION_COMMON_TESTING_VISIBLE
getRandomNumber(int32_t _min = 0, int32_t _max = INT_MAX);

/////////////////////////////////////////////////
/// \brief Create an empty file with no content
///
/// \param[in] _filename Filename of the file to be created
/// \return true if file successfully created, false otherwise
bool createNewEmptyFile(const std::string &_filename);
bool
IGNITION_COMMON_TESTING_VISIBLE
createNewEmptyFile(const std::string &_filename);

} // namespace ignition::common::testing

Expand Down