37 #include <gtest/gtest.h> 41 #include <sys/types.h> 42 #include <sys/param.h> 52 return system((executable +
" " + args).c_str());
55 int walker(
char *result,
int& test_result)
59 d = opendir(
"robots" );
64 while( ( dir = readdir( d ) ) )
66 if( strcmp( dir->d_name,
"." ) == 0 ||
67 strcmp( dir->d_name,
".." ) == 0 )
71 if( dir->d_type != DT_DIR )
73 std::string dir_name = dir->d_name;
74 if (dir_name.find(std::string(
".urdf.xacro")) == dir_name.size()-11)
77 getcwd( pwd, MAXPATHLEN );
78 printf(
"\n\ntesting: %s\n",(std::string(pwd)+
"/robots/"+dir_name).c_str());
79 runExternalProcess(
"python `rospack find xacro`/xacro --inorder", std::string(pwd)+
"/robots/"+dir_name+
" > `rospack find turtlebot_description`/test/tmp.urdf");
80 test_result = test_result ||
runExternalProcess(
"`rospack find urdf_parser`/bin/check_urdf",
"`rospack find turtlebot_description`/test/tmp.urdf");
93 char buf[MAXPATHLEN] = { 0 };
94 if(
walker( buf, test_result ) == 0 )
96 printf(
"Found: %s\n", buf );
103 EXPECT_TRUE(test_result == 0);
106 int main(
int argc,
char **argv)
108 testing::InitGoogleTest(&argc, argv);
109 return RUN_ALL_TESTS();
int main(int argc, char **argv)
int walker(char *result, int &test_result)
int runExternalProcess(const std::string &executable, const std::string &args)
TEST(URDF, CorrectFormat)