Skip to content

libc/stdio: add stdio indicator test#463

Draft
lukkrusz wants to merge 2 commits intomasterfrom
lukkrusz/stdio_indicator_test
Draft

libc/stdio: add stdio indicator test#463
lukkrusz wants to merge 2 commits intomasterfrom
lukkrusz/stdio_indicator_test

Conversation

@lukkrusz
Copy link
Contributor

@lukkrusz lukkrusz commented Mar 12, 2026

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.

Previous conversation: #295

@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 significantly enhances the test coverage for standard I/O (stdio) functions within the libc library. It introduces a dedicated test module to rigorously validate the behavior of file indicator functions like feof, ftell, and ftello, as well as the getdelim function for delimited input. The changes aim to improve the robustness and reliability of these core library components by testing them across a wide range of conditions, including different file modes, empty/non-empty files, error handling, and non-seekable stream types.

Highlights

  • New Test File: A new test file, libc/stdio/stdio_indicator.c, has been added to the libc-tests suite.
  • Expanded stdio Test Coverage: Comprehensive test cases for feof, ftell, ftello, and getdelim functions have been introduced, covering various scenarios and edge cases.
  • Test Group Registration: The main test runner in libc/stdio/main.c has been updated to include the newly added test groups for stdio_feof, stdio_ftell, and stdio_getdelim.
Changelog
  • libc/stdio/main.c
    • Added RUN_TEST_GROUP calls for stdio_feof, stdio_ftell, and stdio_getdelim to the test runner.
  • libc/stdio/stdio_indicator.c
    • Introduced a new test file stdio_indicator.c.
    • Implemented tests for feof covering various file modes, empty/non-empty files, errno preservation, and error conditions.
    • Implemented tests for ftell and ftello verifying correct position reporting, handling of bad file descriptors, and non-seekable streams (sockets, pipes, fifos).
    • Included tests for getdelim covering delimiter handling, reallocation, invalid arguments, and write-only files.
Activity
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.

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 adds new tests for feof, ftell, and getdelim stdio functions. The changes are good and increase test coverage. I've found a few issues, including resource leaks, a bug in a test assertion, and some areas for improvement in terms of code clarity and efficiency. Please see my detailed comments.

@github-actions
Copy link

github-actions bot commented Mar 12, 2026

Unit Test Results

9 773 tests  +220   9 172 ✅ +211   53m 58s ⏱️ + 1m 31s
  591 suites ±  0     601 💤 +  9 
    1 files   ±  0       0 ❌ ±  0 

Results for commit 0e15d8e. ± Comparison against base commit 6ed92c4.

♻️ This comment has been updated with latest results.

@lukkrusz lukkrusz changed the title Lukkrusz/stdio indicator test libc/stdio stdio indicator test Mar 12, 2026
@lukkrusz lukkrusz changed the title libc/stdio stdio indicator test libc/stdio: add stdio indicator test Mar 12, 2026
@lukkrusz lukkrusz force-pushed the lukkrusz/stdio_indicator_test branch from a90f274 to 03b2ee4 Compare March 13, 2026 08:25
Fixing a couple of issues and adding more test
cases for better coverage.

JIRA: CI-366
@lukkrusz lukkrusz force-pushed the lukkrusz/stdio_indicator_test branch from 03b2ee4 to 0e15d8e Compare March 13, 2026 08:30
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.

2 participants