-
Notifications
You must be signed in to change notification settings - Fork 379
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
Pin the number of jobs in some Make targets #3640
Conversation
Makefile
Outdated
PIP_DEV_DEPS_CMD = $(MAKE) -C $(CC_ANALYZER) -j1 pip_dev_deps && \ | ||
$(MAKE) -C $(CC_WEB) -j1 pip_dev_deps && \ |
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.
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 think I tried this, but let me try again.
analyzer/tests/Makefile
Outdated
@@ -66,7 +66,7 @@ test_functional_in_env: venv_dev | |||
$(ACTIVATE_DEV_VENV) && $(FUNCTIONAL_TEST_CMD) | |||
|
|||
test_build_logger: | |||
$(MAKE) -C tools/build-logger test | |||
$(MAKE) -C tools/build-logger -j1 test |
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.
The problem with the test
target is that it depends on the all
target:
test: all pycodestyle pylint test_unit |
And what all
target will do is to build the package:
all: ldlogger ldlogger_32.so ldlogger_64.so pack32bit pack64bit |
This is why your make command failes and gives you an error when you run it on multiple threads.
Can't we remove this dependency from the test
target and assume you already built a package from ldlogger? That would solve the race condition.
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.
Possible, but why should we assume it's already done?
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.
If we do not assume that and if you run the for example the all
target with multiple threads it is not guaranteed that the dependencies will be run in the correct order. For example the all
target depends on the pack32bit
target:
pack32bit: 32bit packbin |
This target depends on two other targets: 32bit
and packbin
. The order is important here because the packbin
target will assume that 32bit
already run. If you run it with multiple threads this is not guaranteed.
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.
These should not depend on the order. If that's the case then packbin
should explicitly depend on 32bit
.
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.
Anyway, I updated the patch to simply omit the all
target from the test
target deps.
2a14888
to
2da8ddc
Compare
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.
The test cases related to analyzer tools are failing. With your changes now you have to build a package from ldlogger before running the test cases:
codechecker/.github/workflows/test.yml
Lines 42 to 46 in f11eb1a
- name: Run build-logger tests | |
working-directory: analyzer/tools/build-logger | |
run: | | |
pip install -r requirements_py/dev/requirements.txt | |
make test |
I think that would solve the problem.
If someone runs `make -j16 test_unit test_analyzer test_web_sqlite`, then the command would spuriously fail due to a filesystem race-condition. The `cp ldlogger build/bin` would basically try to copy a not-yet-existing file, causing a failure immediately, or later in the test pipeline, when it exercises the logger. Causing an error similar to this: ``` make[1]: Leaving directory `codechecker/analyzer' make: *** [test_analyzer] Error 2 make: *** Waiting for unfinished jobs.... ``` Let's work around the issue by omitting the `all` target from the `test*` targets. This way if it's already built, tests should just pass.
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.
LGTM!
If someone runs
make -j16 test_unit test_analyzer test_web_sqlite
,then the command would spuriously fail due to a filesystem race-condition.
The
cp ldlogger build/bin
would basically try to copy a not-yet-existing file,causing a failure immediately, or later in the test pipeline, when it
exercises the logger. Causing an error similar to this:
Let's work around the issue by omitting the
all
target from thetest*
targets.This way if it's already built, tests should just pass.