diff options
| author | Jozef Grajciar | 2019-02-08 10:41:23 +0100 |
|---|---|---|
| committer | Jozef Grajciar | 2019-02-08 10:41:23 +0100 |
| commit | 7f229b4ff1463fc6fdcefe3c5acb192bf491f50a (patch) | |
| tree | a208556c4b725bd25138b294504cc9e4b71aba03 /include | |
| parent | c03b23c84b6536c53e0a5057533aae742efcc20c (diff) | |
| download | catch3-7f229b4ff1463fc6fdcefe3c5acb192bf491f50a.tar.gz | |
fix SEGFAULTs
issue was that mutable context had no config thus trying to get stream
caused SEGFAULT
Closes #1533, #1534
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_list.cpp | 18 | ||||
| -rw-r--r-- | include/internal/catch_list.h | 2 | ||||
| -rw-r--r-- | include/internal/catch_session.cpp | 5 |
3 files changed, 15 insertions, 10 deletions
diff --git a/include/internal/catch_list.cpp b/include/internal/catch_list.cpp index 6010ec15..e1d99222 100644 --- a/include/internal/catch_list.cpp +++ b/include/internal/catch_list.cpp @@ -12,6 +12,7 @@ #include "catch_interfaces_reporter.h" #include "catch_interfaces_testcase.h" +#include "catch_context.h" #include "catch_stream.h" #include "catch_text.h" @@ -146,15 +147,16 @@ namespace Catch { return factories.size(); } - Option<std::size_t> list( Config const& config ) { + Option<std::size_t> list( std::shared_ptr<Config> const& config ) { Option<std::size_t> listedCount; - if( config.listTests() ) - listedCount = listedCount.valueOr(0) + listTests( config ); - if( config.listTestNamesOnly() ) - listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config ); - if( config.listTags() ) - listedCount = listedCount.valueOr(0) + listTags( config ); - if( config.listReporters() ) + getCurrentMutableContext().setConfig( config ); + if( config->listTests() ) + listedCount = listedCount.valueOr(0) + listTests( *config ); + if( config->listTestNamesOnly() ) + listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config ); + if( config->listTags() ) + listedCount = listedCount.valueOr(0) + listTags( *config ); + if( config->listReporters() ) listedCount = listedCount.valueOr(0) + listReporters(); return listedCount; } diff --git a/include/internal/catch_list.h b/include/internal/catch_list.h index bd29d970..cea7bbab 100644 --- a/include/internal/catch_list.h +++ b/include/internal/catch_list.h @@ -31,7 +31,7 @@ namespace Catch { std::size_t listReporters(); - Option<std::size_t> list( Config const& config ); + Option<std::size_t> list( std::shared_ptr<Config> const& config ); } // end namespace Catch diff --git a/include/internal/catch_session.cpp b/include/internal/catch_session.cpp index 6224fbe6..44b45dbc 100644 --- a/include/internal/catch_session.cpp +++ b/include/internal/catch_session.cpp @@ -10,6 +10,7 @@ #include "catch_console_colour.h" #include "catch_enforce.h" #include "catch_list.h" +#include "catch_context.h" #include "catch_run_context.h" #include "catch_stream.h" #include "catch_test_spec.h" @@ -170,6 +171,8 @@ namespace Catch { return 1; auto result = m_cli.parse( clara::Args( argc, argv ) ); + config(); + getCurrentMutableContext().setConfig( m_config ); if( !result ) { Catch::cerr() << Colour( Colour::Red ) @@ -262,7 +265,7 @@ namespace Catch { applyFilenamesAsTags( *m_config ); // Handle list request - if( Option<std::size_t> listed = list( config() ) ) + if( Option<std::size_t> listed = list( m_config ) ) return static_cast<int>( *listed ); auto totals = runTests( m_config ); |