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

Use initlog() in more tests. #14719

Merged
merged 1 commit into from Jan 25, 2023
Merged

Use initlog() in more tests. #14719

merged 1 commit into from Jan 25, 2023

Conversation

drwells
Copy link
Member

@drwells drwells commented Jan 24, 2023

Part of #4250. I was reminded of this when reviewing one of the PETSc patches - its pretty easy to automatically convert many of these with a python script.

Copy link
Member

@tamiko tamiko left a comment

Choose a reason for hiding this comment

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

It looks like the conversion did not completely work for a small number of tests.

tests/bits/step-10-high-order.cc Outdated Show resolved Hide resolved
tests/bits/step-10-high-order.cc Show resolved Hide resolved
These required a small amount of manual tidying-up but the script I used to
generate most of the changes is

#!/usr/bin/env python3

import sys

lines = list()
skip_next_if_blank = False
with open(sys.argv[1], 'r') as handle:
    for line in handle:
        if line != 'std::ofstream logfile("output");\n':
            if "deallog.attach" not in line:
                if skip_next_if_blank and line == "\n":
                    pass
                else:
                    lines.append(line.replace("logfile",
                                              "deallog.get_file_stream()"))
                    skip_next_if_blank = False
        else:
            skip_next_if_blank = True

found_main = False
line_after_main = -1
with open(sys.argv[1], 'w') as handle:
    for line in lines:
        handle.write(line)
        if line.startswith("main("):
            found_main = True
        if found_main:
            line_after_main = line_after_main + 1
        if line_after_main == 1:
            handle.write("  initlog();\n")
@drwells
Copy link
Member Author

drwells commented Jan 24, 2023

The tests passed locally for me but it's worth cleaning things up - both comments should now be fixed in all files.

@bangerth
Copy link
Member

@tamiko is still blocking the merge. I'll let him comment/pull the trigger.

@tamiko
Copy link
Member

tamiko commented Jan 25, 2023

@bangerth Feel free to simply dismiss such a change request from me as "resolved" in the future.

@tamiko tamiko merged commit 71d9bb6 into dealii:master Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants