Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5544fb8
Add big-endian CI workflow
edhartnett Feb 21, 2026
6fdf349
Fix big-endian CI: use apt libhdf5-dev instead of building from source
edhartnett Feb 21, 2026
78dca86
Add libtool to big-endian CI apt deps
edhartnett Feb 21, 2026
246fb7e
Disable nczarr, print config.log on configure failure
edhartnett Feb 21, 2026
6f69a2f
fixing
edhartnett Feb 21, 2026
396ccf9
fixing
edhartnett Feb 21, 2026
1e032e5
working on the ci
edhartnett Feb 21, 2026
977da61
fixing
edhartnett Feb 21, 2026
a5b4dac
fixing
edhartnett Feb 21, 2026
c7137c8
Fix fillp undeclared in ncx_getn_float/double_float/double fallback p…
edhartnett Feb 21, 2026
65804f8
fixing
edhartnett Feb 21, 2026
13a961a
fixing
edhartnett Feb 21, 2026
2a55c59
fixing
edhartnett Feb 21, 2026
2ce7a00
fixing
edhartnett Feb 21, 2026
b7b7ef8
fixing
edhartnett Feb 21, 2026
fd633a7
fixing
edhartnett Feb 21, 2026
c75518a
fixing
edhartnett Feb 21, 2026
65f7eea
Switch to ppc64 big-endian for CI (more stable under QEMU than s390x)
edhartnett Feb 21, 2026
669c882
Switch to Debian bullseye (GCC 10) for s390x QEMU CI - more stable th…
edhartnett Feb 21, 2026
21c41a1
fixing
edhartnett Feb 21, 2026
a6a6b00
fixing
edhartnett Feb 21, 2026
131505f
fixing
edhartnett Feb 21, 2026
2f207a0
fixing
edhartnett Feb 21, 2026
9e03ad0
fixing
edhartnett Feb 21, 2026
b345b7a
fixing
edhartnett Feb 21, 2026
de7a0de
fixing
edhartnett Feb 21, 2026
b1acdc9
fixing
edhartnett Feb 21, 2026
c4f717a
fixing
edhartnett Feb 21, 2026
736de1b
fixing
edhartnett Feb 21, 2026
946f0c6
fixing
edhartnett Feb 21, 2026
7417c39
fixing
edhartnett Feb 21, 2026
50caf24
fixing: use SCHAR_MIN/SCHAR_MAX from limits.h instead of X_SCHAR_MIN/…
edhartnett Feb 21, 2026
bbecc01
fixing: guard tst_udf_self_load under ENABLE_SHARED, skip on static-o…
edhartnett Feb 21, 2026
04f6544
enable utils in big endian run
edhartnett Feb 21, 2026
fb2cc57
fixing: expand tst_h5_endians to test BE write/read and add issue #18…
edhartnett Feb 21, 2026
d8a5332
fixing: restore f32swap/f64swap debug print loops in tst_h5_endians s…
edhartnett Feb 21, 2026
fd5828f
fixing: enable parallel build -j 4, add -Wl,--no-keep-memory, keep te…
edhartnett Feb 21, 2026
65ea19a
fixing: make check -j 4
edhartnett Feb 21, 2026
f954448
fixing: guard section 4 with #ifndef TESTNCZARR, nc_def_var_endian no…
edhartnett Feb 21, 2026
b36c55b
fixing: add comment explaining #ifndef TESTNCZARR guard on section 4
edhartnett Feb 21, 2026
c549f41
Rename workflow for Big-Endian netCDF Tests
WardF Mar 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .github/workflows/run_tests_bigendian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
###
# Build and test netCDF-C on a big-endian platform using QEMU emulation.
#
# Target: IBM s390x (z/Architecture), which is big-endian.
# The job runs on a standard x86-64 GitHub Actions runner but uses
# uraimo/run-on-arch-action to spin up a QEMU-emulated s390x container.
# This lets us verify that netCDF-C builds and tests correctly on a
# big-endian architecture without needing dedicated hardware.
#
# HDF5 is installed from the Ubuntu apt repository (libhdf5-dev) rather
# than built from source, because building HDF5 from source inside QEMU
# requires running compiled test binaries which fails under emulation.
#
# Triggered manually (workflow_dispatch) or on pull requests to main.
###

name: Run NON-REMOTE Big-Endian (s390x) netCDF Tests

on:
workflow_dispatch:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:

nc-bigendian-s390x:

name: Autotools build on s390x (big-endian)
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4

- name: Add swap space
# QEMU emulation is memory-intensive. The default GitHub Actions runner
# has limited swap, which can cause GCC's collect2 linker to segfault.
# Adding 16GB of swap reduces this risk. We also pass -Wl,--no-keep-memory
# to the linker to reduce its peak memory usage.
run: |
sudo swapoff -a || true
sudo dd if=/dev/zero of=/swapfile bs=1M count=16384
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
free -h

- name: Build and test on s390x via QEMU
uses: uraimo/run-on-arch-action@v2
with:
arch: s390x
distro: ubuntu22.04

# githubToken enables caching of the QEMU container image in the
# GitHub Container Registry, speeding up subsequent runs.
githubToken: ${{ github.token }}

install: |
apt-get update -q -y
# Print available HDF5 packages for debugging purposes
apt-cache search libhdf5 | sort
apt-get install -q -y \
libaec-dev \
zlib1g-dev \
automake \
autoconf \
libcurl4-openssl-dev \
libjpeg-dev \
wget \
curl \
bzip2 \
m4 \
flex \
bison \
cmake \
libzip-dev \
libhdf5-dev \
libhdf5-103-1 \
libtool \
gcc \
g++ \
clang \
binutils-gold

run: |
set -e
set -x

###
# Regenerate the autotools build system from source.
# This is required because the checked-out tree may not include
# generated files (configure, Makefile.in, etc.).
###
autoreconf -if

###
# Configure netCDF-C against the apt-installed HDF5 serial library.
#
# The HDF5 serial library on Ubuntu s390x lives in a non-standard
# path (/usr/lib/s390x-linux-gnu/hdf5/serial), so we pass explicit
# CPPFLAGS, LDFLAGS, and LIBS to point configure there.
#
# Features disabled to avoid missing dependencies under emulation:
# --disable-dap : requires curl/libxml2 remote access
# --disable-dap-remote-tests: requires a live DAP server
# --disable-nczarr : requires additional zip/cloud libs
# --disable-libxml2 : not needed without DAP
# --disable-shared : simplifies linking under emulation
# --enable-utilities : builds ncgen/ncdump/etc. binaries
###
CPPFLAGS="-I/usr/include/hdf5/serial" \
LDFLAGS="-L/usr/lib/s390x-linux-gnu/hdf5/serial -fuse-ld=gold -Wl,--no-keep-memory" \
LIBS="-lhdf5_serial -lz" \
CFLAGS="-O0 -g" \
CC=clang \
./configure \
--enable-hdf5 \
--disable-dap \
--disable-dap-remote-tests \
--disable-nczarr \
--disable-libxml2 \
--disable-shared \
--enable-static \
--enable-utilities \
|| { tail -200 config.log; exit 1; }

cat libnetcdf.settings

make -j 4

###
# Build and run the test suite.
# make check TESTS="" builds the test binaries without running them,
# then make check runs the full suite.
###
make check TESTS="" -j 4
make check -j 4

- name: Show test logs on failure
if: ${{ failure() }}
run: |
find /home/runner/work/netcdf-c/netcdf-c -name 'test-suite.log' | \
xargs -I{} sh -c 'echo "=== {} ==="; cat "{}"' || true
cat config.log || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ build_llvm
.vagrant
Vagrantfile
netcdf-fortran
.windsurf
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,7 @@ AM_CONDITIONAL(HAVE_H5Z_SZIP, [test "x$enable_hdf5_szip" = xyes])
AM_CONDITIONAL(HAVE_BLOSC, [test "x$have_blosc" = xyes])
AM_CONDITIONAL(HAVE_BZ2, [test "x$have_bz2" = xyes])
AM_CONDITIONAL(HAVE_ZSTD, [test "x$have_zstd" = xyes])
AM_CONDITIONAL(ENABLE_SHARED, [test "x$enable_shared" = xyes])

# If the machine doesn't have a long long, and we want netCDF-4, then
# we've got problems!
Expand Down
2 changes: 1 addition & 1 deletion libhdf5/hdf5var.c
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ NC4_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
LOG((4, "about to H5Dwrite datasetid 0x%x mem_spaceid 0x%x "
"file_spaceid 0x%x", hdf5_var->hdf_datasetid, mem_spaceid, file_spaceid));
if (H5Dwrite(hdf5_var->hdf_datasetid,
((NC_HDF5_TYPE_INFO_T *)var->type_info->format_type_info)->hdf_typeid,
((NC_HDF5_TYPE_INFO_T *)var->type_info->format_type_info)->native_hdf_typeid,
mem_spaceid, file_spaceid, xfer_plistid, bufr) < 0)
BAIL(NC_EHDFERR);

Expand Down
4 changes: 2 additions & 2 deletions libsrc/ncx.m4
Original file line number Diff line number Diff line change
Expand Up @@ -3204,7 +3204,7 @@ APIPrefix`x_getn_'NC_TYPE(float)_float(const void **xpp, IntType nelems, float *

for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++)
{
const int lstatus = APIPrefix`x_get_'NC_TYPE(float)_float(xp, tp, fillp);
const int lstatus = APIPrefix`x_get_'NC_TYPE(float)_float(xp, tp, NULL);
if (status == NC_NOERR) /* report the first encountered error */
status = lstatus;
}
Expand Down Expand Up @@ -3314,7 +3314,7 @@ APIPrefix`x_getn_'NC_TYPE(double)_double(const void **xpp, IntType nelems, doubl

for( ; nelems != 0; nelems--, xp += X_SIZEOF_DOUBLE, tp++)
{
const int lstatus = APIPrefix`x_get_'NC_TYPE(double)_double(xp, tp, fillp);
const int lstatus = APIPrefix`x_get_'NC_TYPE(double)_double(xp, tp, NULL);
if (status == NC_NOERR) /* report the first encountered error */
status = lstatus;
}
Expand Down
7 changes: 6 additions & 1 deletion nc_test4/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tst_h_scalar tst_rename tst_rename2 tst_rename3 tst_h5_endians \
tst_atts_string_rewrite tst_hdf5_file_compat tst_fill_attr_vanish \
tst_rehash tst_filterparser tst_bug324 tst_types tst_atts3 \
tst_put_vars tst_elatefill tst_udf tst_put_vars_two_unlim_dim \
tst_bug1442 tst_quantize tst_h_transient_types tst_udf_self_load
tst_bug1442 tst_quantize tst_h_transient_types

if HAS_PAR_FILTERS
NC4_TESTS += tst_alignment
Expand All @@ -44,6 +44,10 @@ endif
NC4_TESTS += tst_h_strbug tst_h_refs

# UDF self-registration plugin loading test.
# Requires a shared library build: the test dlopen()s a .so plugin.
# Skip entirely when built with --disable-shared.
if ENABLE_SHARED
NC4_TESTS += tst_udf_self_load
# Build the test plugin as a shared library (libtool module).
check_LTLIBRARIES = tst_udf_self_load_plugin.la
tst_udf_self_load_plugin_la_SOURCES = tst_udf_self_load_plugin.c
Expand All @@ -59,6 +63,7 @@ tst_udf_self_load_plugin_la_LIBADD = ${top_builddir}/liblib/libnetcdf.la
# by configure.ac (see the case $host_os block after LT_INIT) so the
# compiled-in TEST_PLUGIN_PATH always points to the correct filename.
tst_udf_self_load_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_PLUGIN_PATH=\"$(abs_builddir)/.libs/tst_udf_self_load_plugin@MODULE_EXT@\"
endif # ENABLE_SHARED

# Build test programs plus programs used in test scripts.
check_PROGRAMS = $(NC4_TESTS) tst_empty_vlen_unlim tst_charvlenbug \
Expand Down
Loading
Loading