diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c5b4e87..917be21b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,16 +6,28 @@ on: - cron: '3 20 * * SUN' permissions: {} jobs: + # The -m32 variants build and test as 32-bit. ssize_t and long are 32 bits + # wide on i686, which exposes signedness and range problems that the 64-bit + # builds cannot see. The flag goes in CC rather than CFLAGS so that the + # libtap build, which has its own Makefile, and the test scripts that + # compile code themselves pick it up too. CFLAGS must stay out of the job + # environment: when it is set, even empty, make exports the configured + # CFLAGS to libtap, and libtap does not build on macOS with _POSIX_C_SOURCE. test-autoconf: strategy: matrix: os: [ubuntu-latest, macos-latest] cc: [gcc, clang] posix: ['', -D_POSIX_C_SOURCE=200112L] - name: Autotools build on ${{matrix.os}} using ${{matrix.cc}} ${{matrix.posix}} + arch: ['', -m32] + exclude: + - os: macos-latest + arch: -m32 + name: Autotools build on ${{matrix.os}} using ${{matrix.cc}} ${{matrix.posix}} ${{matrix.arch}} runs-on: ${{ matrix.os }} env: - CC: ${{ matrix.cc }} + CC: ${{ matrix.cc }} ${{ matrix.arch }} + CXXFLAGS: ${{ matrix.arch }} VERBOSE: 1 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -24,6 +36,8 @@ jobs: persist-credentials: false - run: sudo apt install libipc-run3-perl if: ${{ matrix.os == 'ubuntu-latest' }} + - run: sudo apt-get update && sudo apt-get install -y gcc-multilib g++-multilib + if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == '-m32' }} - run: brew install autoconf automake libtool if: ${{ matrix.os == 'macos-latest' }} - run: ./bootstrap diff --git a/t/decoder_limits_t.pl b/t/decoder_limits_t.pl index 3284565e..0d9c05f5 100755 --- a/t/decoder_limits_t.pl +++ b/t/decoder_limits_t.pl @@ -21,14 +21,16 @@ my $root = abs_path("$Bin/.."); my $include_dir = "$root/include"; my $src_dir = "$root/src"; -my $cc = $ENV{CC} || 'cc'; + +# CC may carry flags, such as CC="gcc -m32". +my @cc = split ' ', $ENV{CC} || 'cc'; # The checks below rebuild the library with -Werror. Only gcc and clang are # known to compile it cleanly with the flags used here, so skip elsewhere # instead of failing on a missing compiler or an unrelated warning. my ( $cc_version, $cc_stderr ) = ( q{}, q{} ); my $cc_status = eval { - run3( [ $cc, '--version' ], \undef, \$cc_version, \$cc_stderr ); + run3( [ @cc, '--version' ], \undef, \$cc_version, \$cc_stderr ); $?; }; $cc_version .= $cc_stderr; @@ -44,7 +46,7 @@ map { split ' ' } grep { defined } @ENV{ 'CFLAGS', 'LDFLAGS' }; my @base = ( - $cc, + @cc, @instrumentation, '-std=c99', '-Wall',