Skip to content

Conversation

@cottsay
Copy link
Member

@cottsay cottsay commented Jun 2, 2020

As suggested in #36 (comment), some of this approach takes after #37.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-coverage Build Status
  • macOS Build Status
  • Windows Build Status

@cottsay cottsay added enhancement New feature or request in review labels Jun 2, 2020
@cottsay cottsay requested a review from ahcorde June 2, 2020 21:48
@cottsay cottsay self-assigned this Jun 2, 2020
Comment on lines +54 to +56
} else if (severity == 0 && level == 10) {
// This is a special case - not sure what the right behavior is
expected_log << ss.str() << std::endl;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I called this out on Slack - not sure what the expected behavior should be here, so for now I'm just asserting the current behavior.

Comment on lines 81 to 103
std::stringstream dir_command;
dir_command << "dir";
#ifdef _WIN32
dir_command << " /B";
#endif
dir_command << " " << (log_dir / get_expected_log_prefix()).string() << "*";

FILE * fp = popen(dir_command.str().c_str(), "r");
if (nullptr == fp) {
throw std::runtime_error("Failed to glob for log files");
}

char raw_line[2048];
while (fgets(raw_line, sizeof(raw_line), fp) != NULL) {
pclose(fp);

std::string line(raw_line);
fs::path line_path(line.substr(0, line.find_last_not_of(" \t\r\n") + 1));
// This should be changed once ros2/rcpputils#68 is resolved
return line_path.is_absolute() ? line_path : log_dir / line_path;
}

pclose(fp);
Copy link
Member Author

@cottsay cottsay Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much all of this should be replaced with properly iterating the directory content to find the log file, but that functionality isn't available in the filesystem helper. So either we need to implement it, or we need to bump to C++17, because this is kinda gross. (Post-Foxy)

Comment on lines 110 to 117
char * exe_name = rcutils_get_executable_name(allocator);
if (nullptr == exe_name) {
throw std::runtime_error("Failed to determine executable name");
}
std::stringstream prefix;
prefix << exe_name << "_" <<
rcutils_get_pid() << "_";
allocator.deallocate(exe_name, allocator.state);
Copy link
Member Author

@cottsay cottsay Jun 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should support get_executable_name in rcpputils to avoid the need for an allocator here. Post-Foxy, of course.

@cottsay cottsay requested a review from jacobperron June 2, 2020 21:56
cottsay added 2 commits June 2, 2020 15:01
Signed-off-by: Scott K Logan <[email protected]>
Signed-off-by: Scott K Logan <[email protected]>
@cottsay cottsay requested a review from hidmic June 2, 2020 22:29
@jacobperron
Copy link
Member

I haven't reviewed the changes closely, but you have my blessing to merge pending approval. Since it's only test code, I think it's okay delay it's release into Foxy.

@cottsay cottsay removed the request for review from jacobperron June 2, 2020 22:33
Signed-off-by: Scott K Logan <[email protected]>
@cottsay cottsay force-pushed the more_spdlog_tests branch from 31f5f67 to a68f7ae Compare June 4, 2020 21:20
Copy link
Contributor

@Blast545 Blast545 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cottsay cottsay removed the request for review from ahcorde June 4, 2020 22:32
@cottsay cottsay merged commit c1bfac6 into master Jun 4, 2020
@delete-merged-branch delete-merged-branch bot deleted the more_spdlog_tests branch June 4, 2020 22:37
@clalancette clalancette mentioned this pull request Jun 8, 2020
ahcorde pushed a commit that referenced this pull request Oct 8, 2020
ahcorde pushed a commit that referenced this pull request Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request in review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants