-
Notifications
You must be signed in to change notification settings - Fork 2k
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
makefile/utils: Add a function for checking that a string is not empty. #10439
Conversation
c46a682
to
7f9018f
Compare
I will add a test so that it is run in murdock. |
I added a test and updated the behavior of your test to verify the returned value of It can be tested by replacing, in the Makefile, the tested target by the other: On the naming, I would prefer having the directory named |
683d0ea
to
11cd49d
Compare
I renamed it to |
Nice catch on the typo in the error message. Codacy wants one line less in the README… you can inline fix it directly. I re-ran the tests and verified that they also detected the errors by tweaking the test |
11cd49d
to
f4153d2
Compare
Done. Stupid codacy. |
f4153d2
to
9d252a8
Compare
A call to `$(ensure_value x,y)` will fail with message y if x is empty, and otherwise return x. This can be useto write more compact makefiles, while still producing friendly error messages.
make -f test-checks.mk test-ensure_value should succeed, while make -f test-checks.mk test-ensure_value-negative should fail.
This will allow testing the build system 'utils' functions.
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.
Agreed with the implementation and tested too.
Contribution description
A call to
$(call ensure_value,x,y)
will fail with message y if x is empty, and otherwise return x. This can be useto write more compact makefiles, while still producing friendly error messages.Testing procedure
I should provide an automated test for this, in the meantime:
Issues/PRs references
Split from #10342.