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

Fix regression #1072 - parse output file not being created #1073

Merged
merged 14 commits into from
Nov 4, 2021

Conversation

shonfeder
Copy link
Contributor

@shonfeder shonfeder commented Nov 3, 2021

Closes #1072

Follow up to #1025, which caused a regression in the handling of the --output flag. Instead of writing the specified file, as it used (and as it seems it should), it was only writing to the intermediate subdirectory of the run directory, and then only when the --write-intermediate flag was also given.

This restores the previous behavior. I think the guiding principle for this kind of UI decision re: output files might be something like:

  • Files that we generate automatically during runs should only ever be written to the rundir
  • But if we are allowing users to get specific information out of apalche written to a file, then we should allow them to specify any file that for this output that is convenient for their process.

This PR also introduces a few utilities to the OutputManager to support the fix.


  • Tests added for any new code
  • Ran make fmt-fix (or had formatting run automatically on all files edited)
  • Documentation added for any new functionality
  • Entry added to UNRELEASED.md for any new functionality

Shon Feder added 7 commits November 3, 2021 18:27
Additionally:

- Fix output CLI parser to parse an optional value rather than just a
string
- Fix TlaWriterFactory to support writing to given PrintWriters, and not
just locations inside of the output dir
$ apalache-mc check --out-dir=./test-out-dir --length=0 Counter.tla &> /dev/null && find ./test-out-dir -type f -exec basename {} \; | ./sort.sh
$ apalache-mc check --out-dir=./test-out-dir --length=0 Counter.tla | sed 's/[IEW]@.*//' && find ./test-out-dir -type f -exec basename {} \; | ./sort.sh
...
EXITCODE: OK
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes just let us get more helpful feedback when the outputs fail due to a crash or something.

@shonfeder shonfeder changed the title WIP: Fix regression #1072 - parse output file not being created Fix regression #1072 - parse output file not being created Nov 4, 2021
@shonfeder shonfeder requested review from Kukovec and konnov and removed request for Kukovec November 4, 2021 01:04
Copy link
Collaborator

@konnov konnov left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for fixing this issue. It is an important feature for the integration with MBT and other tools.

Comment on lines +231 to +235
val dirName = intermediateDirPathOpt.getOrElse("")
logger.error(
s"Unable to find or create intermediate output directory ${dirName}. Intermediate output will not be written.")
false
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@konnov I've opted for logging an error rather than crashing in the event of failure. The rationale being that if you're in the middle of a long running checking session, you may not want to lose all your progress and results just because this file cannot be created for some reason.

Does that seem sensible, or should it rather raise an exception?

It just occurs to me, it would be better if we just ensure all the directories needed for the configured output exist at startup, then error out early if they don't. However, I think that reworking of the initialization of the OutputManager is probably out of scope for this PR, and should instead be included in #1069. How does that sound?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's a good compromise.

@shonfeder shonfeder merged commit b94440a into unstable Nov 4, 2021
@shonfeder shonfeder deleted the shon/fix-1072 branch November 4, 2021 10:53
@apalache-bot apalache-bot mentioned this pull request Nov 4, 2021
shonfeder pushed a commit that referenced this pull request Nov 5, 2021
Followup to #1073

That fix introduced *another* regression test, which caused the of the
parser to always go to TLA. :(
@shonfeder shonfeder mentioned this pull request Nov 5, 2021
4 tasks
shonfeder pushed a commit that referenced this pull request Nov 5, 2021
* Fix output format detection

Followup to #1073

That fix introduced *another* regression test, which caused the of the
parser to always go to TLA. :(

* Add regression test

This way if I break the output detection again, I'll know it before
merging :)
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.

[BUG] cli parse command output is written to intermediate directory but not copied to output directory
2 participants