Skip to content

libc: enable running fs tests on multiple filesystems#461

Open
adamdebek wants to merge 2 commits intomasterfrom
adamdebek/CI-497
Open

libc: enable running fs tests on multiple filesystems#461
adamdebek wants to merge 2 commits intomasterfrom
adamdebek/CI-497

Conversation

@adamdebek
Copy link
Contributor

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

@gemini-code-assist
Copy link

Summary of Changes

Hello @adamdebek, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant refactoring of the libc test infrastructure, primarily by reorganizing filesystem-related tests into a new, dedicated libc/fs directory. This change improves the modularity and clarity of the test suite, making it easier to manage and extend. It also introduces new tests for directory manipulation functions and updates the CI pipeline to ensure comprehensive coverage of these refactored components.

Highlights

  • Filesystem Test Refactoring: The libc test suite has been significantly refactored to introduce a dedicated libc/fs directory for filesystem-related tests. This includes moving existing file operation tests and adding new directory-specific tests.
  • New rmdir Test Suite: A comprehensive test suite for the rmdir function has been added, covering various scenarios such as removing empty directories, handling non-existent paths, too long paths, empty strings, files, and non-empty directories.
  • Test File and Group Renaming: Several test files and their internal test groups have been renamed for clarity and better organization. For instance, unistd_file.c is now file.c, unistd_getopt.c is getopt.c, unistd_fsdir.c is procenv.c, and unistd_uids.c is uids.c.
  • CI Integration for Filesystem Tests: The CI configuration (libc/test.yaml) has been updated to include new test entries (fs-root and fs-tmp) that execute the newly organized filesystem tests against different mount points.
Changelog
  • libc/Makefile
    • Added a new fs test group to the libc Makefile, enabling the compilation and execution of filesystem-related tests.
  • libc/fs/dir.c
    • Added a new file containing a comprehensive test suite for the rmdir function, covering various error conditions and successful removals.
  • libc/fs/file.c
    • Renamed from libc/misc/unistd_file.c to libc/fs/file.c.
    • Updated internal test group names from unistd_file to file and unistd_file_safe to file_safe, and unistd_file_pread to file_pread.
    • Modified file path definitions to use relative paths instead of /tmp/ prefixes for test files.
    • Adjusted include order for sys/stat.h.
  • libc/fs/main.c
    • Added a new main entry point for the libc/fs test suite, orchestrating the execution of various filesystem test groups including file, pread, stat, and rmdir.
    • Implemented logic to create and change into a temporary test directory based on a provided mount point.
  • libc/fs/stat.c
    • Renamed from libc/misc/stat.c to libc/fs/stat.c.
  • libc/misc/getopt.c
    • Renamed from libc/misc/unistd_getopt.c to libc/misc/getopt.c.
    • Updated internal test group names from unistd_getopt to getopt.
  • libc/misc/main.c
    • Removed old unistd_ prefixed test groups and added new, renamed test groups (getopt, uids, procenv) to the runner function.
    • Corrected a typo from dummyfd to dummyfs in a comment.
  • libc/misc/procenv.c
    • Renamed from libc/misc/unistd_fsdir.c to libc/misc/procenv.c.
    • Updated internal test group names from unistd_fsdir to procenv.
    • Renamed internal file and directory defines from unistd_fsdir_file to procenv_file and unistd_fsdir_directory to procenv_directory.
    • Removed rmdir related tests, as they are now handled in libc/fs/dir.c.
  • libc/misc/uids.c
    • Renamed from libc/misc/unistd_uids.c to libc/misc/uids.c.
    • Updated internal test group names from unistd_uids to uids.
  • libc/test.yaml
    • Added new test configurations fs-root and fs-tmp to execute the test-libc-fs binary with different filesystem mount points.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adamdebek adamdebek changed the title Adamdebek/ci 497 libc: enable running fs tests on multiple filesystems Feb 25, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the libc tests by grouping filesystem-related tests into a new fs test module. This involves renaming files, moving them to a new fs directory, and updating test group and case names for consistency. A new test runner for the fs module is introduced, along with new tests for rmdir. My review found a couple of resource leaks in the new rmdir tests where file descriptors from creat() are not being closed. These should be fixed to ensure the test suite is robust.

@github-actions
Copy link

github-actions bot commented Feb 25, 2026

Unit Test Results

10 102 tests  +577   9 502 ✅ +569   53m 24s ⏱️ +47s
   600 suites + 17     600 💤 +  8 
     1 files   ±  0       0 ❌ ±  0 

Results for commit 0904b4a. ± Comparison against base commit 6857efb.

This pull request removes 1172 and adds 1749 tests. Note that renamed tests count towards both.
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_errno.ebadf
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_errno.eloop
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_errno.enametoolong
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_errno.enoent
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_errno.enotdir
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_mode.chr_type
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_mode.dir_type
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_mode.fifo_type
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_mode.gid
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_mode.none
…
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_close
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_dup
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_dup2
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_dup2_closed
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_dup2_opened
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_dup_closed
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_ftruncate_down
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_ftruncate_ebadf
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_ftruncate_einval
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_ftruncate_opened
…
This pull request removes 77 skipped tests and adds 85 skipped tests. Note that renamed tests count towards both.
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_errno.enotdir
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_mode.chr_type
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.unistd_file.file_truncate_eisdir
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.unistd_fsdir.fchdir
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.unistd_fsdir.fchown
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.unistd_uids.getuids_parent
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.unistd_uids.setpuids_setpgid
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.unistd_uids.setuids_parent
phoenix-rtos-tests/libc/misc ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/misc.stat_errno.enotdir
phoenix-rtos-tests/libc/misc ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/misc.stat_mode.chr_type
…
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.file.file_truncate_eisdir
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.stat_errno.enotdir
phoenix-rtos-tests/libc/fs-root ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/fs-root.stat_mode.chr_type
phoenix-rtos-tests/libc/fs-root ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/fs-root.file.file_truncate_eisdir
phoenix-rtos-tests/libc/fs-root ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/fs-root.stat_errno.enotdir
phoenix-rtos-tests/libc/fs-root ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/fs-root.stat_mode.chr_type
phoenix-rtos-tests/libc/fs-root ‑ armv7a9-zynq7000-qemu:phoenix-rtos-tests/libc/fs-root.file.file_truncate_eisdir
phoenix-rtos-tests/libc/fs-root ‑ armv7a9-zynq7000-qemu:phoenix-rtos-tests/libc/fs-root.stat_errno.enotdir
phoenix-rtos-tests/libc/fs-root ‑ armv7a9-zynq7000-qemu:phoenix-rtos-tests/libc/fs-root.stat_mode.chr_type
phoenix-rtos-tests/libc/fs-root ‑ armv7a9-zynq7000-zedboard:phoenix-rtos-tests/libc/fs-root.file.file_truncate_eisdir
…

♻️ This comment has been updated with latest results.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant