modern-cmake / cppfront

CMake wrapper around the cppfront repository
BSD 3-Clause "New" or "Revised" License
75 stars 21 forks source link

ctest: No tests were found #64

Closed ntrel closed 5 months ago

ntrel commented 1 year ago

I'm new to cmake and I'm following the instructions here: https://github.com/modern-cmake/cppfront#find-package

$ cmake --version
cmake version 3.22.1

$ cmake -S cppfront -B build -DCMAKE_BUILD_TYPE=Release
CMake Error: The source directory "/home/nick/git/cmake-cppfront/cppfront" does not appear to contain CMakeLists.txt.
ntrel commented 1 year ago

I removed -S cppfront and updated cmake and it generates build/Makefile. Running that works.

Also, how do I run the tests?

ntrel commented 1 year ago

Running ctest I get:

Test project /home/nick/git/cmake-cppfront/regression-tests
No tests were found!!!
alexreinking commented 1 year ago

You aren't following the directions to the letter. You cloned this repository to a directory called cmake-cppfront and then cd'd into it. The instructions in the README show cloning this repository into a directory called cppfront, not entering it, and using CMake to build it fully out-of-source.

ctest must be run from the build folder, not from the regression tests folder. This is not in the README right now, but should be.

ntrel commented 1 year ago

You aren't following the directions to the letter. You cloned this repository to a directory called cmake-cppfront and then cd'd into it.

OK, because I already checked out hsutter/cppfront.

ctest must be run from the build folder, not from the regression tests folder. This is not in the README right now, but should be.

I tried running it from every folder I could think of yesterday. I tried the updated commands today, no luck:

$ ctest --test-dir build
Internal ctest changing into directory: /home/nick/git/cmake-cppfront/build
Test project /home/nick/git/cmake-cppfront/build
No tests were found!!!
alexreinking commented 1 year ago

You don't need to separately check out upstream cppfront. It's included already as a submodule.

At this point, I cannot help you further without you posting a complete, unedited log of every command you ran leading up to this error, starting from a known directory, downloading this repository and building it. I cannot reproduce it locally.

ntrel commented 1 year ago

You don't need to separately check out upstream cppfront. It's included already as a submodule.

I was using that before I realized I needed this repo to run the tests. Just mentioning it because that workflow is probably common for contributors (it's not ideal that this repo has the same name as a submodule repo).

This is an unedited log of commands I just ran. I didn't checkout the repo again because that was too awkward, but you can see from git status and git show (at the end) what I have (checked out yesterday).

nick@nmt-pc:~/git/cmake-cppfront$ git status
On branch main
Your branch is up-to-date with 'origin/main'.

nothing to commit, working tree clean
nick@nmt-pc:~/git/cmake-cppfront$ rm -rf build/
nick@nmt-pc:~/git/cmake-cppfront$ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/local
-- The CXX compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (1.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/nick/git/cmake-cppfront/build
nick@nmt-pc:~/git/cmake-cppfront$ cmake --build build --target install
[ 50%] Building CXX object CMakeFiles/cppfront_cppfront.dir/cppfront/source/cppfront.cpp.o
[100%] Linking CXX executable cppfront
[100%] Built target cppfront_cppfront
Install the project...
-- Install configuration: "Release"
-- Installing: /home/nick/local/bin/cppfront
-- Up-to-date: /home/nick/local/include/cpp2util.h
-- Installing: /home/nick/local/share/cmake/cppfront/cppfront-targets.cmake
-- Installing: /home/nick/local/share/cmake/cppfront/cppfront-targets-release.cmake
-- Installing: /home/nick/local/share/cmake/cppfront/cppfront-config.cmake
-- Installing: /home/nick/local/share/cmake/cppfront/cppfront-config-version.cmake
-- Up-to-date: /home/nick/local/share/cmake/cppfront/CppfrontHelpers.cmake
nick@nmt-pc:~/git/cmake-cppfront$ ctest --test-dir build
Internal ctest changing into directory: /home/nick/git/cmake-cppfront/build
Test project /home/nick/git/cmake-cppfront/build
No tests were found!!!
nick@nmt-pc:~/git/cmake-cppfront$ git show |head
commit 9a74f70d8a147052d40da3503c43909cc8f94241
Author: Alex Reinking <alex.reinking@gmail.com>
Date:   Fri Mar 10 10:23:14 2023 -0800

    Update ci.yml

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 70aca86..524afa4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
nick@nmt-pc:~/git/cmake-cppfront$ cmake --version
cmake version 3.26.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
nick@nmt-pc:~/git/cmake-cppfront$ ctest --version
ctest version 3.26.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
nick@nmt-pc:~/git/cmake-cppfront$ 
alexreinking commented 5 months ago

The repo has diverged since this issue was open. Please feel free to open a new issue if you're still having problems.