Skip to content

tinystdio: fgets returns NULL only when EOF is reached #8

tinystdio: fgets returns NULL only when EOF is reached

tinystdio: fgets returns NULL only when EOF is reached #8

Workflow file for this run

name: Linux
on:
push:
branches:
- main
pull_request:
branches:
- main
# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# CCache is disabled for the Linux jobs for now.
CCACHE_SIZE: "0M"
CCACHE_CMD: true
DOCKERFILE: picolibc/.github/Dockerfile
IMAGE_FILE: dockerimg-linux.tar.zst
IMAGE: picolibc-linux
PACKAGES_FILE: picolibc/.github/linux-packages.txt
EXTRA_FILE: picolibc/.github/linux-files.txt
jobs:
cache-maker:
runs-on: ubuntu-latest
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Cache the Docker Image
id: cache
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
lookup-only: true
- name: Set up Docker Buildx
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/setup-buildx-action@v3
- name: Build picolibc container
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
file: .github/Dockerfile
tags: ${{ env.IMAGE }}:latest
outputs: type=docker,force-compression=true,compression=zstd,compression-level=22,dest=${{ env.IMAGE_FILE }}
cmake-linux:
needs: cache-maker
runs-on: ubuntu-latest
strategy:
matrix:
cmake_flags: [
"",
# optional configurations
"-D__IO_FLOAT=y -D_IO_FLOAT_EXACT=n -D_WANT_IO_LONG_LONG=y -D_MB_CAPABLE=y -D_WANT_IO_POS_ARGS=y -D__HAVE_LOCALE_INFO__=y -D__HAVE_LOCALE_INFO_EXTENDED__=y -D_WANT_MINIMAL_IO_LONG_LONG=y",
]
test: [
"./.github/do-cmake-linux -DCMAKE_BUILD_TYPE=RelWithDebInfo",
"./.github/do-cmake-linux -DCMAKE_BUILD_TYPE=MinSizeRel",
]
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Restore the Docker Image
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
fail-on-cache-miss: true
- name: Load and Check the Docker Image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
# The docker image contains ccache, but the ccache action uses the ccache
# outside docker for statistics, so install the same ccache version.
# Install in /usr/bin so the ccache action gets the expected environment.
- name: install ccache
if: matrix.test == './.github/do-zephyr'
run: |
wget -nv https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
sudo tar xf ccache-4.8.2-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.8.2-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
# Key on job name and cache size to get separate caches for linux
# and zephyr.
- name: ccache
if: matrix.test == './.github/do-zephyr'
uses: hendrikmuhs/ccache-action@v1.2.12
with:
key: compilation-${{ runner.os }}-${{ github.job }}-${{ matrix.meson_flags }}-${{ env.CCACHE_SIZE }}
max-size: ${{ env.CCACHE_SIZE }}
- name: CMake test
run: |
docker run -v $(readlink -f picolibc):/picolibc -w /picolibc -v $GITHUB_WORKSPACE/.ccache:/root/.ccache $IMAGE bash --login -c "${{ env.CCACHE_CMD }} --set-config=max_size=${{ env.CCACHE_SIZE }} && ${{ matrix.test }} ${{ matrix.cmake_flags }}"
minsize-linux:
needs: cache-maker
runs-on: ubuntu-latest
strategy:
matrix:
meson_flags: [
"",
# Tinystdio and math configurations, one with multithread disabled and with locale, original malloc and atexit/onexit code
"-Dio-float-exact=false -Dio-long-long=true -Dio-percent-b=true -Dio-long-double=true -Dnewlib-obsolete-math=false -Dwant-math-errno=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false -Dnewlib-locale-info=true -Dnewlib-locale-info-extended=true -Dnewlib-mb=true -Dnewlib-iconv-external-ccs=true -Dnewlib-nano-malloc=false -Dpicoexit=false -Dprintf-small-ultoa=true",
"-Dformat-default=integer -Dfreestanding=true -Dposix-io=false -Dnewlib-obsolete-math=true -Dwant-math-errno=true -Dassert-verbose=false -Dfast-bufio=true",
# Original stdio, one with multithread disabled
"-Dtinystdio=false",
"-Dtinystdio=false -Dnewlib-io-float=true -Dio-long-long=true -Dio-long-double=true -Dnewlib-fvwrite-in-streamio=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false",
]
test: [
"./.github/do-linux",
]
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Restore the Docker Image
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
fail-on-cache-miss: true
- name: Load and Check the Docker Image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
# The docker image contains ccache, but the ccache action uses the ccache
# outside docker for statistics, so install the same ccache version.
# Install in /usr/bin so the ccache action gets the expected environment.
- name: install ccache
if: matrix.test == './.github/do-zephyr'
run: |
wget -nv https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
sudo tar xf ccache-4.8.2-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.8.2-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
# Key on job name and cache size to get separate caches for linux
# and zephyr.
- name: ccache
if: matrix.test == './.github/do-zephyr'
uses: hendrikmuhs/ccache-action@v1.2.12
with:
key: compilation-${{ runner.os }}-${{ github.job }}-${{ matrix.meson_flags }}-${{ env.CCACHE_SIZE }}
max-size: ${{ env.CCACHE_SIZE }}
- name: Minsize test
run: |
docker run -v $(readlink -f picolibc):/picolibc -w /picolibc -v $GITHUB_WORKSPACE/.ccache:/root/.ccache $IMAGE bash --login -c "${{ env.CCACHE_CMD }} --set-config=max_size=${{ env.CCACHE_SIZE }} && ${{ matrix.test }} ${{ matrix.meson_flags }} --buildtype minsize"
release-linux:
needs: cache-maker
runs-on: ubuntu-latest
strategy:
matrix:
meson_flags: [
"",
# Tinystdio and math configurations, one with multithread disabled and with locale, original malloc and atexit/onexit code
"-Dio-float-exact=false -Dio-long-long=true -Dio-percent-b=true -Dio-long-double=true -Dnewlib-obsolete-math=false -Dwant-math-errno=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false -Dnewlib-locale-info=true -Dnewlib-locale-info-extended=true -Dnewlib-mb=true -Dnewlib-iconv-external-ccs=true -Dnewlib-nano-malloc=false -Dpicoexit=false -Dprintf-small-ultoa=true",
"-Dformat-default=integer -Dfreestanding=true -Dposix-io=false -Dnewlib-obsolete-math=true -Dwant-math-errno=true -Dassert-verbose=false -Dfast-bufio=true",
# Original stdio, one with multithread disabled
"-Dtinystdio=false",
"-Dtinystdio=false -Dnewlib-io-float=true -Dio-long-long=true -Dio-long-double=true -Dnewlib-fvwrite-in-streamio=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false",
]
test: [
"./.github/do-linux",
]
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Restore the Docker Image
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
fail-on-cache-miss: true
- name: Load and Check the Docker Image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
# The docker image contains ccache, but the ccache action uses the ccache
# outside docker for statistics, so install the same ccache version.
# Install in /usr/bin so the ccache action gets the expected environment.
- name: install ccache
if: matrix.test == './.github/do-zephyr'
run: |
wget -nv https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
sudo tar xf ccache-4.8.2-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.8.2-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
# Key on job name and cache size to get separate caches for linux
# and zephyr.
- name: ccache
if: matrix.test == './.github/do-zephyr'
uses: hendrikmuhs/ccache-action@v1.2.12
with:
key: compilation-${{ runner.os }}-${{ github.job }}-${{ matrix.meson_flags }}-${{ env.CCACHE_SIZE }}
max-size: ${{ env.CCACHE_SIZE }}
- name: Release test
run: |
docker run -v $(readlink -f picolibc):/picolibc -w /picolibc -v $GITHUB_WORKSPACE/.ccache:/root/.ccache $IMAGE bash --login -c "${{ env.CCACHE_CMD }} --set-config=max_size=${{ env.CCACHE_SIZE }} && ${{ matrix.test }} ${{ matrix.meson_flags }} --buildtype release"