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

Cmake unittest cpp integration #68

Merged

Conversation

scott-eddy
Copy link
Contributor

This removes unittest as a git submodule from the project and instead adds it using CMake built-in utilities. In the case where a user has already installed UnitTest++ per their instructions this pulls in the library and headers using the provided find_package() utilities. In the case where the user hasn't installed UnitTest++ this uses CMake's ExternalProjectAdd() to build the library.

There are some issues with the I'm still working through but things are mostly there:

  1. ETL tests assume that the visual studio project is setup to use Unicode support, but this is not always the case
  2. Visual Studio's packaged git does not integrate with git submodules. This can make things problematic on windows builds if Visual Studio doesn't use the git for windows installed on the system.
  3. The embedded_compile test is removed because it brings in requirements for stm32. Likely this will be a different test suit in cmake
  4. There appear to be actual test failures that need to be investigated. .

In particular interest is 4 listed above. When running all the tests on Linux I get the following output

$ make test_verbose
UpdateCTestConfiguration  from :/home/eddy/OpenSource/etl/build/test/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/eddy/OpenSource/etl/build/test/DartConfiguration.tcl
Test project /home/eddy/OpenSource/etl/build/test
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: etl_unit_tests

1: Test command: /home/eddy/OpenSource/etl/build/test/etl_tests
1: Test timeout computed to be: 9.99988e+06
1: /home/eddy/OpenSource/etl/test/test_array_wrapper.cpp:561:1: error: Failure in test_hash: Expected 2393499409 but was 16945204039888152049
1: /home/eddy/OpenSource/etl/test/test_forward_list.cpp:1186:1: error: Failure in test_move_range: Expected exception: "etl::forward_list_iterator" not thrown
1: /home/eddy/OpenSource/etl/test/test_hash.cpp:151:1: error: Failure in test_hash_float: Expected 1067320345 but was 9821047038287739023
1: /home/eddy/OpenSource/etl/test/test_list.cpp:129:1: error: Failure in test_constructor_size_excess: Expected exception: "etl::list_full" not thrown
1: /home/eddy/OpenSource/etl/test/test_list.cpp:153:1: error: Failure in test_constructor_size_value_excess: Expected exception: "etl::list_full" not thrown
1: /home/eddy/OpenSource/etl/test/test_list.cpp:360:1: error: Failure in test_assign_size_value_excess: Expected exception: "etl::list_full" not thrown
1: /home/eddy/OpenSource/etl/test/test_list.cpp:1359:1: error: Failure in test_splice_range_same: Expected exception: "etl::list_iterator" not thrown
1: /home/eddy/OpenSource/etl/test/test_list.cpp:1655:1: error: Failure in test_merge_exception: Expected exception: "etl::list_unsorted" not thrown
1: /home/eddy/OpenSource/etl/test/test_optional.cpp:357:1: error: Failure in test_exception: Expected exception: "etl::optional_invalid" not thrown
1: /home/eddy/OpenSource/etl/test/test_pool.cpp:390:1: error: Failure in test_type_error: Expected exception: "etl::pool_element_size" not thrown
1: /home/eddy/OpenSource/etl/test/test_string_char.cpp:3026:1: error: Failure in test_hash: Expected 1605245794 but was 6616663520476367746
1: /home/eddy/OpenSource/etl/test/test_string_char.cpp:3031:1: error: Failure in test_hash: Expected 1605245794 but was 6616663520476367746
1: /home/eddy/OpenSource/etl/test/test_string_u16.cpp:3025:1: error: Failure in test_hash: Expected 2022596318 but was 16966491407906030398
1: /home/eddy/OpenSource/etl/test/test_string_u16.cpp:3030:1: error: Failure in test_hash: Expected 2022596318 but was 16966491407906030398
1: /home/eddy/OpenSource/etl/test/test_string_u32.cpp:3025:1: error: Failure in test_hash: Expected 1479328846 but was 459603549263722414
1: /home/eddy/OpenSource/etl/test/test_string_u32.cpp:3030:1: error: Failure in test_hash: Expected 1479328846 but was 459603549263722414
1: /home/eddy/OpenSource/etl/test/test_string_wchar_t.cpp:3025:1: error: Failure in test_hash: Expected 1479328846 but was 459603549263722414
1: /home/eddy/OpenSource/etl/test/test_string_wchar_t.cpp:3030:1: error: Failure in test_hash: Expected 1479328846 but was 459603549263722414
1: FAILURE: 14 out of 2288 tests failed (18 failures).
1: Test time: 2.92 seconds.
1/1 Test #1: etl_unit_tests ...................***Failed    3.08 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   3.09 sec

These appear to actually be failures but could be the result of mismatched profiles.

Anyway, I wanted to get people looking at this PR sooner rather than later since it is a somewhat larger change.

@jwellbelove
Copy link
Contributor

The hash errors look like the difference between 32 and 64 bit builds.
The tests are comparing 32 bit hashes against the string hashes, which will change according to the size of size_t.
The hash tests may need to be re-coded to adapt to the size of size_t.

@jwellbelove jwellbelove changed the base branch from master to feature/CMake April 8, 2018 17:32
@jwellbelove jwellbelove merged commit 692cd9c into ETLCPP:feature/CMake Apr 24, 2018
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

Successfully merging this pull request may close these issues.

2 participants