From f5241700bf7183fa2722d7311c60c1c07962dd10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Kardos?= Date: Sun, 19 Nov 2023 11:17:12 +0100 Subject: [PATCH] ci (#1) --- .github/workflows/build_and_test.yml | 111 ++++++++ .github/workflows/clang_format.yml | 22 ++ .github/workflows/release.yml | 28 ++ .github/workflows/sonarqube.yml | 86 ++++++ CMakeLists.txt | 4 + sonar-project.properties | 11 + support/run-clang-format.py | 408 +++++++++++++++++++++++++++ support/update-conan-profile.py | 18 ++ test/test_schedulers.hpp | 2 +- test/test_stream.cpp | 1 + test/test_task.cpp | 22 +- 11 files changed, 701 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build_and_test.yml create mode 100644 .github/workflows/clang_format.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/sonarqube.yml create mode 100644 sonar-project.properties create mode 100644 support/run-clang-format.py create mode 100644 support/update-conan-profile.py diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 0000000..51c0d51 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,111 @@ +name: Build & test + +on: + push: + branches: + - master + tags: + - v**.** + pull_request: + branches: + - master + +jobs: + build-test: + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest] + c_compiler: [gcc, clang, cl] + build_type: [Debug, Release] + cxx_standard: ["20"] + include: + - c_compiler: gcc + cxx_compiler: g++ + - c_compiler: clang + cxx_compiler: clang++ + - c_compiler: cl + cxx_compiler: cl + - os: windows-latest + binary_ext: ".exe" + - os: ubuntu-latest + binary_ext: "" + - build_type: Debug + conan_preset: "conan-debug" + - build_type: Release + conan_preset: "conan-release" + exclude: + - os: windows-latest + c_compiler: gcc + - os: windows-latest + c_compiler: clang + - os: ubuntu-latest + c_compiler: cl + + name: ${{ matrix.c_compiler }} - ${{ matrix.build_type }} - ${{ matrix.os }} - c++${{ matrix.cxx_standard }} + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v4 + - uses: seanmiddleditch/gha-setup-ninja@v4 + - uses: seanmiddleditch/gha-setup-vsdevenv@master + - uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + directory: ${{ runner.temp }}/llvm + + - name: Install GCC + shell: bash + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt update + sudo apt install gcc-13 g++-13 + sudo update-alternatives --remove-all gcc || true + sudo update-alternatives --remove-all g++ || true + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13 + + - name: Install conan + shell: bash + env: + CC: "${{ matrix.c_compiler != 'cl' && matrix.c_compiler || '' }}" + CXX: "${{ matrix.cxx_compiler != 'cl' && matrix.cxx_compiler || '' }}" + run: | + pip install conan + conan profile detect --name ci --force + python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) ${{matrix.build_type}} ${{matrix.c_compiler}} ${{matrix.cxx_compiler}} ${{matrix.cxx_standard}} + + - name: Cache conan packages + id: cache-conan + uses: actions/cache@v3 + with: + path: ~/.conan2/p + key: conan-cache-packages-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ matrix.cxx_standard }} + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + env: + CC: ${{matrix.c_compiler}} + CXX: ${{matrix.cxx_compiler}} + run: | + conan install $GITHUB_WORKSPACE --output-folder=. --build="*" -pr ci -pr:b ci -s build_type=${{ matrix.build_type }} + conan cache clean + cmake $GITHUB_WORKSPACE --preset ${{ matrix.conan_preset }} + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: | + cmake --build ./build/${{ matrix.build_type }} + cmake -E make_directory ${{runner.workspace}}/installation/SEDManager + cmake --install ./build/${{ matrix.build_type }} --prefix '${{runner.workspace}}/installation/SEDManager' + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + run: ./build/${{ matrix.build_type }}/bin/test diff --git a/.github/workflows/clang_format.yml b/.github/workflows/clang_format.yml new file mode 100644 index 0000000..17776e7 --- /dev/null +++ b/.github/workflows/clang_format.yml @@ -0,0 +1,22 @@ +name: Clang-Format +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + - uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + directory: ${{ runner.temp }}/llvm + - name: Verify formatting + run: | + python ./support/run-clang-format.py -r src + python ./support/run-clang-format.py -r test \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0ad3d15 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release + +on: + workflow_run: + workflows: [Build & test] + branches: [v**.**] + types: [completed] + +jobs: + create_release: + permissions: + actions: read + contents: write + env: + GH_TOKEN: ${{ github.token }} + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch != null }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_branch }} + + - name: Create release + shell: bash + run: | + gh release create ${{ github.event.workflow_run.head_branch }} + + \ No newline at end of file diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000..f369031 --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,86 @@ +name: SonarQube +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + runs-on: ubuntu-latest + env: + SONAR_SCANNER_VERSION: 4.4.0.2170 + SONAR_SERVER_URL: "https://sonarcloud.io" + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: seanmiddleditch/gha-setup-ninja@v4 + - uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + directory: ${{ runner.temp }}/llvm + + - name: Install GCC + shell: bash + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt update + sudo apt install gcc-13 g++-13 + sudo update-alternatives --remove-all gcc || true + sudo update-alternatives --remove-all g++ || true + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13 + + - name: Install conan + shell: bash + env: + CC: clang + CXX: clang++ + run: | + pip install conan + conan profile detect --name ci --force + python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) Debug $CC $CXX 20 + + - name: Cache conan packages + id: cache-conan + uses: actions/cache@v3 + with: + path: ~/.conan2/p + key: conan-cache-packages-sonarqube + + - name: Install sonar-scanner and build-wrapper + uses: SonarSource/sonarcloud-github-c-cpp@v2 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + env: + CC: clang + CXX: clang++ + run: | + conan install $GITHUB_WORKSPACE --output-folder=. --build="*" -pr ci -pr:b ci -s build_type=Debug + conan cache clean + cmake $GITHUB_WORKSPACE --preset conan-debug -DENABLE_LLVM_COV:BOOL=ON + + - name: Run build-wrapper + run: | + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build ${{runner.workspace}}/build/build/Debug --clean-first + + - name: Generate Test and Code Coverage + working-directory: ${{runner.workspace}}/build + shell: bash + run: | + ./build/Debug/bin/test --reporter junit --out ${{runner.workspace}}/build/tests.xml + llvm-profdata merge -sparse default.profraw -o coverage.profdata + llvm-cov show ./build/Debug/bin/test -instr-profile=coverage.profdata > ${{runner.workspace}}/build/coverage.txt + + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index cfe13fc..4f96b23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,10 @@ option(ENABLE_LLVM_ADDRESS_SANITIZER OFF) option(ENABLE_LLVM_MEMORY_SANITIZER OFF) option(ENABLE_LLVM_THREAD_SANITIZER OFF) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") + if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if (ENABLE_LLVM_COV) message("Using source-based coverage") diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..4cb8de2 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.projectKey=petiaccja_asyncpp +sonar.organization=petiaccja + +sonar.projectName=asyncpp + +sonar.sources=./src,./include +#sonar.exclusions= + +sonar.cfamily.llvm-cov.reportPath=../build/coverage.txt +sonar.junit.reportPaths=../build/tests.xml +sonar.cfamily.threads=4 \ No newline at end of file diff --git a/support/run-clang-format.py b/support/run-clang-format.py new file mode 100644 index 0000000..dcabaf1 --- /dev/null +++ b/support/run-clang-format.py @@ -0,0 +1,408 @@ +#!/usr/bin/env python +"""A wrapper script around clang-format, suitable for linting multiple files +and to use for continuous integration. + +This is an alternative API for the clang-format command line. +It runs over multiple files and directories in parallel. +A diff output is produced and a sensible exit code is returned. + +""" + +from __future__ import print_function, unicode_literals + +import argparse +import codecs +import difflib +import fnmatch +import io +import errno +import multiprocessing +import os +import signal +import subprocess +import sys +import traceback + +from functools import partial + +try: + from subprocess import DEVNULL # py3k +except ImportError: + DEVNULL = open(os.devnull, "wb") + + +DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx' +DEFAULT_CLANG_FORMAT_IGNORE = '.clang-format-ignore' + + +class ExitStatus: + SUCCESS = 0 + DIFF = 1 + TROUBLE = 2 + +def excludes_from_file(ignore_file): + excludes = [] + try: + with io.open(ignore_file, 'r', encoding='utf-8') as f: + for line in f: + if line.startswith('#'): + # ignore comments + continue + pattern = line.rstrip() + if not pattern: + # allow empty lines + continue + excludes.append(pattern) + except EnvironmentError as e: + if e.errno != errno.ENOENT: + raise + return excludes; + +def list_files(files, recursive=False, extensions=None, exclude=None): + if extensions is None: + extensions = [] + if exclude is None: + exclude = [] + + out = [] + for file in files: + if recursive and os.path.isdir(file): + for dirpath, dnames, fnames in os.walk(file): + fpaths = [os.path.join(dirpath, fname) for fname in fnames] + for pattern in exclude: + # os.walk() supports trimming down the dnames list + # by modifying it in-place, + # to avoid unnecessary directory listings. + dnames[:] = [ + x for x in dnames + if + not fnmatch.fnmatch(os.path.join(dirpath, x), pattern) + ] + fpaths = [ + x for x in fpaths if not fnmatch.fnmatch(x, pattern) + ] + for f in fpaths: + ext = os.path.splitext(f)[1][1:] + if ext in extensions: + out.append(f) + else: + out.append(file) + return out + + +def make_diff(file, original, reformatted): + return list( + difflib.unified_diff( + original, + reformatted, + fromfile='{}\t(original)'.format(file), + tofile='{}\t(reformatted)'.format(file), + n=3)) + + +class DiffError(Exception): + def __init__(self, message, errs=None): + super(DiffError, self).__init__(message) + self.errs = errs or [] + + +class UnexpectedError(Exception): + def __init__(self, message, exc=None): + super(UnexpectedError, self).__init__(message) + self.formatted_traceback = traceback.format_exc() + self.exc = exc + + +def run_clang_format_diff_wrapper(args, file): + try: + ret = run_clang_format_diff(args, file) + return ret + except DiffError: + raise + except Exception as e: + raise UnexpectedError('{}: {}: {}'.format(file, e.__class__.__name__, + e), e) + + +def run_clang_format_diff(args, file): + try: + with io.open(file, 'r', encoding='utf-8') as f: + original = f.readlines() + except IOError as exc: + raise DiffError(str(exc)) + + if args.in_place: + invocation = [args.clang_format_executable, '-i', file] + else: + invocation = [args.clang_format_executable, file] + + if args.style: + invocation.extend(['--style', args.style]) + + if args.dry_run: + print(" ".join(invocation)) + return [], [] + + # Use of utf-8 to decode the process output. + # + # Hopefully, this is the correct thing to do. + # + # It's done due to the following assumptions (which may be incorrect): + # - clang-format will returns the bytes read from the files as-is, + # without conversion, and it is already assumed that the files use utf-8. + # - if the diagnostics were internationalized, they would use utf-8: + # > Adding Translations to Clang + # > + # > Not possible yet! + # > Diagnostic strings should be written in UTF-8, + # > the client can translate to the relevant code page if needed. + # > Each translation completely replaces the format string + # > for the diagnostic. + # > -- http://clang.llvm.org/docs/InternalsManual.html#internals-diag-translation + # + # It's not pretty, due to Python 2 & 3 compatibility. + encoding_py3 = {} + if sys.version_info[0] >= 3: + encoding_py3['encoding'] = 'utf-8' + + try: + proc = subprocess.Popen( + invocation, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True, + **encoding_py3) + except OSError as exc: + raise DiffError( + "Command '{}' failed to start: {}".format( + subprocess.list2cmdline(invocation), exc + ) + ) + proc_stdout = proc.stdout + proc_stderr = proc.stderr + if sys.version_info[0] < 3: + # make the pipes compatible with Python 3, + # reading lines should output unicode + encoding = 'utf-8' + proc_stdout = codecs.getreader(encoding)(proc_stdout) + proc_stderr = codecs.getreader(encoding)(proc_stderr) + # hopefully the stderr pipe won't get full and block the process + outs = list(proc_stdout.readlines()) + errs = list(proc_stderr.readlines()) + proc.wait() + if proc.returncode: + raise DiffError( + "Command '{}' returned non-zero exit status {}".format( + subprocess.list2cmdline(invocation), proc.returncode + ), + errs, + ) + if args.in_place: + return [], errs + return make_diff(file, original, outs), errs + + +def bold_red(s): + return '\x1b[1m\x1b[31m' + s + '\x1b[0m' + + +def colorize(diff_lines): + def bold(s): + return '\x1b[1m' + s + '\x1b[0m' + + def cyan(s): + return '\x1b[36m' + s + '\x1b[0m' + + def green(s): + return '\x1b[32m' + s + '\x1b[0m' + + def red(s): + return '\x1b[31m' + s + '\x1b[0m' + + for line in diff_lines: + if line[:4] in ['--- ', '+++ ']: + yield bold(line) + elif line.startswith('@@ '): + yield cyan(line) + elif line.startswith('+'): + yield green(line) + elif line.startswith('-'): + yield red(line) + else: + yield line + + +def print_diff(diff_lines, use_color): + if use_color: + diff_lines = colorize(diff_lines) + if sys.version_info[0] < 3: + sys.stdout.writelines((l.encode('utf-8') for l in diff_lines)) + else: + sys.stdout.writelines(diff_lines) + + +def print_trouble(prog, message, use_colors): + error_text = 'error:' + if use_colors: + error_text = bold_red(error_text) + print("{}: {} {}".format(prog, error_text, message), file=sys.stderr) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + '--clang-format-executable', + metavar='EXECUTABLE', + help='path to the clang-format executable', + default='clang-format') + parser.add_argument( + '--extensions', + help='comma separated list of file extensions (default: {})'.format( + DEFAULT_EXTENSIONS), + default=DEFAULT_EXTENSIONS) + parser.add_argument( + '-r', + '--recursive', + action='store_true', + help='run recursively over directories') + parser.add_argument( + '-d', + '--dry-run', + action='store_true', + help='just print the list of files') + parser.add_argument( + '-i', + '--in-place', + action='store_true', + help='format file instead of printing differences') + parser.add_argument('files', metavar='file', nargs='+') + parser.add_argument( + '-q', + '--quiet', + action='store_true', + help="disable output, useful for the exit code") + parser.add_argument( + '-j', + metavar='N', + type=int, + default=0, + help='run N clang-format jobs in parallel' + ' (default number of cpus + 1)') + parser.add_argument( + '--color', + default='auto', + choices=['auto', 'always', 'never'], + help='show colored diff (default: auto)') + parser.add_argument( + '-e', + '--exclude', + metavar='PATTERN', + action='append', + default=[], + help='exclude paths matching the given glob-like pattern(s)' + ' from recursive search') + parser.add_argument( + '--style', + help='formatting style to apply (LLVM, Google, Chromium, Mozilla, WebKit)') + + args = parser.parse_args() + + # use default signal handling, like diff return SIGINT value on ^C + # https://bugs.python.org/issue14229#msg156446 + signal.signal(signal.SIGINT, signal.SIG_DFL) + try: + signal.SIGPIPE + except AttributeError: + # compatibility, SIGPIPE does not exist on Windows + pass + else: + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + + colored_stdout = False + colored_stderr = False + if args.color == 'always': + colored_stdout = True + colored_stderr = True + elif args.color == 'auto': + colored_stdout = sys.stdout.isatty() + colored_stderr = sys.stderr.isatty() + + version_invocation = [args.clang_format_executable, str("--version")] + try: + subprocess.check_call(version_invocation, stdout=DEVNULL) + except subprocess.CalledProcessError as e: + print_trouble(parser.prog, str(e), use_colors=colored_stderr) + return ExitStatus.TROUBLE + except OSError as e: + print_trouble( + parser.prog, + "Command '{}' failed to start: {}".format( + subprocess.list2cmdline(version_invocation), e + ), + use_colors=colored_stderr, + ) + return ExitStatus.TROUBLE + + retcode = ExitStatus.SUCCESS + + excludes = excludes_from_file(DEFAULT_CLANG_FORMAT_IGNORE) + excludes.extend(args.exclude) + + files = list_files( + args.files, + recursive=args.recursive, + exclude=excludes, + extensions=args.extensions.split(',')) + + if not files: + return + + njobs = args.j + if njobs == 0: + njobs = multiprocessing.cpu_count() + 1 + njobs = min(len(files), njobs) + + if njobs == 1: + # execute directly instead of in a pool, + # less overhead, simpler stacktraces + it = (run_clang_format_diff_wrapper(args, file) for file in files) + pool = None + else: + pool = multiprocessing.Pool(njobs) + it = pool.imap_unordered( + partial(run_clang_format_diff_wrapper, args), files) + pool.close() + while True: + try: + outs, errs = next(it) + except StopIteration: + break + except DiffError as e: + print_trouble(parser.prog, str(e), use_colors=colored_stderr) + retcode = ExitStatus.TROUBLE + sys.stderr.writelines(e.errs) + except UnexpectedError as e: + print_trouble(parser.prog, str(e), use_colors=colored_stderr) + sys.stderr.write(e.formatted_traceback) + retcode = ExitStatus.TROUBLE + # stop at the first unexpected error, + # something could be very wrong, + # don't process all files unnecessarily + if pool: + pool.terminate() + break + else: + sys.stderr.writelines(errs) + if outs == []: + continue + if not args.quiet: + print_diff(outs, use_color=colored_stdout) + if retcode == ExitStatus.SUCCESS: + retcode = ExitStatus.DIFF + if pool: + pool.join() + return retcode + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/support/update-conan-profile.py b/support/update-conan-profile.py new file mode 100644 index 0000000..bf5e0d9 --- /dev/null +++ b/support/update-conan-profile.py @@ -0,0 +1,18 @@ +import pathlib +import sys +import re + +path = pathlib.Path(sys.argv[1]) +build_type = sys.argv[2] +c_compiler = sys.argv[3] +cxx_compiler = sys.argv[4] +cxx_standard = sys.argv[5] + +text = path.read_text() +text = re.sub("build_type=.*", f"build_type={build_type}", text) +text = re.sub("compiler.cppstd=.*", f"compiler.cppstd={cxx_standard}", text) +text = text + "\n[conf]" +text = text + f"\ntools.build:compiler_executables={{\"cpp\": \"{cxx_compiler}\", \"c\": \"{ c_compiler }\"}}" +text = text + "\ntools.cmake.cmaketoolchain:generator=Ninja" +path.unlink() +path.write_text(text) \ No newline at end of file diff --git a/test/test_schedulers.hpp b/test/test_schedulers.hpp index fabae44..471627d 100644 --- a/test/test_schedulers.hpp +++ b/test/test_schedulers.hpp @@ -1,8 +1,8 @@ #pragma once +#include #include #include -#include #include diff --git a/test/test_stream.cpp b/test/test_stream.cpp index e6e9a7b..0e7a182 100644 --- a/test/test_stream.cpp +++ b/test/test_stream.cpp @@ -1,4 +1,5 @@ #include "leak_tester.hpp" + #include #include diff --git a/test/test_task.cpp b/test/test_task.cpp index af5be2b..330c20a 100644 --- a/test/test_task.cpp +++ b/test/test_task.cpp @@ -1,8 +1,8 @@ #include "leak_tester.hpp" #include "test_schedulers.hpp" -#include #include +#include #include @@ -15,21 +15,21 @@ TEST_CASE("Task: interleaving sync", "[Task]") { struct fixture { thread_locked_scheduler sched; - task task; + task main_task; }; leak_tester tester; auto make_fixture = [&tester] { auto f = std::make_shared(); - f->task = do_task(tester); - bind(f->task, f->sched); + f->main_task = do_task(tester); + bind(f->main_task, f->sched); return f; }; auto sync_thread = [](std::shared_ptr f) { - f->task.launch(); - f->task.get(); + f->main_task.launch(); + f->main_task.get(); }; auto task_thread = [](std::shared_ptr f) { INTERLEAVED_ACQUIRE(f->sched.wait_and_resume()); @@ -103,21 +103,21 @@ TEST_CASE("Task: interleaving abandon", "[Task]") { struct fixture { thread_locked_scheduler sched; - task task; + task main_task; }; leak_tester tester; auto make_fixture = [&tester] { auto f = std::make_shared(); - f->task = do_task(tester); - bind(f->task, f->sched); + f->main_task = do_task(tester); + bind(f->main_task, f->sched); return f; }; auto sync_thread = [](std::shared_ptr f) { - f->task.launch(); - f->task = {}; + f->main_task.launch(); + f->main_task = {}; }; auto task_thread = [](std::shared_ptr f) { INTERLEAVED_ACQUIRE(f->sched.wait_and_resume());