-
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
tests/libc_newlib: add test for newlib-nano inclusion #9599
tests/libc_newlib: add test for newlib-nano inclusion #9599
Conversation
d2cd568
to
a23078e
Compare
Do we really need to run tests on this PR everytime ;-)? |
I was still getting a |
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.
Good. I can pass the test, but I can't fail it (Arch linux).
About | ||
===== | ||
|
||
Terifies if newlib/newlib-nano is correctly included by the build system |
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.
Can you include instructions on how to force a failure of this test? Then people can test the 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.
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.
Tested both tests and it failed as expected.
tests/libc_newlib/main.c
Outdated
#ifdef MODULE_NEWLIB | ||
#ifdef MODULE_NEWLIB_NANO | ||
/* Nano maps iprintf to printf */ | ||
TEST_ASSERT(iprintf == printf); |
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.
This can be tested by binutils, so there's no need to run the application.
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 will try something for this.
My test results (
|
Open question: How can we make it so that we force the user to run the test? |
I added a test in the Makefile. Currently not documented but I should move the documentation out of |
I also tested wih |
I split the @jcarrano Tell me if you like the new tests. I will update the documentation after @miri64 I now think it should be included before #9398, I thought it would be all fixed faster. |
tests/libc_newlib/Makefile
Outdated
endif | ||
endif | ||
|
||
test-newlib: $(ELFFILE) |
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.
A dumber approach without sed (checks the number of different addresses)
# make N_PRINTFS = 2 if non-nano, 1 if nano
test-newlib: $(ELFFILE)
PRINTFS=$$($(NM) -v $^ | grep '\( i\?printf\)'); \
PRINTF_ADDRS=$$(echo "$${PRINTFS}" | cut -d' ' -f 1 | uniq | wc -l); \
# ensure both symbols are there
if test $$(echo "$${PRINTFS}" | wc -l) = 2 ; then \
echo "[FAILED] Expected printf and iprintf to be present, found $${PRINTFS}" ; \
exit 1; \
elif test $${PRINTF_ADDRS} != $(N_PRINTFS) ; then \
echo "[FAILED] Expected $(N_PRINTFS) different printfs"; \
exit 1; \
fi
BTW, could we define a standard set of shell functions to be included in all makefiles. I would like to have a 'die' function:
die() {
echo "${1}" >&2
exit 1
}
# one-line "do stuff and exit with error if it fails"
test -e fileXX.txt || die "file not found"
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.
Using more sub commands, and not simpler for me to understand as it uses two concepts, number of printfs + addresses instead of just comparing addresses.
sed
is standard enough and is working properly.
Adding common functions makefile would be a different PR with its own problem.
Also for me echo; exit
can be understood in one blink and not complex enough that I would like it replaced by another function that I would need to check. Also it can be done with oneliner as
test -e fileXX.txt || { echo "file not found"; exit 1};
207e634
to
3e29c10
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.
Good. We need another PR to make this test compulsory.
This test verifies that when used, newlib-nano is correctly included, both header and also linked.
0a7f6a1
to
db00922
Compare
Reminder, for backporting I would also need to add the |
Backport provided in #9633 |
Contribution description
This test verifies that when used, newlib-nano is correctly included, both
header and also linked.
This is a standalone test and is less invasive than doing a global test like what I tried in #9512
I want to use it to debug non handled developers computers.
Testing
I tested the following setups:
Issues/PRs references
#9512
This should not be merged before #9398 as currently llvm is not handled properly but it should not block adding tests in murdock.I now think it should be included before #9398, I thought it would be all fixed faster.
I already have a fix for the llvm/clang issue #9513