Skip to content

Conversation

suhailsaqan
Copy link
Contributor

@suhailsaqan suhailsaqan commented May 30, 2022

Added a functional test which parses all the RPC help commands then automatically generates the bitcoin-cli bash-completion file and makes sure that the original file matches the newly generated one.

In order to get the RPC help commands in the correct format needed for the test, I added the "format" RPC command.

Test using python3 test/functional/tool_cli_completion.py --overwrite

@fanquake
Copy link
Member

Thanks for picking this up. Did you re-use any code from #18606? A lot of the changes are very similar to the changes there, except for different whitespace, class names, copyright dates etc. If so, cherry-picking so that the original author is preserved is appropriate.

@laanwj
Copy link
Member

laanwj commented May 30, 2022

Concept ACK on auto-generating what can be auto-generated.

I'm not entirely sure about the approach of making this a functional test. It's clever, but also different from how other auto-generated files (the manual pages, the example bitcoin.conf introduced in #22235) are handled in the release process.

On the other hand by adding the check this forces the file on the branch to always be up-to-date so it doesn't need to be in the release process. That's also something.

@suhailsaqan suhailsaqan force-pushed the bash-completion branch 2 times, most recently from d79fe4a to 784c4e5 Compare May 30, 2022 13:38
@suhailsaqan
Copy link
Contributor Author

Concept ACK on auto-generating what can be auto-generated.

I'm not entirely sure about the approach of making this a functional test. It's clever, but also different from how other auto-generated files (the manual pages, the example bitcoin.conf introduced in #22235) are handled in the release process.

On the other hand by adding the check this forces the file on the branch to always be up-to-date so it doesn't need to be in the release process. That's also something.

Look at #17289 (comment)

@maflcko
Copy link
Member

maflcko commented May 30, 2022

Yeah, I wrote that comment before bitcoin.conf moved over to auto-generation. A functional test is one way to achieve this, but this can also be achieved by an auto-generation script at release time.

@laanwj
Copy link
Member

laanwj commented May 30, 2022

I mean you can argue this is a better solution, and that we should move to this for all three.
(but for the manual pages it's difficult as they contain a version number as well as the current month)

@brunoerg
Copy link
Contributor

From linter:

File "test/functional/tool_cli_completion.py" contains a shebang line, but has the file permission 644 instead of the expected executable permission 755. Do "chmod 755 test/functional/tool_cli_completion.py"

@suhailsaqan
Copy link
Contributor Author

I mean you can argue this is a better solution, and that we should move to this for all three. (but for the manual pages it's difficult as they contain a version number as well as the current month)

Thanks for the review @laanwj! Just wondering, do the three of them have to be done the same way? I don't know how I would do it the same way it was done in #22235.

@suhailsaqan suhailsaqan force-pushed the bash-completion branch 3 times, most recently from c97d573 to a8e6ab5 Compare June 3, 2022 05:01
@suhailsaqan
Copy link
Contributor Author

Squashed commits.

@suhailsaqan suhailsaqan force-pushed the bash-completion branch 2 times, most recently from f9d7f57 to 5f3ba0e Compare June 3, 2022 07:00
@laanwj
Copy link
Member

laanwj commented Jun 7, 2022

do the three of them have to be done the same way?

Not necessarily, but some structure/standardization around release processes makes it harder to forget any steps, than if everything needs to be done in a different way.

@luke-jr
Copy link
Member

luke-jr commented Jun 18, 2022

On the other hand by adding the check this forces the file on the branch to always be up-to-date so it doesn't need to be in the release process. That's also something.

If we're not careful, it could also increase the rate of diff conflicts (and/or silent merge bugs?).

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 21, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK laanwj

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #27788 (rpc: Be able to access RPC parameters by name by achow101)
  • #27432 (contrib: add tool to convert compact-serialized UTXO set to SQLite database by theStack)
  • #26485 (RPC: Accept options as named-only parameters by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Contributor

@hernanmarino hernanmarino left a comment

Choose a reason for hiding this comment

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

Hi everyone, I have a questions / suggestion:
I believe the object of this issue was to keep the bash files up to date, but this PR only adds a test to check for the file, or optionally update it. Is there something that can be done to make sure that the file is updated or generated on every compile, perhaps by modifying the Makefile to run this test everytime? In that case, I believe that the "--overwrite" option should be the default.

@achow101 achow101 closed this Oct 12, 2022
@achow101 achow101 reopened this Oct 12, 2022
@achow101
Copy link
Member

Closed and reopened to hopefully trigger CI

@suhailsaqan
Copy link
Contributor Author

@achow101 Any idea why CI is not running on this PR?

@fanquake
Copy link
Member

achow101 Any idea why CI is not running on this PR?

Rebasing may help. While you are at it, you can also squash your commits.

@maflcko
Copy link
Member

maflcko commented Oct 13, 2022

Triggered CI

pierrenn and others added 3 commits February 18, 2023 11:18
Add a functional test which parses available RPC commands, generates
the associated bitcoin-cli autocomplete file and checks that the current
autocomplete file matches.
An outdated autocomplete file can be updated via the --overwrite test
parameter.

test: keeps bitcoin-cli autocomplete in sync

Add a functional test which parses available RPC commands, generates
the associated bitcoin-cli autocomplete file and checks that the current
autocomplete file matches.
An outdated autocomplete file can be updated via the --overwrite test
parameter.

rpc: add format command with support for args_cli

- add format command to get infos about commands via a particular format
- add output format args_cli to get arguments type info of shown commands
- refactor RPCArg::ToTypeString to be used accross multiple output formats
- overload CRPCTable::execute to call != methods than in their request
test: keeps bitcoin-cli autocomplete in sync

fixed linter error

added bash-completion to makefile

fixed typo

autogenerate bash completion

autogenerate bash completion

added tool_bash_completion.py to test_runner.py

added format RPC

fixed typo

added python functional test

test: keeps bitcoin-cli autocomplete in sync

Add a functional test which parses available RPC commands, generates
the associated bitcoin-cli autocomplete file and checks that the current
autocomplete file matches.
An outdated autocomplete file can be updated via the --overwrite test
parameter.

rpc: add format command with support for args_cli

- add format command to get infos about commands via a particular format
- add output format args_cli to get arguments type info of shown commands
- refactor RPCArg::ToTypeString to be used accross multiple output formats
- overload CRPCTable::execute to call != methods than in their request

removed duplicates

removed unnecessary change
@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 1, 2023

🐙 This pull request conflicts with the target branch and needs rebase.

@DrahtBot
Copy link
Contributor

There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

@achow101
Copy link
Member

Are you still working on this?

@DrahtBot
Copy link
Contributor

There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

@maflcko maflcko closed this Dec 22, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Dec 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

contrib: Autogenerate bash completion
10 participants