-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix various issues in the test makefiles #1032
Conversation
torarnv
commented
Apr 7, 2015
- Fix broken glob dependency from test bin targets
- Ensure sharness test (clean, build, test, aggregate) is run sequentially
- Ensure we don't remake binaries due to missing IPFS-BUILD-OPTIONS
|
||
test_sharness_short: | ||
cd test/sharness/ && make | ||
test_sharness_expensive: SHARNESS_MAKE_FLAGS += TEST_EXPENSIVE=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i prefer explicitness in these targets. adding flags like that is errorprone in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me, not married to 7acee02 and 086f038, those were just drive-by changes on the way to the other two. Personally I think duplicated code is more error prone, as things are changed one place but missed in another, and as a new contributor to a project I find logic easier to understand when I don't have to scan 4 instances of it to see if there's any difference in them.
@@ -14,6 +14,9 @@ IPFS_ROOT = ../.. | |||
# User might want to override those on the command line | |||
GOFLAGS = | |||
|
|||
# The targets in this makefile depend on being run sequentially | |||
.NOTPARALLEL: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 i would love to move towards being able to run them in parallel. wonder what git does + how it would manage the sharness output. cc @chriscool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may get away with adding explicit deps in the makefile. I wasn't sure if the tests themselves could be run in parallell. The main problem that spawned this is that with make -j4
eg, the tests will start running before the clean and the deps targets have been run, which resulted in the missing ipfs binary error. Let me try that real quick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To run tests in parallel I think we need something like:
all:
make clean
make deps
make $(T)
make aggregate
and then use make -j 4
for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b8bc885 adds the proper deps. I'm sure if the tests actually support the parallelism, so .NOTPARALLEL:
should possibly be added either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jbenet about Git I had a look and yeah some work has been done a long time ago so that the tests can run in parallel (see git/git@abc5d37).
And there are always some flags or options or other stuff in the IPFS-BUILD-OPTIONS like files, so that there is no problem with empty files.
copying comments from the commit:
|
i dont feel strongly about most comments above. only the rebuilds. let's hear @chriscool's opinions? |
Also, good find on both the parallel and gnu make bugs. |
Actually, as long as
I'll fix that in a separate commit. |
ffc37de
to
80271a9
Compare
Okey, ready for review now, removed the subjective refactoring and focused on fixing the issues. |
If the file doesn't exist, make will conclude that the missing prerequisite should trigger a rebuild of the binaries.
Running make -jN would result in the tests starting to execute before the tests binaries were built, resulting in the error: "Cannot find the tests' local ipfs tool" Each test now depends on the deps. They also depend on a new target for cleaning the test results, so that the tests can write new clean results. The aggregate target also needs to depend on the same test results clean target, as well as the tests themselves, so that the aggregation happens when all tests have finished running. By introducing a separate target for cleaning test results we also ensure that we don't end up removing and rebuilding the binary on each test run. The result is that the tests *can* be run with with -jN > 1, but individual tests may still not supports this, so to get stable test results it's still recommended to run them in sequence.
GNU Make's wildcard function does not recurse into subdirectories when passed the '**' glob, which results in adding a dependency only to .go files in the first level of subdirectories under the source root. We shell out to 'find' instead, which catches all .go files in the given directory.
7358b82
to
f2dd060
Compare
Ok, it LGTM, thanks @torarnv ! |
Thanks! Happy to help! 😄 |
Thanks @torarnv ! |
Fix various issues in the test makefiles