diff --git a/.github/workflows/unix.yml b/.github/workflows/unix.yml index 926d10b..250e3a0 100644 --- a/.github/workflows/unix.yml +++ b/.github/workflows/unix.yml @@ -5,20 +5,16 @@ env: PKG_CONFIG_PATH: /usr/local/share/pkgconfig jobs: - c_macos: - name: macos-12 / C - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - - run: ./run.sh - - run: cd tests && CC=gcc-13 make && ./tests - c_linux: - name: ubuntu-22.04 / C - runs-on: ubuntu-22.04 + c: + name: ${{ matrix.os }} / C + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-12, ubuntu-22.04] steps: - uses: actions/checkout@v4 - run: ./run.sh - - run: cd tests && make && ./tests + - run: cd tests && CC=gcc-11 make && ./tests python: name: ${{ matrix.os }} / Python runs-on: ${{ matrix.os }} diff --git a/tests/tests.c b/tests/tests.c index e1e1cce..dc83095 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -5,7 +5,12 @@ #include #include -#ifndef __STDC_NO_THREADS__ +// The C compilers available on the macOS runners on GitHub Actions do not +// indicate their lack of support for standard threads with the expected +// preprocessor macro, so disable multithreading on macOS. +#if defined __APPLE__ || defined __STDC_NO_THREADS__ +#define STDC_NO_THREADS +#else #include #endif @@ -74,12 +79,12 @@ main(void) hdrbg_tests(hds[i], tv); rewind(tv); } -#ifndef __STDC_NO_THREADS__ +#ifndef STDC_NO_THREADS thrd_t workers[WORKERS_SIZE]; #endif for (int i = 0; i < WORKERS_SIZE; ++i) { -#ifndef __STDC_NO_THREADS__ +#ifndef STDC_NO_THREADS thrd_create(workers + i, hdrbg_tests_custom, hds[i]); #else hdrbg_tests_custom(hds[i]); @@ -87,7 +92,7 @@ main(void) } for (int i = 0; i < WORKERS_SIZE; ++i) { -#ifndef __STDC_NO_THREADS__ +#ifndef STDC_NO_THREADS thrd_join(workers[i], NULL); #endif hdrbg_zero(hds[i]);