From 469ce629026cfd5be89ffb02aaddc68afb16a4a2 Mon Sep 17 00:00:00 2001 From: Leonid Evdokimov Date: Wed, 25 Sep 2024 17:49:37 +0300 Subject: [PATCH] ci: test `aarch64` and `armv7` static binaries with `qemu-user-static` --- .github/workflows/ci.yml | 4 ++++ CMakeLists.txt | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28e8e185..ea4bd545 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,8 @@ jobs: - run: sudo apt-get install -o Acquire::Retries=5 -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - run: cmake -DCMAKE_TOOLCHAIN_FILE=CMakeARM64Cross.txt - run: make -j4 VERBOSE=1 + - run: sudo apt-get install -o Acquire::Retries=5 -y qemu-user-static + - run: make -j4 test ARGS=-V armv7: runs-on: ubuntu-latest steps: @@ -48,6 +50,8 @@ jobs: - run: sudo apt-get install -o Acquire::Retries=5 -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf - run: cmake -DCMAKE_TOOLCHAIN_FILE=CMakeARMCross.txt - run: make -j4 VERBOSE=1 + - run: sudo apt-get install -o Acquire::Retries=5 -y qemu-user-static + - run: make -j4 test ARGS=-V macOS: name: macOS runs-on: macOS-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index 75f2744d..8b0913de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -759,7 +759,15 @@ SET(exectargets ${exectargets} SMHasher) # # target_link_libraries( bittest SMHasherSupport ${CMAKE_THREAD_LIBS_INIT} ) -if(NOT (CMAKE_CROSSCOMPILING)) +set(QEMU_TESTING FALSE) +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + exec_program(cat ARGS "/proc/sys/fs/binfmt_misc/qemu-${CMAKE_SYSTEM_PROCESSOR}" OUTPUT_VARIABLE QEMU) + if(QEMU MATCHES "^enabled\n") + set(QEMU_TESTING TRUE) + endif() +endif() + +if(NOT (CMAKE_CROSSCOMPILING) OR QEMU_TESTING) enable_testing() add_test(List SMHasher --list) add_test(VerifyAll SMHasher --test=VerifyAll)