Skip to content

Commit 5999952

Browse files
Run 32-bit compiled unit tests on Ubuntu
1 parent 85b5cdd commit 5999952

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

.github/workflows/test.yaml

+18-3
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,30 @@ jobs:
4747
(github.event_name == 'pull_request' &&
4848
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) ||
4949
(github.event_name == 'workflow_dispatch' && github.event.inputs.test_linux == 'true')
50+
strategy:
51+
matrix:
52+
config:
53+
- arch_flags: -m32
54+
arch_suffix: :i386
55+
name: (32-bit)
56+
- arch_flags:
57+
arch_suffix:
58+
name: (64-bit)
59+
name: ubuntu ${{ matrix.config.name }}
5060
steps:
5161
- name: checkout
5262
uses: actions/checkout@v4
5363
- name: install libraries
54-
run: sudo apt-get update && sudo apt-get install -y libbrotli-dev libcurl4-openssl-dev
64+
run: |
65+
sudo dpkg --add-architecture i386
66+
sudo apt-get update
67+
sudo apt-get install -y libc6-dev${{ matrix.config.arch_suffix }} libstdc++-13-dev${{ matrix.config.arch_suffix }} \
68+
libssl-dev${{ matrix.config.arch_suffix }} libcurl4-openssl-dev${{ matrix.config.arch_suffix }} \
69+
zlib1g-dev${{ matrix.config.arch_suffix }} libbrotli-dev${{ matrix.config.arch_suffix }}
5570
- name: build and run tests
56-
run: cd test && make
71+
run: cd test && make EXTRA_CXXFLAGS="${{ matrix.config.arch_flags }}"
5772
- name: run fuzz test target
58-
run: cd test && make fuzz_test
73+
run: cd test && make EXTRA_CXXFLAGS="${{ matrix.config.arch_flags }}" fuzz_test
5974

6075
macos:
6176
runs-on: macos-latest

test/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CXX = clang++
2-
CXXFLAGS = -g -std=c++11 -I. -Wall -Wextra -Wtype-limits -Wconversion -Wshadow # -fno-exceptions -DCPPHTTPLIB_NO_EXCEPTIONS -fsanitize=address
2+
CXXFLAGS = -g -std=c++11 -I. -Wall -Wextra -Wtype-limits -Wconversion -Wshadow $(EXTRA_CXXFLAGS) # -fno-exceptions -DCPPHTTPLIB_NO_EXCEPTIONS -fsanitize=address
33

44
PREFIX ?= $(shell brew --prefix)
55

@@ -41,6 +41,7 @@ proxy : test_proxy
4141

4242
test : test.cc include_httplib.cc ../httplib.h Makefile cert.pem
4343
$(CXX) -o $@ -I.. $(CXXFLAGS) test.cc include_httplib.cc $(TEST_ARGS)
44+
@file $@
4445

4546
# Note: The intention of test_split is to verify that it works to compile and
4647
# link the split httplib.h, so there is normally no need to execute it.
@@ -83,6 +84,7 @@ fuzz_test: server_fuzzer
8384
# Fuzz target, so that you can choose which $(LIB_FUZZING_ENGINE) to use.
8485
server_fuzzer : fuzzing/server_fuzzer.cc ../httplib.h standalone_fuzz_target_runner.o
8586
$(CXX) -o $@ -I.. $(CXXFLAGS) $< $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) $(LIB_FUZZING_ENGINE) -pthread
87+
@file $@
8688

8789
# Standalone fuzz runner, which just reads inputs from fuzzing/corpus/ dir and
8890
# feeds it to server_fuzzer.

0 commit comments

Comments
 (0)