Skip to content

Commit

Permalink
Disabled multithreading in macOS tests. Reverted 54206ae.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Apr 25, 2024
1 parent 54206ae commit b84b5d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
13 changes: 9 additions & 4 deletions tests/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
#include <stddef.h>
#include <stdio.h>

#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 <threads.h>
#endif

Expand Down Expand Up @@ -74,20 +79,20 @@ 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]);
#endif
}
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]);
Expand Down

0 comments on commit b84b5d7

Please sign in to comment.