Skip to content

Keep spaces in string parameters and stop on genBC failures - #703

Open
zasexton wants to merge 4 commits into
SimVascular:mainfrom
zasexton:issue-693
Open

zasexton wants to merge 4 commits into
SimVascular:mainfrom
zasexton:issue-693

Conversation

@zasexton

Copy link
Copy Markdown
Collaborator

Current situation

Parameter::set removes every space from string values, so my results becomes myresults. genBC_Integ_X runs genBC through system() and ignores its exit status, so a missing or failing genBC goes unnoticed.

This PR trims only leading and trailing whitespace, launches genBC without a shell and stops when it cannot start or fails, and replaces the mkdir -p and ln -f shell commands for the results folder and restart links with std::filesystem, so paths with spaces work.

Fixes #693.

Release Notes

  • String parameters keep their internal spaces; only leading and trailing whitespace is removed.
  • The solver stops with an error when genBC cannot start or fails, or when the results folder cannot be created.

Documentation

No documentation changes are needed.

Testing

  • Built the solver and passed the unit tests.
  • Added tests for a restart in a folder whose name contains spaces, a results folder that cannot be created, genBC at a path with spaces, and a missing genBC executable; they pass with 1, 3, and 4 processes.

Code of Conduct & Contributing Guidelines

Parameter::set removed every space from string values, so a results
folder named "my results" became "myresults". Trim only leading and
trailing whitespace. Create the results and remeshing folders and the
last-restart link with std::filesystem instead of shell commands, which
would split such paths and ignore their failures. Test a restart in a
folder whose name contains spaces and a results folder that cannot be
created.
genBC ran through system() with an unquoted command, and its exit status
was ignored, so when genBC was missing or failed the solver read back
the inputs it had just written as genBC's outputs. Launch genBC without
a shell and stop with an error when it cannot start or exits with a
nonzero status. Test genBC at a path that contains spaces and a missing
genBC executable.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@zasexton
zasexton requested a review from mrp089 October 19, 2026 23:19
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.72%. Comparing base (272073a) to head (098b8d5).

Files with missing lines Patch % Lines
Code/Source/solver/remesh.cpp 0.00% 5 Missing ⚠️
Code/Source/solver/utils.cpp 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #703      +/-   ##
==========================================
+ Coverage   73.45%   73.72%   +0.27%     
==========================================
  Files         281      281              
  Lines       40768    40778      +10     
  Branches     6770     6778       +8     
==========================================
+ Hits        29945    30063     +118     
+ Misses      10567    10458     -109     
- Partials      256      257       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zasexton
zasexton requested review from ktbolt and sujaldave October 20, 2026 01:40

@bearsontheloose bearsontheloose left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks good. I have three minor comments/questions.

if (chnl_mod.appPath != "") {
auto mkdir_arg = std::string("mkdir -p ") + chnl_mod.appPath;
std::system(mkdir_arg.c_str());
std::filesystem::create_directories(chnl_mod.appPath);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This changes error handling: std::system() ignored a failed mkdir, whereas std::filesystem::create_directories() throws std::filesystem::filesystem_error. The exception is caught by the top-level std::exception handler, so the run now fails immediately with a directory-creation error instead of continuing until history-file initialization fails. Is that intentional? I'm assuming it's an improvement.

int status;
while (waitpid(process, &status, 0) == -1) {
if (errno != EINTR) throw std::system_error(errno, std::generic_category(), "Could not wait for " + executable);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be helpful to report on the signal that terminated the process?

if (WIFSIGNALED(status)) { throw std::runtime_error( "Process terminated by signal " + std::to_string(WTERMSIG(status)) + ": " + executable ); }

Comment thread tests/test_fluid.py
shutil.copytree(Path(__file__).parent / "cases/fluid/pipe_RCR_genBC", case,
ignore=shutil.ignore_patterns("*-procs", "genBC"))
with pytest.raises(RuntimeError, match="Could not start genBC"):
run_by_name(str(case), "solver.xml", 2, n_proc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This checks that a missing genBC executable fails, but not that an executable which starts and exits with a nonzero status fails. That second case is part of the branch’s intended fix. Would you like to add a test?

This branch was previously deployed

1 inactive deployment
review-policy — 9a82169b Deployed Oct 29, 2026 by zasexton via evaluate #1843
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String parameters lose their spaces and genBC failures are ignored

2 participants