mirror of
https://github.com/nlohmann/json.git
synced 2026-11-21 18:32:40 +00:00
ci: add s390x big-endian test coverage (#6150)
* ci: add s390x big-endian test coverage Signed-off-by: Jatin Chauhan <chauhanjatin0404@gmail.com> * ci: install unzip for Ninja setup in Debian Signed-off-by: Jatin Chauhan <chauhanjatin0404@gmail.com> * ci: select Ninja for the outer Debian configuration Signed-off-by: Jatin Chauhan <chauhanjatin0404@gmail.com> * ci: address big-endian workflow review Signed-off-by: Jatin Chauhan <chauhanjatin0404@gmail.com> * ci: run big-endian tests on master and release pushes Signed-off-by: Jatin Chauhan <chauhanjatin0404@gmail.com> --------- Signed-off-by: Jatin Chauhan <chauhanjatin0404@gmail.com>
This commit is contained in:
1 parent
098eebd412
commit
7a67ccf6aa
3 files changed
+91
No files matched your search
@@ -0,0 +1,46 @@
|
|||||||
|
name: Big-endian
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
- release/*
|
||||||
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: '17 4 * * 1'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci_test_big_endian:
|
||||||
|
# Allow manual fork validation, but avoid weekly emulation runs in forks.
|
||||||
|
if: github.event_name != 'schedule' || github.repository == 'nlohmann/json'
|
||||||
|
runs-on: ubuntu-26.04
|
||||||
|
container: debian:trixie
|
||||||
|
timeout-minutes: 90
|
||||||
|
steps:
|
||||||
|
- name: Install the s390x cross compiler and qemu-user
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
# get-cmake uses unzip to extract Ninja's zip; debian:trixie does not include it.
|
||||||
|
apt-get install -y --no-install-recommends g++ g++-s390x-linux-gnu qemu-user git ca-certificates unzip
|
||||||
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Get latest CMake and ninja
|
||||||
|
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
|
||||||
|
- name: Check that the target is big-endian
|
||||||
|
run: echo | s390x-linux-gnu-g++ -dM -E - | grep -q '__BYTE_ORDER__ __ORDER_BIG_ENDIAN__'
|
||||||
|
- name: Run CMake
|
||||||
|
run: cmake -S . -B build -G Ninja -DJSON_CI=On
|
||||||
|
- name: Build and test
|
||||||
|
env:
|
||||||
|
TEST_SCOPE: ${{ github.event_name == 'pull_request' && 'focused' || 'full' }}
|
||||||
|
run: cmake --build build --target "ci_test_big_endian_${TEST_SCOPE}"
|
||||||
@@ -100,6 +100,40 @@ add_custom_target(ci_test_clang
|
|||||||
COMMENT "Compile and test with Clang using maximal warning flags"
|
COMMENT "Compile and test with Clang using maximal warning flags"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Big-endian tests (cross-compiled for s390x, executed under qemu-user).
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
foreach(S390X_TEST_SCOPE IN ITEMS focused full)
|
||||||
|
set(S390X_TEST_FILTER)
|
||||||
|
if(S390X_TEST_SCOPE STREQUAL "focused")
|
||||||
|
# Keep this filter in sync with new or renamed endianness-sensitive tests.
|
||||||
|
# "serialization" intentionally includes "deserialization"; the develop
|
||||||
|
# and weekly full runs cover tests outside this focused runtime subset.
|
||||||
|
set(S390X_TEST_FILTER -R "cbor|msgpack|ubjson|bjdata|bson|bon8|binary|json_view|alt-string|serialization|class_parser|fmt_formatter")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_custom_target(ci_test_big_endian_${S390X_TEST_SCOPE}
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||||
|
-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=s390x
|
||||||
|
-DCMAKE_CXX_COMPILER=s390x-linux-gnu-g++
|
||||||
|
"-DCMAKE_CROSSCOMPILING_EMULATOR=qemu-s390x;-L;/usr/s390x-linux-gnu"
|
||||||
|
-DJSON_BuildTests=ON -DJSON_FastTests=ON
|
||||||
|
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_big_endian
|
||||||
|
# Build every test binary, even when executing only the focused subset.
|
||||||
|
# Limit parallelism for memory-intensive compilation and emulated tests.
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo "s390x build timing:"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_big_endian --parallel 2
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo "s390x test timing:"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E time ${CMAKE_CTEST_COMMAND} --test-dir ${PROJECT_BINARY_DIR}/build_big_endian
|
||||||
|
--parallel 2 --output-on-failure --no-tests=error ${S390X_TEST_FILTER}
|
||||||
|
COMMENT "Cross-compile all tests for s390x and run the ${S390X_TEST_SCOPE} suite under qemu-user"
|
||||||
|
VERBATIM
|
||||||
|
USES_TERMINAL
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Different C++ Standards.
|
# Different C++ Standards.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|||||||
@@ -2,10 +2,21 @@
|
|||||||
# properties on its (always-configured) INTERFACE_LIBRARY "fmt-header-only" target;
|
# properties on its (always-configured) INTERFACE_LIBRARY "fmt-header-only" target;
|
||||||
# CMake rejected those properties on INTERFACE_LIBRARY targets before CMake 3.19
|
# CMake rejected those properties on INTERFACE_LIBRARY targets before CMake 3.19
|
||||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0")
|
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.19.0")
|
||||||
|
# The recipe runs its executable after linking, so nested cross-builds need
|
||||||
|
# the parent system and emulator settings as well as the compiler.
|
||||||
|
set(FMT_CROSSCOMPILING_ARGS)
|
||||||
|
if(CMAKE_CROSSCOMPILING)
|
||||||
|
string(REPLACE ";" "\\;" FMT_CROSSCOMPILING_EMULATOR "${CMAKE_CROSSCOMPILING_EMULATOR}")
|
||||||
|
list(APPEND FMT_CROSSCOMPILING_ARGS
|
||||||
|
"-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}"
|
||||||
|
"-DCMAKE_CROSSCOMPILING_EMULATOR=${FMT_CROSSCOMPILING_EMULATOR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
add_test(NAME fmt_formatter_configure
|
add_test(NAME fmt_formatter_configure
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-G "${CMAKE_GENERATOR}"
|
-G "${CMAKE_GENERATOR}"
|
||||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||||
|
${FMT_CROSSCOMPILING_ARGS}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/project
|
${CMAKE_CURRENT_SOURCE_DIR}/project
|
||||||
)
|
)
|
||||||
add_test(NAME fmt_formatter_build
|
add_test(NAME fmt_formatter_build
|
||||||
|
|||||||
Reference in new issue
Block a user