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

Correct problems with loading dynamic components #1514

Merged
merged 1 commit into from
May 15, 2015
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
4 changes: 2 additions & 2 deletions hpx/util/logging/format/destination/rolling_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace detail {
if ( m_flags.initial_erase()) {
for ( unsigned idx = 0; idx < m_flags.file_count(); ++idx) {
boost::system::error_code ec;
if ( fs::exists( file_name(idx), ec) && ec)
if ( fs::exists( file_name(idx), ec) && !ec)
fs::remove( file_name(idx) );
}
}
Expand All @@ -103,7 +103,7 @@ namespace detail {
if ( m_flags.start_where_size_not_exceeded() ) {
for ( m_cur_idx = 0; m_cur_idx < m_flags.file_count(); ++m_cur_idx ) {
boost::system::error_code ec;
if ( fs::exists( file_name(m_cur_idx), ec) && ec) {
if ( fs::exists( file_name(m_cur_idx), ec) && !ec) {
if ( fs::file_size( file_name(m_cur_idx)) < m_flags.max_size_bytes() )
// file hasn't reached max size
break;
Expand Down
8 changes: 4 additions & 4 deletions src/util/init_ini_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace hpx { namespace util
try {
namespace fs = boost::filesystem;
boost::system::error_code ec;
if (!fs::exists(loc, ec) || !ec)
if (!fs::exists(loc, ec) || ec)
return false; // avoid exception on missing file
ini.read (loc);
}
Expand Down Expand Up @@ -132,7 +132,7 @@ namespace hpx { namespace util
if (!hpx_ini_file.empty()) {
namespace fs = boost::filesystem;
boost::system::error_code ec;
if (!fs::exists(hpx_ini_file, ec) || !ec) {
if (!fs::exists(hpx_ini_file, ec) || ec) {
std::cerr << "hpx::init: command line warning: file specified using "
"--hpx::config does not exist ("
<< hpx_ini_file << ")." << std::endl;
Expand Down Expand Up @@ -179,7 +179,7 @@ namespace hpx { namespace util
fs::path this_path (hpx::util::create_path(*it));

boost::system::error_code ec;
if (!fs::exists(this_path, ec) || !ec)
if (!fs::exists(this_path, ec) || ec)
continue;

for (fs::directory_iterator dir(this_path); dir != nodir; ++dir)
Expand Down Expand Up @@ -381,7 +381,7 @@ namespace hpx { namespace util
fs::path libs_path (hpx::util::create_path(libs));

boost::system::error_code ec;
if (!fs::exists(libs_path, ec) || !ec)
if (!fs::exists(libs_path, ec) || ec)
return plugin_registries; // given directory doesn't exist

// retrieve/create section [hpx.components]
Expand Down
2 changes: 1 addition & 1 deletion src/util/runtime_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ namespace hpx { namespace util
if (p.second) {
// have all path elements, now find ini files in there...
fs::path this_path (hpx::util::create_path(*p.first));
if (fs::exists(this_path, fsec) || !fsec) {
if (fs::exists(this_path, fsec) && !fsec) {
plugin_list_type tmp_regs =
util::init_ini_data_default(
this_path.string(), *this, basenames, modules_);
Expand Down
1 change: 1 addition & 0 deletions tests/regressions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ endforeach()

set(tests
commandline_options_1437
dynamic_counters_loaded_1508
id_type_ref_counting_1032
multiple_init
unhandled_exception_582
Expand Down
49 changes: 49 additions & 0 deletions tests/regressions/dynamic_counters_loaded_1508.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright (c) 2015 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)
//
// Demonstrating #1508: memory and papi counters do not work

#include <hpx/hpx.hpp>
#include <hpx/hpx_init.hpp>
#include <hpx/include/performance_counters.hpp>
#include <hpx/util/lightweight_test.hpp>

int hpx_main(int argc, char ** argv)
{
using hpx::performance_counters::performance_counter;

bool counter_created = false;
bool value_retrieved = false;

try {
performance_counter memory("/runtime/memory/resident");
counter_created = true;

using hpx::performance_counters::counter_value;
using hpx::performance_counters::status_is_valid;

counter_value value = memory.get_counter_value_sync();
HPX_TEST(status_is_valid(value.status_));

double val = value.get_value<double>();
HPX_TEST_LT(0.0, val);

value_retrieved = true;
}
catch (hpx::exception const&) {
HPX_TEST(false);
}

HPX_TEST(counter_created);
HPX_TEST(value_retrieved);

return hpx::finalize();
}

int main(int argc, char **argv)
{
HPX_TEST_EQ(hpx::init(argc, argv), 0);
return hpx::util::report_errors();
}