Skip to content

Commit

Permalink
Fix chainbase_test error, add to ctest
Browse files Browse the repository at this point in the history
  • Loading branch information
b1aafulei committed May 12, 2020
1 parent d6632fc commit 6ff490b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ if(WIN32)
target_link_libraries( chainbase ws2_32 mswsock )
endif()

enable_testing()
add_subdirectory( test )
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/chainbase DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR})

Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ file(GLOB UNIT_TESTS "*.cpp")
add_executable( chainbase_test ${UNIT_TESTS} )
target_link_libraries( chainbase_test chainbase Boost::unit_test_framework ${OPENSSL_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} )

add_test(NAME test_chainbase COMMAND chainbase_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
3 changes: 2 additions & 1 deletion test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE( open_and_create ) {
std::cerr << temp << " \n";

chainbase::database db(temp, database::read_write, 1024*1024*8);
chainbase::database db2(temp); /// open an already created db
chainbase::database db2(temp, database::read_only, 0, true); /// open an already created db
BOOST_CHECK_THROW( db2.add_index< book_index >(), std::runtime_error ); /// index does not exist in read only database

db.add_index< book_index >();
Expand Down Expand Up @@ -129,6 +129,7 @@ BOOST_AUTO_TEST_CASE( open_and_create ) {
bfs::remove_all( temp );
throw;
}
bfs::remove_all(temp);
}

// BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 6ff490b

Please sign in to comment.