rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.79k stars 314 forks source link

Make fails on testing bear::func_test #370

Closed ecopete closed 3 years ago

ecopete commented 3 years ago

Describe the bug make fails in test::func_test

To Reproduce run cmake .. -DCMAKE_C_COMPILER_ARG1="-m64" -DCMAKE_INSTALL_PREFIX:PATH=~/.local then run make

Expected behavior make succeeds with out errors

Environment:

Before you send...

rizsotto commented 3 years ago

Hey @ecopete , thanks for the report.

I can't reproduce this. (My developer machine runs F33 too.) Did you follow the instructions from the doc? What is the error you received?

ecopete commented 3 years ago

Hi @rizsotto Thanks for the quick response. I have to apologize I missed -DENABLE_UNIT_TESTS=OFF -DENABLE_FUNC_TESTS=OFF from the INSTALL.md. When I turn off the tests it does work.

However, it would be good if those tests passed. I'm a QA engineer, so having to skip tests to install something raises a flag ;-) Also I noticed that the bear rpm is quite out of date on Fedora (2.4.4) and it may have to do with the build failures they have been experiencing here: https://bugzilla.redhat.com/show_bug.cgi?id=1921884

I couldn't quite see what these build failures are, but perhaps having the tests fail is the cause?

Again, thanks for the quick response and a great tool.

rizsotto commented 3 years ago

Hey @ecopete ,

as I said earlier, I am happy to help, but don't know what is the problem...

The INSTALL.md not only tells how to run the build without the tests, but also how to run the tests. If you install the necessary tools/dependencies Fedora 33 is actually works without any extra steps. (Not like MacOS or Ubuntu.) If this is not the case for you, then the INSTALL.md might need a fix. But again, I don't know what is the problem.

I'm closing the ticket now. Feel free to provide details of the failure and we can re-open it.

ecopete commented 3 years ago

Sorry for the confusion, I should have made it clearer that I was building on the 3.0.11 branch :smile: When I checkout master everything works fine.

It would be good to fix 3.0.11 branch so Fedora can build rpms. I'm assuming that's how they build it.

rizsotto commented 3 years ago

The latest commit on master has the tag 3.0.11. To me those two are the same. (No branch called 3.0.11.)

When I say I don't know what the problem is I meant I would like to see compiler output or build log what failed. (I have Fedora 33 and this project builds with test without a problem.)

This is the build script I use (similar commands are written in the INSTALL.md).

export CTEST_OUTPUT_ON_FAILURE=1
cmake -B $build_dir -S $source_dir -DCMAKE_INSTALL_PREFIX:PATH="$install_dir";
cmake --build $build_dir --parallel 11;
cmake --build $build_dir --target install;

The package list you need is in the INSTALL.md.

This is how you can verify the needed func test tool.

$ lit --version
lit 0.11.0.post1
ecopete commented 3 years ago

Yeah, I made my own local branch from that tag. I somehow missed rebasing my local master so I was still on a super old version so that worked.

Anyway, your way works, but what I need is to do the multilib build, because we use compilers that are 32bit. So I followed https://github.com/rizsotto/Bear/wiki/Usage#multilib-issues

I double checked if I installed all the dependencies listed in INSTALL.md

Package json-devel-3.9.1-1.fc33.x86_64 is already installed.
Package spdlog-devel-1.8.5-1.fc33.x86_64 is already installed.
Package fmt-devel-7.0.3-1.fc33.x86_64 is already installed.
Package grpc-devel-1.26.0-8.fc33.x86_64 is already installed.
Package grpc-plugins-1.26.0-8.fc33.x86_64 is already installed.
Package gtest-devel-1.10.0-6.fc33.x86_64 is already installed.
Package gmock-devel-1.10.0-6.fc33.x86_64 is already installed.

My lit is:

lit 0.11.0.post1

Here we go

cmake .. -DCMAKE_C_COMPILER_ARG1="-m32" -DCMAKE_INSTALL_PREFIX:PATH=~/.local                                                                                                                                                    
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting build type to 'Release' as none was specified.
-- Looking for nlohman_json dependency
-- Looking for nlohman_json dependency -- found
-- Looking for fmt dependency
-- Looking for fmt dependency -- found
-- Looking for spdlog dependency
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for spdlog dependency -- found
-- Looking for gRPC::grpc++ dependency
-- Found PkgConfig: /home/linuxbrew/.linuxbrew/bin/pkg-config (found version "0.29.2") 
-- Checking for modules 'protobuf>=3.11;grpc++>=1.26'
--   No package 'protobuf' found
--   No package 'grpc++' found
-- Looking for gRPC::grpc++ dependency -- not found
-- Looking for GTest dependency
-- Checking for modules 'gtest>=1.10;gtest_main>=1.10;gmock>=1.10'
--   No package 'gtest' found
--   No package 'gtest_main' found
--   No package 'gmock' found
-- Looking for GTest dependency -- not found[LastTest.log](https://github.com/rizsotto/Bear/files/6368887/LastTest.log)
[LastTest.log](https://github.com/rizsotto/Bear/files/6368889/LastTest.log)

-- Generating done
-- Build files have been written to: /tmp/Bear/build32

ok then I build it

cmake --build . --target bear::func_test
...

0% tests passed, 1 tests failed out of 1

Total Test time (real) =  90.27 sec

The following tests FAILED:
      1 - bear::func_test (Timeout)
Errors while running CTest
gmake[2]: *** [CMakeFiles/BearTest.dir/build.make:139: subprojects/Stamp/BearTest/BearTest-test] Error 8
gmake[1]: *** [CMakeFiles/Makefile2:219: CMakeFiles/BearTest.dir/all] Error 2
gmake: *** [Makefile:171: all] Error 2

Do you want that entire output?

I see subprojects/Build/BearTest/Testing/Temporary/LastTest.log so let me upload that here

LastTest.log

Please let me know which files/output you want to see?

rizsotto commented 3 years ago

Hey @ecopete , thanks for the logs. That was helpful!

ecopete commented 3 years ago

I uninstalled ccache, deleted my build dir to make sure and re-run the steps. Same test failure. Logs are attached. LastTest.log

rizsotto commented 3 years ago

Thanks @ecopete , this logs looks much better now. :) Now one of the test tools events_db is failing.

This test tools created in the 3.0.11 release. So, this might have some problems. (It did not failed on my Ubuntu, Arch and Fedora.) Could you run one of those failed command with verbose flags to find out what's the problem? One of those lines in your logs looks like this:

$ "/tmp/Bear/build/subprojects/Build/BearSource/intercept/events_db" "dump" "--path" "/tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp.events.db" "--output" "/tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp.json"
events_db: failed with: 

Just pass --verbose as a last argument... And maybe check if the input file is exists (the file named after the --path flag).

ecopete commented 3 years ago

I run this line with --verbose and it outputs

/tmp/Bear/build/subprojects/Build/BearSource/intercept/events_db dump --path /tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp.events.db --output /tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp2.json --verbose
[14:33:47.068399, db, 3926204] events_db: 3.0.11
[14:33:47.068564, db, 3926204] arguments: ["/tmp/Bear/build/subprojects/Build/BearSource/intercept/events_db", "dump", "--path", "/tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp.events.db", "--output", "/tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp2.json", "--verbose"]
[14:33:47.068641, db, 3926204] environment: [...redacted...]
[14:33:47.068754, db, 3926204] sysname: Linux
[14:33:47.068763, db, 3926204] release: 5.11.15-200.fc33.x86_64
[14:33:47.068769, db, 3926204] version: #1 SMP Fri Apr 16 13:41:20 UTC 2021
[14:33:47.068776, db, 3926204] machine: x86_64
[14:33:47.068793, db, 3926204] arguments parsed: {program: dump, arguments: [{--output: [/tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp.json]}, {--path: [/tmp/Bear/build/subprojects/Build/BearTest/cases/intercept/preload/posix/execlp/Output/failure_prints_errno.c.tmp.events.db]}, {--verbose: []}, {command: [dump]}]}
[14:33:47.074354, db, 3926204] failed with:

I looked in failure_prints_errno.c.tmp.json and it seems it's missing a closing ] to be a valid json file. failure_prints_errno.c.tmp.json.txt