Skip to content

tests/build_system: add test for relative paths - #22667

Open
basilfx wants to merge 2 commits into
RIOT-OS:masterfrom
basilfx:feature/issue_14262
Open

tests/build_system: add test for relative paths#22667
basilfx wants to merge 2 commits into
RIOT-OS:masterfrom
basilfx:feature/issue_14262

Conversation

@basilfx

@basilfx basilfx commented Sep 6, 2026

Copy link
Copy Markdown
Member

Contribution description

Going through the list of (old) issues, I came across #14262. I believe that issue isn't completely relevant anymore, after #18913 got merged.

Nonetheless, #18913 did not add a test, which #14262 did. I think the test still adds value.

Testing procedure

Run make -C tests/build_system/relpath all test and it should pass.

Issues/PRs references

#14262, #18913

Declaration of AI-Tools / LLMs usage:

AI-Tools / LLMs that were used are:

  • none

@github-actions github-actions Bot added Area: doc Area: Documentation Area: tests Area: tests and testing framework labels Sep 6, 2026
@basilfx basilfx added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR AI: Not Used AI was stated to not be used in this PR/Issue and removed Area: doc Area: Documentation Area: tests Area: tests and testing framework labels Sep 6, 2026
@basilfx

basilfx commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

So if I understand correctly, the difference between #14262 and #18913 is:

  • -fmacro-prefix-map - macros only (e.g. __FILE__)
  • -fdebug-prefix-map - debug information only
  • -ffile-prefix-map - both

@crasbe crasbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can close #14262 then, right?

Comment thread tests/build_system/relpath/README.md Outdated
## Introduction

This test is supposed to check if `__FILE__` evaluates to the desired value,
which should evaluate to the path of a filename relative to `$(RIOTBASE)`. The

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
which should evaluate to the path of a filename relative to `$(RIOTBASE)`. The
which should resolve to the path of a filename relative to `$(RIOTBASE)`. The

Perhaps?

Comment thread tests/build_system/relpath/main.c Outdated
* @brief __FILE__ test application
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
*

That's from riotgen as far as I know, but we can still save a line :)

Comment thread tests/build_system/relpath/main.c Outdated
int main(void)
{
printf("__FILE__: %s\n", __FILE__);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change

@riot-ci

riot-ci commented Sep 6, 2026

Copy link
Copy Markdown

Murdock results

FAILED

a3846e9 fixup! tests/build_system: add test for relative paths

Success Failures Total Runtime
12 0 19 23s

Artifacts

@github-actions github-actions Bot added Area: doc Area: Documentation Area: tests Area: tests and testing framework and removed Area: build system Area: Build system labels Sep 6, 2026
@basilfx

basilfx commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

This isn't working on CI, because of ccache.

ccache rewrites the path mapping, which results in just main.c instead of tests/build_system/relpath/main.c

When you run the follwing from within tests/build_system/relpath:

BOARD=native64 make clean
BOARD=native64 make all
BOARD=native64 make term

__FILE__: tests/build_system/relpath/main.c
CCACHE=ccache BOARD=native64 make clean
CCACHE=ccache BOARD=native64 make all
CCACHE=ccache BOARD=native64 make term

__FILE__: tests/build_system/relpath/main.c
CCACHE=ccache CCACHE_BASEDIR="$(pwd)" BOARD=native64 make clean
CCACHE=ccache CCACHE_BASEDIR="$(pwd)" BOARD=native64 make all
CCACHE=ccache CCACHE_BASEDIR="$(pwd)" BOARD=native64 make term

__FILE__: main.c

I have two options:

  • Close this PR
  • Modify the test to only check for a relative answer (main.c is still relative), maybe even based on the presence of CCACHE_BASEDIR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Not Used AI was stated to not be used in this PR/Issue Area: doc Area: Documentation Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants