nickgillian / grt

gesture recognition toolkit
859 stars 285 forks source link

Troubleshooting running unit tests #92

Closed narner closed 7 years ago

narner commented 7 years ago

Hey Nick,

I'm attempting to run the GRT unit tests. Right now, I'm encountering three problems when building the GRT unit tests (using gcc):

  1. When building tests, I would get an error saying that #include <GRT.h> could not be found. I fixed this by changing the path to: #include "../../GRT/GRT.h"
  2. After the above error was resolved, I got an error stating that #include "gtest/gtest.h" could not be found. I resolved that by changing the path to #include "../../third_party/gtest/googletest/include/gtest/gtest.h"
  3. ...Once that was resolved, I'm now getting an error of gtest/internal/gtest-internal.h' file not found.

I've built googlemock and googletest inside the third_party/gtest folder, following the directions here, so I don't think the problem is with how those two frameworks are being built.

nickgillian commented 7 years ago

How are you running the unit tests? Are you using cmake to generate the main library and the unit tests?

If so, cmake will automatically call a script that builds and links against the unit test library (gtest).

This is how I run the unit tests (and build the library):

cd grt_parent_directory      #cd to the grt parent directory
cd build                     #cd to the main build directory
mkdir tmp                    #if it doesn't already exist, make a temporary directory
cd tmp                       #cd to the temporary directory
cmake ..                     #run the cmake script, pointing to the CMakeLists.txt file that lives one directory above (..), this will configure the build scripts for your machine
make -j4                     #build the library, running 4 jobs at once (a.k.a. use 4 threads/processors if you have them)
make test                    #run the unit tests
narner commented 7 years ago

Ah, I had been trying to run each test individually, so was doing:

g++ ./ANBCTest.cpp

The commands you used worked for me also, thank you.