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

Create concrete playback temp files in source directory #2804

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

tautschnig
Copy link
Member

Concrete playback seeks to generate unit tests in the original source file. An intermediate temporary file is used to reduce the risk of corrupting original source files. Once the temporary file has been completely written to, it is to be atomically moved to replace the source file. This can only be done on the same file system.

We now create the temporary file in the same source directory as the original source file to ensure we are on the same file system. The implementation uses NamedTempFile from the tempfile crate, which renders our own tempfile implementation redundant.

Tested on Ubuntu 20.04 with /tmp on a different partition (where our regression tests would previously fail).

Resolves: #2705

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Concrete playback seeks to generate unit tests in the original source
file. An intermediate temporary file is used to reduce the risk of
corrupting original source files. Once the temporary file has been
completely written to, it is to be atomically moved to replace the
source file. This can only be done on the same file system.

We now create the temporary file in the same source directory as the
original source file to ensure we are on the same file system. The
implementation uses NamedTempFile from the tempfile crate, which renders
our own tempfile implementation redundant.

Tested on Ubuntu 20.04 with /tmp on a different partition (where our
regression tests would previously fail).

Resolves: model-checking#2705
@tautschnig tautschnig requested a review from a team as a code owner October 4, 2023 10:06
@github-actions github-actions bot added the Z-BenchCI Tag a PR to run benchmark CI label Oct 4, 2023
Copy link
Contributor

@jaisnan jaisnan left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

@tautschnig tautschnig merged commit fb08f3e into model-checking:main Oct 4, 2023
13 checks passed
@tautschnig tautschnig deleted the fix-2705 branch October 4, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-BenchCI Tag a PR to run benchmark CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Concrete playback fails when temp folder is on a different mount point
2 participants