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

Update tntc manual with run and test #342

Merged
merged 4 commits into from
Nov 24, 2022
Merged

Update tntc manual with run and test #342

merged 4 commits into from
Nov 24, 2022

Conversation

konnov
Copy link
Contributor

@konnov konnov commented Nov 10, 2022

This PR introduces two future commands in the tntc manual:

  • run to perform a randomized execution of a TNT spec, and
  • test to run unit tests in a TNT spec.

@konnov konnov requested review from bugarela and shonfeder November 10, 2022 16:07
tntc typecheck [--out=<out>.json] <spec>.tnt
```

This command infers types in the TNT specification, which is provided in the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently the typecheck command also infers effects. I think it makes sense to have type and effect checking at the same command, but I couldn't think of a good name for it, so I just kept typecheck until we get to review it, which I think it's right now. Any ideas on how to improve this? @konnov @shonfeder

Copy link
Contributor Author

@konnov konnov Nov 24, 2022

Choose a reason for hiding this comment

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

I would keep it typecheck. At some point, we were even thinking of integrating effects in the type system. So from the user's perspective, this distinction between types and effects is probably too fine-grained. We should probably even replace parse and typecheck with something like compile, so all stages are done at once and the output is saved in a file. Then we can introduce options to skip some of the stages. This is what compilers normally do. Even Python is producing a bytecode file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Factored out into a separate issue: #359

Copy link
Collaborator

@bugarela bugarela left a comment

Choose a reason for hiding this comment

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

LGTM. Some suggestions inline


*This command is not implemented yet.*

```sh
tntc exec [--seed=<seed>] [--length=<len>] \
[--timeout=sec] [--check=prop] [--out=<out>.json] <spec>.tnt
tntc run [--seed=<seed>] [--timeout=sec] [--out=<out>.json] <spec>.tnt <name>
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about calling these runnable definitions tasks? Ruby has something like this with rakes, where makefile-like tasks are defined in ruby instead of a new/different language. We could use the qualifier task for the runnable definitions in TNT syntax.

Suggested change
tntc run [--seed=<seed>] [--timeout=sec] [--out=<out>.json] <spec>.tnt <name>
tntc run [--seed=<seed>] [--timeout=sec] [--out=<out>.json] <spec>.tnt <task>

Copy link
Collaborator

Choose a reason for hiding this comment

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

After the standup discussion, I realize runs are actually a different thing than tasks. I believe we should have the essential definition of the command with the run (i.e. the length parameter), and leave only low-level configs to the task (that is, things that are not relevant to a person reading the specification).

Elaborating a bit on the tasks: I already had some thoughts on this when planning the VSCode plugin (see this discussion entry). I believe we should have a format to define the commands for TNT that can:

  1. Be automatically identified as VSCode tasks as I suggested in the discussion
  2. Be run with something like tntc task for all tasks or tntc task <group> for specific groups (i.e. heavy checks, sanity checks, unit tests).
  3. Be used in CI. For instance, npm commands/scrips are used in CI instead of calling executables such as mocha directly. TNT should mimic this by having a very simple standard CI config that calls tntc task test, as opposed to specifying apalache commands and flags in the CI file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea! Here is a follow-up issue on that: #360

```

This command produces a random execution of a TNT specification,
whose name is given with `<spec>.tnt`.
whose name is given with `<spec>.tnt`. The random execution should follow
the run structure that is given in the definition called `<name>`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
the run structure that is given in the definition called `<name>`.
the run structure that is given in the task definition called `<task>`.

@konnov konnov enabled auto-merge (squash) November 24, 2022 11:13
@konnov konnov merged commit b185768 into main Nov 24, 2022
@konnov konnov deleted the igor/run312 branch November 24, 2022 11:16
@konnov konnov self-assigned this Nov 28, 2022
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.

2 participants