Page MenuHomePhabricator

[qa] Make src_dir handling more robust
AbandonedPublic

Authored by schancel on Nov 30 2018, 03:09.

Details

Reviewers
deadalnix
jasonbcox
Group Reviewers
Restricted Project
Summary

Currently, the get_srcdir() function in cdefs.py tries to find the source directory by walking up the path from it's main module. However, this may not necessarily be located where the src directory actually is depending on how it is ran and imported. However, it also checks the SRC_DIR environment variable. This commit ensures this environment variable is always set based on the config, or an override environment variable. This way cdefs.py can always find the sources files it requires.

Test Plan
./test/functional/test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Passed
SeverityLocationCodeMessage
Auto-Fixtest/functional/test_runner.py:1CFMTCode style violation
Unit
No Test Coverage
Build Status
Buildable 4182
Build 6430: Bitcoin ABC Buildbot (legacy)
Build 6429: arc lint + arc unit

Event Timeline

jasonbcox requested changes to this revision.Nov 30 2018, 22:05
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
test/functional/test_runner.py
143

If src_dir already has a value from above, I think this check should fail with an error saying src_dir is defined twice

This revision now requires changes to proceed.Nov 30 2018, 22:05
schancel requested review of this revision.Dec 1 2018, 16:31
schancel marked an inline comment as done.
schancel added inline comments.
test/functional/test_runner.py
143

src_dir will always be defined by the config setup by ./configure

deadalnix requested changes to this revision.Dec 2 2018, 23:11

I have no idea what problem this diff solves.

This revision now requires changes to proceed.Dec 2 2018, 23:11
schancel requested review of this revision.Dec 5 2018, 05:28
schancel edited the summary of this revision. (Show Details)
deadalnix requested changes to this revision.Dec 30 2018, 18:40
deadalnix added inline comments.
test/functional/test_runner.py
143

Do we have a reason to think that ./configure may sometime be wrong ?

This revision now requires changes to proceed.Dec 30 2018, 18:40
test/functional/test_runner.py
143

I don't, but this is fixing incongruent behavior between get_srcdir() and the main script here. As for the environment variable, depending on how the tests are ran, get_scrdir() make not be able to find the srcdir. It's not particularly nice, but setting the environment variable is a fix.