Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Test
run: bin/ci build

x86_64-gnu-test-preview_mt:
x86_64-gnu-test-execution-context-parallel:
env:
ARCH: x86_64
ARCH_CMD: linux64
Expand All @@ -88,7 +88,30 @@ jobs:
run: bin/ci with_build_env 'make crystal'

- name: Test
run: bin/ci with_build_env 'CRYSTAL_WORKERS=4 make std_spec threads=1 FLAGS="-D preview_mt"'
run: bin/ci with_build_env 'CRYSTAL_WORKERS=4 make std_spec threads=1 FLAGS="-Dexecution_context -Dpreview_mt"'

x86_64-gnu-test-execution-context-concurrent:
env:
ARCH: x86_64
ARCH_CMD: linux64
runs-on: ubuntu-latest
steps:
- name: Download Crystal source
uses: actions/checkout@v5
with:
persist-credentials: false

- name: Prepare System
run: bin/ci prepare_system

- name: Prepare Build
run: bin/ci prepare_build

- name: Make Crystal
run: bin/ci with_build_env 'make crystal'

- name: Test
run: bin/ci with_build_env 'CRYSTAL_WORKERS=1 make std_spec threads=1 FLAGS="-Dexecution_context -Dpreview_mt"'

check_format:
env:
Expand Down
6 changes: 6 additions & 0 deletions src/spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ module Spec
Process.on_terminate { abort! }
{% end %}

{% if Fiber.has_constant?(:ExecutionContext) && Fiber::ExecutionContext.class.has_method?(:current) %}
count = ENV["CRYSTAL_WORKERS"]?.try(&.to_i?) || 1
# FIXME: ExecutionContext.current should return ExecutionContext::Parallel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been fixed in #16367.

Fiber::ExecutionContext.current.as(Fiber::ExecutionContext::Parallel).resize(count)
{% end %}

run
end
end
Expand Down
Loading