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

Fix test error: set allow_dirty to true for db2 to make test pass #67

Merged
merged 1 commit into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()