Skip to content

Conversation

@ken2812221
Copy link
Contributor

@ken2812221 ken2812221 commented Aug 20, 2018

This PR do the following things:

  • Make functional tests compatible with Windows
  • Print color output in functional tests for Windows 10
  • Run util and functional tests on appveyor
  • Do not run symlink tests on Windows

Note:

  • The wallet_multiwallet.py fail is unrelated to the test framework, it's a bug related to c++ code or maybe dependencies. bitcoind would exit with 0xC0000005(Access violation) during shutdown occasionally. Disable this for now.
  • Not using --failfast because this is still in experimental. We should track if there is any other error.
  • Disable ZMQ tests because the python zmq library could cause access violation sometimes.
  • Disable feature_notifications because Bitcoin Core handles the command in different thread, whicha can cause a race condition.

@fanquake fanquake added the Tests label Aug 20, 2018
@maflcko
Copy link
Member

maflcko commented Aug 22, 2018

I think there is some interference with a firewall or something that kills the bitcoind processes?

appveyor.yml Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Could as a first step only run the util tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean to drop away functional tests and replace it with util tests from this PR, and re-add the funfctional tests in another PR?

@ken2812221
Copy link
Contributor Author

It is really hard to see blue color on powershell, so change the color to green
image

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 23, 2018

Note to reviewers: This pull request conflicts with the following ones:

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.

@ken2812221
Copy link
Contributor Author

I think there is some interference with a firewall or something that kills the bitcoind processes?

I agree with you, they are all passed on my Windows PC.

@maflcko
Copy link
Member

maflcko commented Aug 23, 2018

They didn't pass for me on Windows 7

@ken2812221
Copy link
Contributor Author

Oh, it's occasionally. I tested to run it 10 times, 8 times failed, 2 times succeed.

@ken2812221 ken2812221 changed the title [WIP] appveyor: Run functional test on appveyor appveyor: Run functional test on appveyor Aug 25, 2018
@ken2812221
Copy link
Contributor Author

ken2812221 commented Aug 25, 2018

This is ready for review, the wallet_multiwallet.py fail is unrelated to the test framework. It is a bug related to c++ code, it would exit with 0xC0000005(Acccess violation) during shutdown occasionally.

Copy link
Member

Choose a reason for hiding this comment

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

Why is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The binary built by MSVC is not at src/, so it needs a variable to indicate the binary location.

appveyor.yml Outdated
Copy link
Member

Choose a reason for hiding this comment

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

I think this caching fix can be submitted in an independent pr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fine

@ken2812221 ken2812221 changed the title appveyor: Run functional test on appveyor tests: Run functional test on Windows Aug 27, 2018
@ken2812221
Copy link
Contributor Author

ken2812221 commented Aug 27, 2018

I think we could disable those problematic tests for now.

@ken2812221
Copy link
Contributor Author

I think there is some interference with a firewall or something that kills the bitcoind processes?

Solve this problem by using new connection every time we call RPC. Not sure why would that happen.

@maflcko
Copy link
Member

maflcko commented Aug 27, 2018

What happened to the cache fix? I think we are not yet properly caching the intermediate compile results?

@ken2812221
Copy link
Contributor Author

@MarcoFalke I add the build cache in #14086

@ken2812221
Copy link
Contributor Author

ken2812221 commented Aug 29, 2018

Update: Based on #14086, following #14092

@ken2812221
Copy link
Contributor Author

#14086 has been merged, this is ready for review.

@ken2812221 ken2812221 changed the title tests: Run functional test on Windows tests: Run functional test on Windows and enable it on Appveyor Sep 5, 2018
Copy link
Member

Choose a reason for hiding this comment

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

I think this check can be removed. Color is off by default and if someone specifies color, they have a reason to do so (maybe write to a file that is read on a different os/platform)

Copy link
Member

Choose a reason for hiding this comment

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

I think this is no longer supported? So could remove the named arg "connection"?

Copy link
Member

@maflcko maflcko Sep 5, 2018

Choose a reason for hiding this comment

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

Could move this into a method def _set_conn(self): to avoid duplication?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, any rationale for this? I'd prefer to throw if the log was not unicode.

Copy link
Contributor Author

@ken2812221 ken2812221 Sep 5, 2018

Choose a reason for hiding this comment

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

an error message thrown by boost is always localized(translated) and use ANSI encoding, so it would always throw an error. I don't know any solution to fix this. There is no way to specify the error message format.

For now, I could revert this because appveyor is using English, but it would cause problem if the user is running a non-English Windows. It can be marked as an issue with #13869.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in #14192

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to keep the throw on non-unicode log files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above.

appveyor.yml Outdated
Copy link
Contributor Author

@ken2812221 ken2812221 Sep 7, 2018

Choose a reason for hiding this comment

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

I want to avoid re-uploading cache files if there is no change in #14086, I chose to delete the stats file entirely. But that was a mistake, it would also clear the cache size information which extremely increase cache size.

After then, I realize that clcache has a command to clear hit and miss info but retain size info: clcache -z

See: https://github.com/frerich/clcache/blob/master/README.asciidoc#options

@ken2812221
Copy link
Contributor Author

@NicolasDorier @sipsorcery Would you mind reviewing this?

@sipsorcery
Copy link
Contributor

tACK 1223343

@NicolasDorier
Copy link
Contributor

NicolasDorier commented Sep 10, 2018

ran several time, do not pass. Though it is not blocking for me, can as well reactivate the test once the fix is done later down the road.

tACK 529c5274de6fae782154c2845b6a691db46b0d4e

@ken2812221
Copy link
Contributor Author

Thanks for your review 👍

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, this env var is not documented and makes the code a bit harder to read. Would it be too ugly to call mkdir src && mv ./bitcoin*.exe ./src in the appveyor after compile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about now?

@maflcko
Copy link
Member

maflcko commented Sep 12, 2018

Thanks, re-ACK

@ken2812221
Copy link
Contributor Author

@jnewbery Would you mind reviewing the test changes here. Most of code that changed in this PR are previously written by you.

@jnewbery
Copy link
Contributor

Sure, I can review the tests: Make it possible to run functional tests on Windows commit, but it probably won't be until next week.

Copy link
Member

Choose a reason for hiding this comment

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

if you have to use ctypes directly here, with magic numbers, can you please at least add a comment about what the numbers here mean, what it is doing

Copy link
Member

@laanwj laanwj Sep 13, 2018

Choose a reason for hiding this comment

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

I guess this is meant as a temporary work-around until we find out why? (might want to add a comment in that regard) being able to re-use RPC connections is a big deal, it's not something we should simply accept as-is.

@laanwj
Copy link
Member

laanwj commented Sep 13, 2018

utACK d5678479266bb087b37ee503000ab161d9e44664

@ken2812221
Copy link
Contributor Author

ken2812221 commented Sep 16, 2018

Update: Disabled 1 additional tests for now because of #14225 merged.

@ken2812221
Copy link
Contributor Author

ken2812221 commented Sep 17, 2018

@MarcoFalke connection is still used in mining_getblocktemplate_longpoll.py. Please re-review.

@maflcko
Copy link
Member

maflcko commented Sep 17, 2018

utACK 661ac15

@maflcko maflcko merged commit 661ac15 into bitcoin:master Sep 24, 2018
maflcko pushed a commit that referenced this pull request Sep 24, 2018
…Appveyor

661ac15 appveyor: Run functional tests on appveyor (Chun Kuan Lee)
2148c36 tests: Make it possible to run functional tests on Windows (Chun Kuan Lee)

Pull request description:

  This PR do the following things:
  - Make functional tests compatible with Windows
  - Print color output in functional tests for Windows 10
  - Run util and functional tests on appveyor
  - Do not run symlink tests on Windows

  Note:
  - The wallet_multiwallet.py fail is unrelated to the test framework, it's a bug related to c++ code or maybe dependencies. `bitcoind` would exit with 0xC0000005(Access violation) during shutdown occasionally. Disable this for now.
  - Not using `--failfast` because this is still in experimental. We should track if there is any other error.
  - Disable ZMQ tests because the python zmq library could cause access violation sometimes.
  - Disable `feature_notifications` because Bitcoin Core handles the command in different thread, whicha can cause a race condition.

Tree-SHA512: b76db137d264e62a5c130e1cbca7a2ca002a7a0f4153fa0b92c1ea6c9c09ef0533e11c49bdbd566c472d8ff59f245758feb5e5a6ec6cb6bb66a1c67bab5fa48a
@ken2812221 ken2812221 deleted the patch-2 branch September 24, 2018 20:46
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. I think there's one change that needs to be reverted. @ken2812221 - can you take a look for me?

# Remove the test cases that the user has explicitly asked to exclude.
if args.exclude:
exclude_tests = [re.sub("\.py$", "", test) + ".py" for test in args.exclude.split(',')]
exclude_tests = [re.sub("\.py$", "", test) + (".py" if ".py" not in test else "") for test in args.exclude.split(',')]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this change. The point of:

[re.sub("\.py$", "", test) + ".py"

is that if <test_name>.py or <test_name> is given, then it's normalized to <test_name>.py.

Your new version:

re.sub("\.py$", "", test) + (".py" if ".py" not in test else "")

essentially toggles, so <test_name>.py is changed to <test_name> and <test_name> is changed to <test_name>.py.

>>> test1 = 'test_name1.py'
>>> test2 = 'test_name2'
>>> for test in [test1,test2]:
...     print(re.sub("\.py$", "", test) + ".py") # original version
... 
test_name1.py
test_name2.py
>>> for test in [test1,test2]:
...     print(re.sub("\.py$", "", test) + (".py" if ".py" not in test else "")) # new version
... 
test_name1
test_name2.py

This breaks using -exclude=<test_name>.py

Copy link
Member

Choose a reason for hiding this comment

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

The goal was to be able to specify --exclude "feature_notifications,wallet_multiwallet,wallet_multiwallet.py --usecli".

I think removing everything from the test_list that .startswith(item.split('.py')[0]) for any item in args.exclude.split(',') should solve all issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I didn't test that case. Should be fixed in #14316

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Sep 27, 2018
…ers in `--exclude` list

c7b3e48 tests: exclude all tests with difference parameters (Chun Kuan Lee)

Pull request description:

  Fix broken exclusion list in functional tests. See bitcoin#14007 (review)

Tree-SHA512: b6c2b86fef13e3c00c695adaeeb3e47ee9b48877c71bc605d24201ce931b2ef3ae9f5f199071fa1ec5de2d7aadc478410094c380cc297922e683e9b2569cda03
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 6, 2020
Summary:
Backport of core [[bitcoin/bitcoin#14007 | PR14007]].

Depends on D5958.

Test Plan:
  ninja check-functional
The output should be all green. Not blue.

Build for windows, then:
 - Install python if needed and add it to your path
 - If you copy the project to some place, you need at least the `src`,
`test`, `share` and your build directories.
 - Copy the test_runner.py to the build directory to replace the symlink
 - Update the config.ini file to match you paths
Then in a powershell:
  $env:PYTHONIOENCODING="utf-8"
  python .\test\functional\test_runner.py --force
Most of the tests should pass, but still far from all. More backports
coming.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D5964
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
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.

8 participants