NOSALRO/robot_dart

test_robot.cpp fails?

Closed this issue · 2 comments

In the master:

 /Users/jmouret/git/resibots/robot_dart/build/src/tests/test_robot

Running 4 test cases...
Entering test module "test_robot"
../src/tests/test_robot.cpp:16: Entering test case "test_constructors"
Warning [LocalResource.cpp:48] [LocalResource::constructor] Failed opening file '/tmp/bad-path.urdf' for reading: No such file or directory
Warning [CompositeResourceRetriever.cpp:97] [CompositeResourceRetriever::retrieve] All ResourceRetrievers registered for this schema failed to retrieve the URI 'file:///tmp/bad-path.urdf' (tried 1).
../src/tests/test_robot.cpp:19: info: check 'exception "Assertion" raised as expected: validation on the raised exception through predicate "[](const Assertion&) { return true; }"' has passed
../src/tests/test_robot.cpp:22: info: check 'exception "Assertion" raised as expected: validation on the raised exception through predicate "[](const Assertion&) { return true; }"' has passed
../src/tests/test_robot.cpp:31: info: check robot == nullptr has passed
../src/tests/test_robot.cpp:35: info: check pendulum has passed
../src/tests/test_robot.cpp:39: info: check dummy has passed
../src/tests/test_robot.cpp:42: info: check pendulum->name() == "robot" has passed
../src/tests/test_robot.cpp:43: info: check pendulum->name() == pendulum->skeleton()->getName() has passed
../src/tests/test_robot.cpp:45: info: check dummy->name() == "dummy_robot" has passed
../src/tests/test_robot.cpp:46: info: check dummy->name() == dummy->skeleton()->getName() has passed
../src/tests/test_robot.cpp:47: info: check dummy->name() == dummy_skel->getName() has passed
../src/tests/test_robot.cpp:16: Leaving test case "test_constructors"; testing time: 95039us
../src/tests/test_robot.cpp:52: Entering test case "test_fix_free"
../src/tests/test_robot.cpp:55: info: check pendulum has passed
../src/tests/test_robot.cpp:59: info: check pendulum->fixed() has passed
../src/tests/test_robot.cpp:61: info: check !pendulum->free() has passed
unknown location:0: fatal error: in "test_fix_free": signal: SIGSEGV, si_code: 0 (memory access violation at address: 0x00000000)
../src/tests/test_robot.cpp:61: last checkpoint
Test is aborted
../src/tests/test_robot.cpp:52: Leaving test case "test_fix_free"; testing time: 1315us
Test is aborted
Leaving test module "test_robot"; testing time: 95075us


Don't we have CI to avoid this? ;)

This seems to be a Dart/clang problem (I am using 6.10) related to alignment. This works:

#include <dart/config.hpp>
#include <dart/dynamics/FreeJoint.hpp>

int main() {
    auto properties = dart::dynamics::FreeJoint::Properties::createShared();
}

This segv:

#include <dart/config.hpp>
#include <dart/dynamics/FreeJoint.hpp>

int main() {
   dart::dynamics::FreeJoint::Properties properties;
}

The -march=native is the usual suspect here:

clang++ -O2 -std=c++14 -I /usr/local/include/eigen3 -L/usr/local/lib -ldart test_dart.cpp

=> OK

 clang++ -O2 -march=native -std=c++14 -I /usr/local/include/eigen3 -L/usr/local/lib -ldart test_dart.cpp

=> segv

But my Dart is compiled with AVX (I checked with check_avx script or waf).

Adding -fno-stack-check seems to solve the issue in 10.15.5 (this is enabled by default apparently). See: https://forums.developer.apple.com/thread/121887