-
-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test to verify that '#1173: hpx::cout output lost' is fixed
- Loading branch information
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ set(subdirs | |
agas | ||
actions | ||
block_matrix | ||
iostreams | ||
lcos | ||
performance_counters | ||
threads | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright (c) 2007-2014 Hartmut Kaiser | ||
# | ||
# Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
set(tests | ||
no_output_1173 | ||
) | ||
|
||
set(no_output_1173_PARAMETERS LOCALITIES 2) | ||
set(no_output_1173_FLAGS DEPENDENCIES iostreams_component) | ||
|
||
foreach(test ${tests}) | ||
set(sources | ||
${test}.cpp) | ||
|
||
source_group("Source Files" FILES ${sources}) | ||
|
||
# add example executable | ||
add_hpx_executable(${test}_test | ||
SOURCES ${sources} | ||
${${test}_FLAGS} | ||
FOLDER "Tests/Regressions/Iostreams") | ||
|
||
add_hpx_regression_test("iostreams" ${test} ${${test}_PARAMETERS}) | ||
|
||
# add a custom target for this example | ||
add_hpx_pseudo_target(tests.regressions.iostreams.${test}) | ||
|
||
# make pseudo-targets depend on master pseudo-target | ||
add_hpx_pseudo_dependencies(tests.regressions.iostreams | ||
tests.regressions.iostreams.${test}) | ||
|
||
# add dependencies to pseudo-target | ||
add_hpx_pseudo_dependencies(tests.regressions.iostreams.${test} | ||
${test}_test_exe) | ||
endforeach() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2014 Luis Ayuso | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <hpx/hpx.hpp> | ||
#include <hpx/hpx_init.hpp> | ||
#include <hpx/include/iostreams.hpp> | ||
#include <hpx/util/lightweight_test.hpp> | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
void worker() | ||
{ | ||
hpx::consolestream << "hello!" << hpx::endl; | ||
} | ||
HPX_PLAIN_ACTION(worker, worker_action); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
int hpx_main(boost::program_options::variables_map& vm) | ||
{ | ||
typedef hpx::future<void> wait_for_worker; | ||
std::vector<wait_for_worker> futures; | ||
|
||
// get locations and start workers | ||
std::string expected; | ||
for(auto l: hpx::find_all_localities()) | ||
{ | ||
futures.push_back(hpx::async(worker_action(), l)); | ||
expected += "hello!\n"; | ||
} | ||
hpx::wait_all(futures); | ||
|
||
std::stringstream const& console_strm = hpx::get_consolestream(); | ||
|
||
HPX_TEST_EQ(hpx::finalize(), 0); | ||
HPX_TEST_EQ(console_strm.str(), expected); | ||
|
||
return 0; | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
HPX_TEST_EQ_MSG(hpx::init(argc, argv), 0, | ||
"HPX main exited with non-zero status"); | ||
|
||
return hpx::util::report_errors(); | ||
} |