Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Mar 18, 2020

Alternative to #18374, fixing the incorrect padding added sometimes in bn2vch.

Since we're using Python 3.2+, a much simpler implementation of bn2vch is possible using int.to_bytes.

This also adds a "functional" test for bn2vch, in a new "framework_test_script.py", where the "framework_test_" prefix is intended for tests of the framework itself.

@fanquake fanquake added the Tests label Mar 18, 2020
@maflcko maflcko requested a review from jnewbery March 18, 2020 18:35
@sipa sipa force-pushed the 202003_simple_bn2vch branch 2 times, most recently from c3e08bf to 57d1428 Compare March 18, 2020 19:51
@sipa sipa force-pushed the 202003_simple_bn2vch branch from 57d1428 to a733ad5 Compare March 18, 2020 20:54
@jnewbery
Copy link
Contributor

Concept ACK. The code was broken here: f950ec2#diff-fb7bd6a727cfb726928c6f68fa8b3a80R20.

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

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

Tested ACK a733ad5.

I cherry-picked just the test onto:

  • master before #17319: test passes
  • master after #17319: test fails
  • this PR: test passes

Longer term, I think it'd be nicer if the tests for the test framework were unit tests within those files, because it doesn't make much sense to me to have them as subclasses of the TestFramework object, and because it's nice to have the test code next to the code it's testing. However, that's something that could be done separately.

@practicalswift
Copy link
Contributor

Concept ACK

@sipa
Copy link
Member Author

sipa commented Mar 18, 2020

@jnewbery Yeah, that's pretty ugly. Happy to take any concrete suggestions (in this PR or later).

@jnewbery
Copy link
Contributor

Happy to take any concrete suggestions (in this PR or later).

Let's do it in a follow-up.

@laanwj
Copy link
Member

laanwj commented Mar 19, 2020

nice, ACK a733ad5

@laanwj laanwj merged commit 67de1ee into bitcoin:master Mar 19, 2020
maflcko pushed a commit that referenced this pull request Apr 30, 2020
de8905a test: use unittest and test_runner for test framework unit testing (Gloria Zhao)

Pull request description:

  Proposal for unit testing on test_framework functions:
  1. Use the python `unittest` library. Don't use test_framework to test itself.
  2. Put the tests inside the same file as the functions they are testing.
  3. Call the tests from `test_runner.py`. To include more Test Framework tests, add the filename to the list `TEST_FRAMEWORK_MODULES`. Don't add new files or change the list of accepted script prefixes.

  Makes these changes for `bn2vch` (followup to [this comment](#18378 (review))).

ACKs for top commit:
  jnewbery:
    Tested ACK de8905a. Great stuff gzhao408 . Thanks for this!

Tree-SHA512: 91572d43e203a1864765b93a9472667994115ec38b271f2b2f9fcd0f0112b393fc24ba7d2371d5a34b0a6a4522f6b934fc5164363819aa7ed8d6c6c9a60cc101
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 2, 2020
de8905a test: use unittest and test_runner for test framework unit testing (Gloria Zhao)

Pull request description:

  Proposal for unit testing on test_framework functions:
  1. Use the python `unittest` library. Don't use test_framework to test itself.
  2. Put the tests inside the same file as the functions they are testing.
  3. Call the tests from `test_runner.py`. To include more Test Framework tests, add the filename to the list `TEST_FRAMEWORK_MODULES`. Don't add new files or change the list of accepted script prefixes.

  Makes these changes for `bn2vch` (followup to [this comment](bitcoin#18378 (review))).

ACKs for top commit:
  jnewbery:
    Tested ACK de8905a. Great stuff gzhao408 . Thanks for this!

Tree-SHA512: 91572d43e203a1864765b93a9472667994115ec38b271f2b2f9fcd0f0112b393fc24ba7d2371d5a34b0a6a4522f6b934fc5164363819aa7ed8d6c6c9a60cc101
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 9, 2021
Summary:
Add a new test for a helper function in the test framework (added in D8852)
Introduce a new prefix for functional tests: `framework_test`

This concludes backport of Core [[bitcoin/bitcoin#18378 | PR18378]]
bitcoin/bitcoin@a733ad5

Depends on D8852

Test Plan: `test/functional/test_runner.py framework_test_script`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D8855
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants