Skip to content
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

configure: fix flags for unit tests #110

Merged
merged 1 commit into from Jul 16, 2018

Conversation

jajanusz
Copy link
Contributor

@jajanusz jajanusz commented Jul 16, 2018

-nostdlib breaks UT because cmoka need stdlib
At all "-nostdlib" was only flag that was required to not break gcc builds, because for some reason gcc needs it, however I'm not gonna mess with it more atm.
I also removed flags that was already forced.

Requires volume tests fix: #112

Signed-off-by: Janusz Jankowski janusz.jankowski@linux.intel.com

@jajanusz jajanusz requested a review from lgirdwood July 16, 2018 11:29
@jajanusz
Copy link
Contributor Author

jajanusz commented Jul 16, 2018

Requires volume tests fix: #112

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, just to clarify the cmocka test is built $with_arch == xtensa ? The reason I'm asking is because the condition logic should exclude the -nostdlib CFLAG if target is not xtensa.

@jajanusz
Copy link
Contributor Author

Target is the same, you have the same config like for building firmware library, you just run make check instead of make it will invoke make like for normal build and then tests that link to specific little static libs that build for sof final binary anyway.
We can do another specific configuration just for test but then you will have to manage building for each platform for test etc and you won't be able to build normal binary and run test without reconfigure.
Also target is xtensa, if you run binary in xtensa simulator you have stdlib

@jajanusz
Copy link
Contributor Author

@jajanusz
Copy link
Contributor Author

jajanusz commented Jul 16, 2018

And it looks like cmocka will not work with our gcc toolchains because they need -nostdlib no matter what, only xcc supports stdlib (and gcc host builds ofc, but they have way less unit tests, because most of them require platforms code). I can find a way around this issue, but I guess xcc tests are enough atm.

@lgirdwood
Copy link
Member

Ok, we now have a need for a C library. Crosstool can build one as part of our GCC build.

@lgirdwood lgirdwood merged commit 20204a9 into thesofproject:master Jul 16, 2018
@lgirdwood
Copy link
Member

Looks like we are also missing cmocka header path in CFLAGS too.
make[2]: Entering directory '/home/lrg/source/reef/sof.git/test/cmocka'
make alloc volume_process buffer_new buffer_write buffer_wrap buffer_copy component_set_state list_init list_is_empty list_item_append list_item_del list_item_is_last list_item_prepend list_item gcd ceil_divide find_equal_int16 find_min_int16 find_max_abs_int32 norm_int32 sin_fixed
make[3]: Entering directory '/home/lrg/source/reef/sof.git/test/cmocka'
depbase=echo src/lib/alloc/alloc.o | sed 's|[^/]*$|.deps/&|;s|\.o$||';
xtensa-byt-elf-gcc -DHAVE_CONFIG_H -I. -I../../src/include -fno-inline-functions -mlongcalls -I../../src/arch/xtensa/include -I../../src/platform/apollolake/include -I../../src/audio -I /home/lrg/source/reef/sof.git/src/include -I /home/lrg/source/reef/sof.git/../xtensa-root/xtensa-byt-elf/include -O2 -g -Wall -Werror -Wl,-EL -Wmissing-prototypes -MT src/lib/alloc/alloc.o -MD -MP -MF $depbase.Tpo -c -o src/lib/alloc/alloc.o src/lib/alloc/alloc.c &&
mv -f $depbase.Tpo $depbase.Po
src/lib/alloc/alloc.c:35:10: fatal error: cmocka.h: No such file or directory
#include <cmocka.h>
^~~~~~~~~~
compilation terminated.

@jajanusz
Copy link
Contributor Author

@lgirdwood
As it is written in UT docs you have to point to your cmocka installation (--with-cmocka-prefix) - at this path as in any other lib will be lib/ and include/.
I think we don't want to include cmocka into our project cos you have to do a bit of magic to build it for our platforms (also it is build with CMake what is another problem).

@jajanusz
Copy link
Contributor Author

Maybe we should host these prebuilt cmocka packages for each platform in sof-tools or something like that

@jajanusz jajanusz deleted the ut-makefile-fix branch July 17, 2018 08:34
@lgirdwood
Copy link
Member

@jajanusz ok, lets revisit this later, I did not realise that cmocka was built for target. It seems we also need to ship C library too and this is probably something done better in docker by @xiulipan .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants