[Sound-open-firmware] help with unit tests

Liam Girdwood liam.r.girdwood at linux.intel.com
Fri Feb 8 19:56:11 CET 2019


On Fri, 2019-02-08 at 20:36 +0200, kalamara at ceid.upatras.gr wrote:
> Hello, this is the first post from a newb user so first of all kudos to 
> everyone for this amazing project.
> 
> I have followed the build from scratch instructions and built 
> successfully the apl firmware (from branch master),
> but am having trouble building the unit tests:
> 

I think Janusz is is improving the UT cmocka infrastructure atm so there may be
an issue with the updates. Janusz, any idea ?

More comments inline.

> 
> :~/lara/sof/sof/build_ut$ cmake -DTOOLCHAIN=xtensa-apl-elf 
> -DROOT_DIR=`pwd`/../../xtensa-root/xtensa-apl-elf  -DBUILD_UNIT_TESTS=ON 
> ..
> -- Preparing Xtensa toolchain
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut
> 
> :~/lara/sof/sof/build_ut$ make apollolake_defconfig
> [100%] Applying olddefconfig with apollolake_defconfig
> Using existing configuration '.config' as base
> Configuration written to '.config'
> [100%] Built target apollolake_defconfig
> 
> :~/lara/sof/sof/build_ut$ make -j4
> -- Preparing Xtensa toolchain
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/antonis/lara/sof/sof/build_ut
> [  0%] Built target ld_script_memory_mock
> [  0%] Performing update step for 'cmocka_git'
> [  0%] Generating 
> /home/antonis/lara/sof/sof/build_ut/generated/include/config.h
> [  0%] Built target genconfig
> Scanning dependencies of target audio_for_volume
> [  0%] Building C object 
> test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/sr
> c/audio/volume_generic.c.o
> [  2%] Building C object 
> test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/sr
> c/audio/volume.c.o
> [  2%] Building C object 
> test/cmocka/src/audio/volume/CMakeFiles/audio_for_volume.dir/__/__/__/__/__/sr
> c/audio/volume_hifi3.c.o
> [  3%] Linking C static library libaudio_for_volume.a
> [  3%] Built target audio_for_volume
> Current branch master is up to date.
> [  4%] Performing configure step for 'cmocka_git'
> -- The C compiler identification is GNU 8.1.0
> -- Check for working C compiler: 
> /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc
> -- Check for working C compiler: 
> /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc -- broken
> CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 
> (message):
>    The C compiler
> 
>      "/home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc"
> 
>    is not able to compile a simple test program.
> 
>    It fails with the following output:
> 
>      Change Dir: 
> /home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp
> 
>      Run Build Command:"/usr/bin/make" "cmTC_809b9/fast"
>      make[3]: Entering directory 
> '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp'
>      /usr/bin/make -f CMakeFiles/cmTC_809b9.dir/build.make 
> CMakeFiles/cmTC_809b9.dir/build
>      make[4]: Entering directory 
> '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp'
>      Building C object CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o
>      /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc    -o 
> CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o   -c 
> /home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp/testC
> Compiler.c
>      Linking C executable cmTC_809b9
>      /usr/bin/cmake -E cmake_link_script 
> CMakeFiles/cmTC_809b9.dir/link.txt --verbose=1
>      /home/antonis/lara/sof/xtensa-apl-elf/bin/xtensa-apl-elf-gcc      
> CMakeFiles/cmTC_809b9.dir/testCCompiler.c.o  -o cmTC_809b9
>      
> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find crt1-sim.o: No such file or directory
>      

So it looks like cmocka build is locking for FW object files but cant find them.
I assume the FW has been built prior to making the unit tests ?


> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find crt0.o: No such file or directory
>      
> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find _vectors.o: No such file or directory
>      
> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find -lc
>      
> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find -lsim
>      
> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find -lc
>      
> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find -lhandlers-sim
>      
> /home/antonis/lara/sof/xtensa-apl-elf/bin/../lib/gcc/xtensa-apl-
> elf/8.1.0/../../../../xtensa-apl-elf/bin/ld: 
> cannot find -lhal
>      collect2: error: ld returned 1 exit status
>      CMakeFiles/cmTC_809b9.dir/build.make:97: recipe for target 
> 'cmTC_809b9' failed
>      make[4]: *** [cmTC_809b9] Error 1
>      make[4]: Leaving directory 
> '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp'
>      Makefile:126: recipe for target 'cmTC_809b9/fast' failed
>      make[3]: *** [cmTC_809b9/fast] Error 2
>      make[3]: Leaving directory 
> '/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeTmp'
> 
> 
> 
> 
>    CMake will not be able to correctly generate this project.
> Call Stack (most recent call first):
>    CMakeLists.txt:18 (project)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also 
> "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeOutput.l
> og".
> See also 
> "/home/antonis/lara/sof/sof/build_ut/cmocka_git/build/CMakeFiles/CMakeError.lo
> g".
> test/cmocka/CMakeFiles/cmocka_git.dir/build.make:105: recipe for target 
> 'cmocka_git/src/cmocka_git-stamp/cmocka_git-configure' failed
> make[2]: *** [cmocka_git/src/cmocka_git-stamp/cmocka_git-configure] 
> Error 1
> CMakeFiles/Makefile2:572: recipe for target 
> 'test/cmocka/CMakeFiles/cmocka_git.dir/all' failed
> make[1]: *** [test/cmocka/CMakeFiles/cmocka_git.dir/all] Error 2
> Makefile:94: recipe for target 'all' failed
> make: *** [all] Error 2
> 
> It seems something that should be obvious is missing from my setup, even 
> though i am able to build SOF binaries?
> Can you please advise?
> 
> my environment is
> 
> Ubuntu 18.04.1 LTS
> cmake version 3.10.2

These versions should both be good.

Liam

> 
> regards and thanks
> 
> antonis
> 
> _______________________________________________
> Sound-open-firmware mailing list
> Sound-open-firmware at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware



More information about the Sound-open-firmware mailing list