Skip to content

Problem with arm-none-eabi-gcc and qemu semihosting #1638

@asimov-aiz

Description

@asimov-aiz

Hi,

I am trying to use cpputest with my project for cortex-m4 with qemu with my PC.

I create a new project and follow the Integration as external CMake project and enabled the test build.

After I build the project, I run the _deps/cpputest-build/tests/CppUTest/CppUTestTests.

On qemu:

qemu-arm -cpu cortex-m4 build/_deps/cpputest-build/tests/CppUTest/CppUTestTests

I got:

qemu-arm -cpu cortex-m4 build/_deps/cpputest-build/tests/CppUTest/CppUTestTests
......................................

If I build with native gcc:

 _deps/cpputest-build/tests/CppUTest/CppUTestTests
..................................................
.........!........!..!..!..!..!..!..!..!..!..!....
.............!..!..!..!..!..!..!....!.!........!..
...!..!..!..!..!..!..!..!..!..!..!..!...!...!....!
..!.......!..!...!..!..!..!..!..!..!..!..!..!..!..
!..!.....................!........................
..................................................
..................................................
..................................................
..................................................
..................................................
.......................!..........................
..................................................
..................................................
..................................................
..................................................
..................................................
....................
OK (870 tests, 816 ran, 1536 checks, 54 ignored, 0 filtered out, 39 ms)

Also my simple testing:

#include "CppUTest/CommandLineTestRunner.h"

TEST_GROUP(FirstTestGroup)
{
};

TEST(FirstTestGroup, Test1) { FAIL("Fail me!"); }
TEST(FirstTestGroup, Test2) { FAIL("Fail me! 222"); }

int main(int ac, char **av) {

  return RUN_ALL_TESTS(ac, av); }

The qemu stop on first failure:

unit_test.cpp:8: error: Failure in TEST(FirstTestGroup, Test2)
        Fail me! 222

I want all tests to run and show me the summary. Does anyone has experiences on this?

FYI, my build and link command

arm-none-eabi-g++ -DCPPUTEST_HAVE_GETTIMEOFDAY=1 -DCPPUTEST_HAVE_STRDUP=1 -DHAVE_CONFIG_H -I/project -I/project/build/_deps/cpputest-build -I/project/build/_deps/cpputest-src/include -I/project/build/_deps/cpputest-src/src/CppUTest/../../include -I/project/build/_deps/cpputest-src/src/CppUTestExt/../../include -ffunction-sections -fdata-sections -mcpu=cortex-m4    -include "/project/build/_deps/cpputest-src/include/CppUTest/MemoryLeakDetectorNewMacros.h" -include "/project/build/_deps/cpputest-src/include/CppUTest/MemoryLeakDetectorMallocMacros.h"  -Wall -Wextra -pedantic -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -Wsign-conversion -Wno-padded -Wno-long-long -Woverloaded-virtual -Wno-old-style-cast -Wno-c++14-compat -O2 -g -DNDEBUG -std=c++20 -MD -MT _deps/cpputest-build/tests/CppUTestExt/CMakeFiles/CppUTestExtTests.dir/CodeMemoryReporterTest.cpp.obj -MF _deps/cpputest-build/tests/CppUTestExt/CMakeFiles/CppUTestExtTests.dir/CodeMemoryReporterTest.cpp.obj.d -o _deps/cpputest-build/tests/CppUTestExt/CMakeFiles/CppUTestExtTests.dir/CodeMemoryReporterTest.cpp.obj -c /project/build/_deps/cpputest-src/tests/CppUTestExt/CodeMemoryReporterTest.cpp
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb --specs=nano.specs --specs=rdimon.specs -o _deps/cpputest-build/tests/CppUTest/CppUTestTests _deps/cpputest-build/tests/CppUTest/CMakeFiles/CppUTestTests.dir/AllTests.cpp.obj _deps/cpputest-build/tests/CppUTest/CMakeFiles/CppUTestTests.dir/SetPluginTest.cpp.obj _deps/cpputest-build/tests/CppUTest/CMakeFiles/CppUTestTests.dir/CheatSheetTest.cpp.obj ...[all objs]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions