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

Common test: Granular test #364

Merged
merged 31 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0992cb8
Add more common test and refactor helper class
ahcorde Jun 20, 2022
0ecea70
Add feedback and more tests
ahcorde Jun 21, 2022
110ddf3
Merge branch 'main' into ahcorde/6/refactor_common_test
ahcorde Jun 21, 2022
55029e5
Fix windows build
ahcorde Jun 21, 2022
ef59f8f
try to fix windows build
ahcorde Jun 21, 2022
323970c
try to fix windows build
ahcorde Jun 21, 2022
1b99a98
try to fix windows build
ahcorde Jun 21, 2022
f9b9a18
Fix windows build
ahcorde Jun 21, 2022
cc2abe0
Fix windows build
ahcorde Jun 22, 2022
28b981d
Fix windows build
ahcorde Jun 22, 2022
a7eede4
Granular test
ahcorde Jun 23, 2022
821d5bc
Fixed windows build
ahcorde Jun 23, 2022
b4e7c92
Remove old gtest version
mjcarroll Jun 27, 2022
62f4ca1
Add new vendored Googletest version
mjcarroll Jun 28, 2022
0bd6fd2
CMake updates for new googletest version
mjcarroll Jun 28, 2022
7776dd6
Test updates for new googletest version
mjcarroll Jun 28, 2022
cacc9f8
Remove unnecessary gtest_main functions
mjcarroll Jun 28, 2022
e9e377c
Update test/CMakeLists.txt
mjcarroll Jun 28, 2022
c6bef9d
Merge branch 'main' into ahcorde/6/refactor_common_test
ahcorde Jun 28, 2022
327a775
Fixed merge
ahcorde Jun 28, 2022
b173393
Merge branch 'main' into ahcorde/6/refactor_common_test
ahcorde Jun 28, 2022
73d7bac
Merge branch 'main' into bump_gtest
ahcorde Jun 28, 2022
7cc773d
Merge remote-tracking branch 'origin/bump_gtest' into ahcorde/6/refac…
ahcorde Jun 29, 2022
685fb75
Merge remote-tracking branch 'origin/main' into ahcorde/6/refactor_co…
ahcorde Jun 29, 2022
f435488
remove todo - skip test
ahcorde Jun 29, 2022
21a4dec
Merge branch 'main' into ahcorde/6/refactor_common_test
ahcorde Jun 29, 2022
d390e2c
Merge remote-tracking branch 'origin/ahcorde/6/refactor_common_test' …
ahcorde Jun 30, 2022
f3848d8
Merge remote-tracking branch 'origin/main' into ahcorde/6/granular_test
ahcorde Jul 7, 2022
3ce4477
Merge branch 'main' into ahcorde/6/granular_test
ahcorde Jul 8, 2022
957d44d
Fixed macOS warnings
ahcorde Jul 11, 2022
e6ca6eb
Merge branch 'main' into ahcorde/6/granular_test
ahcorde Jul 11, 2022
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
4 changes: 2 additions & 2 deletions bullet/src/EntityManagementFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ Identity EntityManagementFeatures::GetWorld(
}

const std::string &EntityManagementFeatures::GetWorldName(
const Identity &) const
const Identity &_worldID) const
{
static const std::string worldName = "bullet";
static const std::string worldName = this->worlds.at(_worldID)->name;
return worldName;
}

Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ExternalProject_Add(
add_subdirectory(benchmark)
add_subdirectory(common_test)
add_subdirectory(plugins)
add_subdirectory(helpers)
add_subdirectory(integration)
add_subdirectory(performance)
add_subdirectory(regression)
Expand Down
6 changes: 4 additions & 2 deletions test/common_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ set(TEST_TYPE "COMMON_TEST")

set(tests
basic_test
construct_empty_world
)

link_directories(${PROJECT_BINARY_DIR}/test)
Expand All @@ -19,11 +20,12 @@ foreach(test ${tests})

target_link_libraries(${TEST_TYPE}_${test}
PUBLIC
ignition-plugin${IGN_PLUGIN_VER}::loader
ignition-common5::ignition-common5
${PROJECT_LIBRARY_TARGET_NAME}
ignition-plugin${IGN_PLUGIN_VER}::loader
ignition-common${IGN_COMMON_VER}::ignition-common${IGN_COMMON_VER}
gtest
gtest_main
${PROJECT_NAME}_test_lib_loader
)

if (${BULLET_FOUND})
Expand Down
49 changes: 8 additions & 41 deletions test/common_test/basic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include <gtest/gtest.h>

#include <gz/common/Console.hh>
#include <gz/common/Filesystem.hh>
#include <gz/common/Util.hh>
#include <gz/plugin/Loader.hh>

#include "../helpers/TestLibLoader.hh"

#include <gz/physics/FindFeatures.hh>
#include <gz/physics/GetEntities.hh>
#include <gz/physics/RequestEngine.hh>
Expand All @@ -31,21 +31,8 @@ using Features = gz::physics::FeatureList<
>;

class EntityManagementFeaturesTest:
public testing::Test
public testing::Test, public gz::physics::TestLibLoader
{
public: static void init(int argc, char *argv[])
{
if (argc != 2)
FAIL() << "Please provide the path to an engine plugin.\n"
<< "Usage COMMON_TEST_basic_test <physics engine path>\n";
libToTest = argv[1];
}

static std::string GetLibToTest()
{
return libToTest;
}

// Documentation inherited
public: void SetUp() override
{
Expand All @@ -58,36 +45,15 @@ class EntityManagementFeaturesTest:
pluginNames = gz::physics::FindFeatures3d<Features>::From(loader);
if (pluginNames.empty())
{
FAIL() << "No plugins with required features found in " << GetLibToTest();
std::cerr << "No plugins with required features found in " << GetLibToTest();
// TODO(ahcorde): If we update gtest we can use here GTEST_SKIP()
}
}

/// \brief Get Physics Engine name based on the plugin name
/// \param[in] _name Plugin name
/// \return Name of the Physics Engine
std::string PhysicsEngineName(std::string _name)
{
std::vector<std::string> tokens = gz::common::split(_name, "::");
if (tokens.size() == 4)
{
std::string physicsEngineName = tokens[2];
std::string physicsEnginePluginName = physicsEngineName;
if (physicsEngineName == "tpeplugin")
{
physicsEnginePluginName = "tpe";
}
return physicsEnginePluginName;
}
return "";
}

public: static std::string libToTest;
public: gz::plugin::Loader loader;
public: std::set<std::string> pluginNames;
public: gz::plugin::Loader loader;
};

std::string EntityManagementFeaturesTest::libToTest = std::string("");

/////////////////////////////////////////////////
TEST_F(EntityManagementFeaturesTest, ConstructEmptyWorld)
{
Expand All @@ -106,6 +72,7 @@ TEST_F(EntityManagementFeaturesTest, ConstructEmptyWorld)
int main(int argc, char *argv[])
{
::testing::InitGoogleTest(&argc, argv);
EntityManagementFeaturesTest::init(argc, argv);
if (!EntityManagementFeaturesTest::init(argc, argv))
return -1;
return RUN_ALL_TESTS();
}
Loading