Commit Graph

6 Commits

Author SHA1 Message Date
Tomasz Grabiec
11a501d884 tests: fix assertion failure at test program exit
Seastar's allocator has an assertion which checks that the memory
block is freed on the same CPU on which it was allocated. This is
reasonable because all allocations in seastar need to be CPU-local.

The problem is that boost libraries (program_options,
unit_testing_framework) make heavy use of lazily-allocated static
variables, for instance:

    const variable_value&
    variables_map::get(const std::string& name) const
    {
        static variable_value empty;
        // ...
    }

Such variable will be allocated in in the current threads but freed in
the main thread when exit handlers are executed.

This results in:

output_stream_test: core/memory.cc:415: void memory::cpu_pages::free(void*):
Assertion `((reinterpret_cast<uintptr_t>(ptr) >> cpu_id_shift) & 0xff) == cpu_id' failed.

This change works around the problem by forcing initialization in the
main thread.

See issue #10.
2014-12-04 13:37:02 +01:00
Avi Kivity
6b5973af70 app-template: don't alias boost::program_options as bpo in a header file
We only have one global namespace, let's work together to keep it free
of pollution.
2014-12-01 17:56:34 +02:00
Tomasz Grabiec
9c9f3d21bf tests: make option defaults be effective in tests 2014-11-20 10:40:03 +02:00
Tomasz Grabiec
825b3608a4 tests: configure reactor for tests
Commit 405f3ea8c3 changed reactor so
that _network_stack is no longer default initialized to POSIX but to
nullptr. This caused tests to segfault, becayse they are not using
application template which takes care of configuration.

The fix is to call configure() so that netwrok stack will be set to
POSIX.
2014-11-15 11:58:07 -08:00
Tomasz Grabiec
5f3352b7e3 tests: integrate with BOOST UTF
Asynchronous test cases can be delared using SEASTAR_TEST_CASE macro,
which is equivalent to BOOST_AUTO_TEST_CASE, but the function body is
run inside a reactor and can returns a future<> which resolves when
the test is done.
2014-10-15 15:50:28 +02:00
Tomasz Grabiec
9a0ab2f1a4 tests: introduce some basic utilities used by tests 2014-10-01 13:21:09 +02:00