Skip to content

Commit

Permalink
Create unique directory for test
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed Mar 30, 2022
1 parent 59a8870 commit a9dee08
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/integration/ModelPhotoShootTest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ void SavePicture(const ignition::rendering::CameraPtr _camera,
void testImages(const std::string &_imageFile,
const std::string &_testImageFile)
{
std::string imageFilePath = common::joinPaths(
std::string(PROJECT_BINARY_PATH), "test", "integration", _imageFile);
std::string imageFilePath = common::joinPaths(common::cwd(), _imageFile);
ignition::common::Image image(imageFilePath);
std::string testImageFilePath = common::joinPaths(
std::string(PROJECT_BINARY_PATH), "test", "integration", _testImageFile);
std::string testImageFilePath =
common::joinPaths(common::cwd(), _testImageFile);
ignition::common::Image testImage(testImageFilePath);

EXPECT_TRUE(image.Valid());
Expand All @@ -111,6 +110,11 @@ void testImages(const std::string &_imageFile,
/// \brief Test ModelPhotoShootTest system.
class ModelPhotoShootTest : public InternalFixture<::testing::Test>
{
protected: void SetUp() override
{
EXPECT_TRUE(common::chdir(test::UniqueTestDirectoryEnv::Path()));
InternalFixture<::testing::Test>::SetUp();
}
/// \brief PostRender callback.
public: void OnPostRender()
{
Expand Down Expand Up @@ -168,8 +172,7 @@ class ModelPhotoShootTest : public InternalFixture<::testing::Test>
/// \param[in] _poseFile File containing the generated poses.
protected: void LoadPoseValues(std::string _poseFile = "poses.txt")
{
std::string poseFilePath = common::joinPaths(
std::string(PROJECT_BINARY_PATH), "test", "integration", _poseFile);
std::string poseFilePath = common::joinPaths(common::cwd(), _poseFile);
std::ifstream poseFile (poseFilePath);
std::string line;
ASSERT_TRUE(poseFile.is_open());
Expand Down
8 changes: 8 additions & 0 deletions test/integration/model_photo_shoot_default_joints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ TEST_F(ModelPhotoShootTest,
this->ModelPhotoShootTestCmd(
"examples/worlds/model_photo_shoot.sdf");
}

int main(int _argc, char **_argv)
{
::testing::InitGoogleTest(&_argc, _argv);
::testing::AddGlobalTestEnvironment(
new test::UniqueTestDirectoryEnv("model_photo_shoot_test"));
return RUN_ALL_TESTS();
}
8 changes: 8 additions & 0 deletions test/integration/model_photo_shoot_random_joints.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ TEST_F(ModelPhotoShootTest,
this->ModelPhotoShootTestCmd(
"test/worlds/model_photo_shoot_random_joints.sdf");
}

int main(int _argc, char **_argv)
{
::testing::InitGoogleTest(&_argc, _argv);
::testing::AddGlobalTestEnvironment(
new test::UniqueTestDirectoryEnv("model_photo_shoot_test"));
return RUN_ALL_TESTS();
}

0 comments on commit a9dee08

Please sign in to comment.