Skip to content

Conversation

fabian18
Copy link
Contributor

@fabian18 fabian18 commented Aug 22, 2025

Contribution description

Fixing gprof targets.

Testing procedure

This would fail on master

gprof for profiling

cd tests/unittests
make clean all-gprof term-gprof
make eval-gprf > gprof.txt

gcov for coverage

cd tests/unittests
make clean all-gcov term-gcov
make eval-gcovr

Still you will notice that no .gcda are generated. I am trying to find out why.
They should be generated when the program is run (term-gcov) but they are not.

Issues/PRs references

@github-actions github-actions bot added Platform: native Platform: This PR/issue effects the native platform Area: build system Area: Build system labels Aug 22, 2025
@crasbe crasbe added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Aug 22, 2025
@riot-ci
Copy link

riot-ci commented Aug 22, 2025

Murdock results

FAILED

103c049 wip

Success Failures Total Runtime
7322 0 10222 11m:39s

Artifacts

@fabian18 fabian18 changed the title makefiles: fix gcov makefiles: fix gprof Aug 22, 2025
benpicco
benpicco previously approved these changes Aug 28, 2025
@fabian18
Copy link
Contributor Author

no no

Still you will notice that no .gcda are generated.

this is still an issue

@fabian18
Copy link
Contributor Author

or does it work for you?

@benpicco benpicco dismissed their stale review September 1, 2025 15:16

sorry, didn't see that this is still WIP

@crasbe crasbe added the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Sep 1, 2025
@fabian18
Copy link
Contributor Author

fabian18 commented Sep 2, 2025

Honestly I have no clue anymore why the .gcda are not generated. The program exits normally when checking $? and also I tried to call __gcov_dump manually.

@fabian18
Copy link
Contributor Author

fabian18 commented Sep 2, 2025

profiling:/home/[email protected]/RIOT/tests/unittests/bin/native64/boards_common_native/board_init.gcda:Cannot open
/home/[email protected]/RIOT/tests/unittests/bin/native64/tests_unittests.elf: getpid(): not implemented
/home/[email protected]/RIOT/tests/unittests/bin/native64/tests_unittests.elf: getpid(): not implemented
int getpid(void)
{
    warnx("getpid(): not implemented");
    return -1;
}

changed to

int getpid(void)
{
    return thread_getpid();;
}

Does not fix it.

@fabian18 fabian18 requested a review from miri64 as a code owner September 2, 2025 20:43
@github-actions github-actions bot added Area: tests Area: tests and testing framework Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: examples Area: Example Applications labels Sep 2, 2025
@fabian18
Copy link
Contributor Author

fabian18 commented Sep 2, 2025

It still fails, but it creates the .gcda files now, but they are empty 😫.
Looking at the source code, I must be past the point of fcntl(), so what can fail afterwards is only fdopen().

@fabian18 fabian18 changed the title makefiles: fix gprof makefiles: fix gprof and add gcov Sep 2, 2025
Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

Some minor, general style related things.

#include "map.h"

#include "embUnit.h"
#include "xtimer.h"
#include "ztimer.h"

#include "test_utils/interactive_sync.h"
#if IS_USED(MODULE_VFS)
#include "vfs.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include "vfs.h"
# include "vfs.h"

VFS_AUTO_MOUNT(native, { .hostpath = FS_NATIVE_DIR }, VFS_DEFAULT_NVM(0), 0);

#ifndef FS_NATIVE_MOUNT
#define FS_NATIVE_MOUNT VFS_DEFAULT_NVM(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define FS_NATIVE_MOUNT VFS_DEFAULT_NVM(0)
# define FS_NATIVE_MOUNT VFS_DEFAULT_NVM(0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: examples Area: Example Applications 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 Platform: native Platform: This PR/issue effects the native platform State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants