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

Execute model checkers in a temporary directory #48

Merged
merged 5 commits into from
Jul 21, 2021

Conversation

andrey-kuprianov
Copy link
Contributor

This closes #33 via a simple workaround, by adding the code to the traces() function that:

  • creates a temp dir
  • copies all .tla and .cfg files into it
  • executes model checkers in that dir
  • cleans up by removing the temp dir

This prevents polluting the current directory with temporary files from generating the tests, as well as from the model checkers' output.

Some tests have been written under the assumptions that are incompatible with using the temporary directories, so those have been disabled; the refactoring to be tracked in #47.

The cache has been disabled as well; this is to be tracked in #46.

@andrey-kuprianov andrey-kuprianov requested review from romac and rnbguy July 19, 2021 09:43
Copy link
Member

@rnbguy rnbguy left a comment

Choose a reason for hiding this comment

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

The tempfile code looks good to me. But we can probably remove the walkdir dependency.

for entry in WalkDir::new(dir)
.min_depth(1)
.max_depth(1)
.into_iter()
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need walkdir for this? std::fs::read_dir should be enough, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! How about you refactor this to use std::fs::read_dir, right in this branch? it would be great to avoid an additional dependency, true.

Copy link
Member

Choose a reason for hiding this comment

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

Done! Ran cargo test.

Copy link
Contributor Author

@andrey-kuprianov andrey-kuprianov Jul 19, 2021

Choose a reason for hiding this comment

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

Great, looks good!
thanks:)

@andrey-kuprianov andrey-kuprianov merged commit b5148c6 into main Jul 21, 2021
@andrey-kuprianov andrey-kuprianov deleted the andrey/tempdir branch July 21, 2021 14:47
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.

Execute model checkers in a temporary directory
2 participants