Skip to content

Conversation

@martinus
Copy link
Contributor

@martinus martinus commented Jun 6, 2022

When running ./test/lint/lint-all.py, the script runs all tests but
also calls itself because the comparison with __file__ doesn't work.

Comparing resolved paths gives reliable comparison, and lint-all.py doesn't call itself any more

@martinus martinus changed the title test: Reliably don't start itself in lint-all.py runs all tests twice test: Reliably don't start itself (lint-all.py runs all tests twice) Jun 6, 2022
@DrahtBot DrahtBot added the Tests label Jun 6, 2022
@theStack
Copy link
Contributor

theStack commented Jun 6, 2022

Concept ACK. Good catch!

@maflcko
Copy link
Member

maflcko commented Jun 7, 2022

It doesn't run twice in CI, right? For example, looking at https://cirrus-ci.com/task/4523243527733248?logs=lint#L849 I can only find the error once.

@martinus
Copy link
Contributor Author

martinus commented Jun 7, 2022

Ah, in 06_script.sh lint-all.py is started with test/lint/lint-all.py, but I am starting it locally with ./test/lint/lint-all.py. I think the leading ./ is the difference

@laanwj
Copy link
Member

laanwj commented Jun 7, 2022

May I propose a different solution: to rename the launcher so that it doesn't match the glob. This is 100% reliable and imo more elegant.

@maflcko
Copy link
Member

maflcko commented Jun 7, 2022

Yeah, could rename to all-lint.py and then also address #24982 (comment) while touching this file?

martinus added 2 commits June 7, 2022 10:22
That way it is impossible for the script to call itself.
Removed th check against __file__ which is not necessary any more after the rename to all-lint.py.

Changed glob to find only `lint-*.py` scripts.
@martinus martinus force-pushed the 2022-06-fix-lint-all-starting-itself branch from 2f1f9e3 to f26a496 Compare June 7, 2022 08:26
@laanwj
Copy link
Member

laanwj commented Jun 7, 2022

Code review ACK f26a496

@maflcko maflcko merged commit f66633d into bitcoin:master Jun 7, 2022
@martinus martinus deleted the 2022-06-fix-lint-all-starting-itself branch June 7, 2022 08:47
Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Post-merge ACK

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 8, 2022
…uns all tests twice)

f26a496 test: clean up all-lint.py (Martin Leitner-Ankerl)
64d72c4 test: rename lint-all.py to all-lint.py (Martin Leitner-Ankerl)

Pull request description:

  When running `./test/lint/lint-all.py`, the script runs all tests but
  also calls itself because the comparison with `__file__` doesn't work.

  Comparing resolved paths gives reliable comparison, and lint-all.py doesn't call itself any more

ACKs for top commit:
  laanwj:
    Code review ACK f26a496

Tree-SHA512: b44abdd685f7b48a6a9f48e96d97138b635c31c1c7ab543cb5636b5f49690ccd56fa6fec01ae7fcc16af01a613372ee77632f70c32059919b373aa8051953791
@bitcoin bitcoin locked and limited conversation to collaborators Jun 7, 2023
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