Skip to content

Commit

Permalink
Merge pull request #264 from PJK/b32ci
Browse files Browse the repository at this point in the history
Set up a 32b cross-compile CI environment
  • Loading branch information
PJK authored Jan 8, 2023
2 parents 69fad47 + b41cec9 commit 4997d26
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ commands:
linux-setup:
steps:
- run: sudo apt-get update
- run: sudo apt-get install -y cmake "${TOOLCHAIN_PACKAGE}"
- run: sudo apt-get install -y cmake ${TOOLCHAIN_PACKAGES}
- run: sudo apt install libcmocka-dev
build:
steps:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
machine:
image: ubuntu-2204:2022.10.2
environment:
TOOLCHAIN_PACKAGE: g++
TOOLCHAIN_PACKAGES: g++
steps:
- checkout
- linux-setup
Expand All @@ -57,7 +57,7 @@ jobs:
machine:
image: ubuntu-2204:2022.10.2
environment:
TOOLCHAIN_PACKAGE: g++
TOOLCHAIN_PACKAGES: g++
CMAKE_COVERAGE: ON
steps:
- checkout
Expand All @@ -78,7 +78,7 @@ jobs:
machine:
image: ubuntu-2204:2022.10.2
environment:
TOOLCHAIN_PACKAGE: clang
TOOLCHAIN_PACKAGES: clang
CC: clang
CXX: clang++
steps:
Expand All @@ -87,11 +87,34 @@ jobs:
- build
- test

build-and-test-32b:
machine:
image: ubuntu-2204:2022.10.2
steps:
- checkout
- run: sudo apt-get update
- run: sudo apt-get install -y cmake gcc-multilib g++-multilib libc6-dev-i386
# Make cmocka from source w/ 32b setup
- run: git clone https://git.cryptomilk.org/projects/cmocka.git ~/cmocka
- run: >
cd $(mktemp -d /tmp/build.XXXX) &&
cmake ~/cmocka -DCMAKE_TOOLCHAIN_FILE=~/cmocka/cmake/Toolchain-cross-m32.cmake &&
make &&
sudo make install
# Piggyback on the cmocka 32b toolchain
- run: >
cmake -DWITH_TESTS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE=~/cmocka/cmake/Toolchain-cross-m32.cmake \
.
- run: make -j 16 VERBOSE=1
- test

build-and-test-release-clang:
machine:
image: ubuntu-2204:2022.10.2
environment:
TOOLCHAIN_PACKAGE: clang
TOOLCHAIN_PACKAGES: clang
CC: clang
CXX: clang++
steps:
Expand All @@ -104,7 +127,7 @@ jobs:
machine:
image: ubuntu-2204:2022.10.2
environment:
TOOLCHAIN_PACKAGE: clang
TOOLCHAIN_PACKAGES: clang
CC: clang
CXX: clang++
CMAKE_COVERAGE: ON
Expand All @@ -119,7 +142,7 @@ jobs:
machine:
image: ubuntu-2204:2022.10.2
environment:
TOOLCHAIN_PACKAGE: g++
TOOLCHAIN_PACKAGES: g++
resource_class: arm.medium
steps:
- checkout
Expand All @@ -131,7 +154,7 @@ jobs:
machine:
image: ubuntu-2204:2022.10.2
environment:
TOOLCHAIN_PACKAGE: g++
TOOLCHAIN_PACKAGES: g++
steps:
- checkout
- linux-setup
Expand Down Expand Up @@ -162,6 +185,7 @@ workflows:
- static-test
- build-and-test
- build-and-test-clang
- build-and-test-32b
- build-and-test-release-clang
- build-and-test-arm
- build-bazel
Expand Down
8 changes: 8 additions & 0 deletions CMakeModules/FindCMocka.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
#=============================================================================
#

find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_CMOCKA QUIET cmocka)
set(CMOCKA_DEFINITIONS ${PC_CMOCKA_CFLAGS_OTHER})
endif()

find_path(CMOCKA_INCLUDE_DIR
HINTS ${PC_CMOCKA_INCLUDEDIR} ${PC_CMOCKA_INCLUDE_DIRS}
NAMES
cmocka.h
PATHS
${CMOCKA_ROOT_DIR}/include
)

find_library(CMOCKA_LIBRARY
HINTS ${PC_CMOCKA_LIBDIR} ${PC_CMOCKA_LIBRARY_DIRS}
NAMES
cmocka cmocka_shared
PATHS
Expand Down
1 change: 1 addition & 0 deletions test/array_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/array_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/assertions.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/bad_inputs_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/bytestring_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/bytestring_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/callbacks_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/cbor_serialize_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <strings.h>

Expand Down
1 change: 1 addition & 0 deletions test/cbor_stream_decode_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/copy_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/float_ctrl_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/float_ctrl_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <tgmath.h>

#include <cmocka.h>
Expand Down
1 change: 1 addition & 0 deletions test/fuzz_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/map_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/map_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>

#include <cmocka.h>
Expand Down
1 change: 1 addition & 0 deletions test/memory_utils_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/negint_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/negint_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>
#include "test_allocator.h"
Expand Down
1 change: 1 addition & 0 deletions test/pretty_printer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/stack_over_limit_test.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/string_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/string_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/tag_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/tag_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/test_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/uint_encoders_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down
1 change: 1 addition & 0 deletions test/uint_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>
#include "test_allocator.h"
Expand Down
1 change: 1 addition & 0 deletions test/unicode_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>

#include <cmocka.h>

Expand Down

0 comments on commit 4997d26

Please sign in to comment.