Skip to content

[tools] Compiling tests produces an empty config for the test sources #2397

Closed
@AlessandroA

Description

@AlessandroA

If you have the following setup:

~/some_folder/
├── mbed_app.json
└── TESTS
    └── test_group
        └── test_case
            └── main.cpp

and try to compile the tests with:

$ mbed test --compile -m K64F -t GCC_ARM -n tests-test_group-test_case

The file ~/some_folder/TESTS/test_group/test_case/main.cpp will see an empty config (empty mbed_config.h file), despite mbed_app.json being there.

Proposed solution

I think the issue is in tools/toolchains/__init__.py. When multiple sources of config data are possible, and all of them are empty/non-existent, the data structure holding the configs looks like this: ({}, {}, ..., {}). This line checks if there are no configs as follows:

if config:
    # there are configs
else:
    # there is none

but with the tuple it doesn't work. A suitable check could be:

if any(config):
    # there are configs
else:
    # there is none

(Not tested with all possible config combinations, especially when there is only 1 config source. In that case we should make sure that it's still a tuple, with one element.)

@sg- @geky

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions