Skip to content

Commit

Permalink
Fix visibility for Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll committed Apr 5, 2022
1 parent 0dc5711 commit ff0d8f0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 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 Down
1 change: 1 addition & 0 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 Down
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 IGNITION_COMMON_TESTING_VISIBLE
bool 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 IGNITION_COMMON_TESTING_VISIBLE
bool 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

0 comments on commit ff0d8f0

Please sign in to comment.