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

Error running test executable: Cannot read test directory #271

Open
ryandesign opened this issue Jun 19, 2023 · 2 comments
Open

Error running test executable: Cannot read test directory #271

ryandesign opened this issue Jun 19, 2023 · 2 comments

Comments

@ryandesign
Copy link
Contributor

Building litehtml 0.8 (with my fixes for #264 and #270) on macOS 12 fails for me with either external googletest 1.13.0:

CMake Error at /opt/local/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:112 (message):
  Error running test executable.

    Path: '/opt/local/var/macports/build/_Volumes_Shared_macports-ports_devel_litehtml/litehtml/work/build/litehtml_tests'
    Result: 1
    Output:
      Running main() from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_gtest/gtest/work/googletest-1.13.0/googletest/src/gtest_main.cc
      Cannot read test directory
      

Call Stack (most recent call first):
  /opt/local/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:225 (gtest_discover_tests_impl)


make[2]: *** [litehtml_tests] Error 1

or the bundled googletest:

CMake Error at /opt/local/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:112 (message):
  Error running test executable.

    Path: '/opt/local/var/macports/build/_Volumes_Shared_macports-ports_devel_litehtml/litehtml/work/build/litehtml_tests'
    Result: 1
    Output:
      Running main() from /opt/local/var/macports/build/_Volumes_Shared_macports-ports_devel_litehtml/litehtml/work/build/_deps/googletest-src/googletest/src/gtest_main.cc
      Cannot read test directory
      

Call Stack (most recent call first):
  /opt/local/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:225 (gtest_discover_tests_impl)


make[2]: *** [litehtml_tests] Error 1
@DUNDUN-ww
Copy link

I also have the same error. Do you have a solution?😉

@ryandesign
Copy link
Contributor Author

@DUNDUN-ww Yes, the problem is here:

const char* test_dir = "../test/render/"; // ctest is run from litehtml/build

As it says in the comment, it assumes that you are doing an out-of-source build in a directory created inside the source directory. In other words, in the top-level litehtml directory, do this:

mkdir build
cd build
cmake ..
make
make test

It will not work if you are doing an in-source build (in other words, if you do cmake . in the top-level litehtml directory) nor will it work if you are doing an out-of-source build but your build directory is not immediately inside the top-level litehtml directory. (In my case, my build directory was outside of the top-level litehtml directory.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants