Skip to content

Commit dde0383

Browse files
author
José Valim
committed
Execute test runner in a separate process instead of the parallel require
1 parent 8c3ba08 commit dde0383

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

lib/elixir/lib/kernel/parallel_require.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ defmodule Kernel.ParallelRequire do
3232
:ok ->
3333
result
3434
:error ->
35-
IO.puts :stderr, "\nLoading files failed due to warnings while using the --warnings-as-errors option"
35+
IO.puts :stderr, "\nExecution failed due to warnings while using the --warnings-as-errors option"
3636
exit({:shutdown, 1})
3737
end
3838
end

lib/elixir/test/elixir/kernel/parallel_require_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defmodule Kernel.ParallelRequireTest do
1717
assert catch_exit(Kernel.ParallelRequire.files fixtures) == {:shutdown, 1}
1818
end
1919

20-
assert msg =~ "Loading files failed due to warnings while using the --warnings-as-errors option\n"
20+
assert msg =~ "Execution failed due to warnings while using the --warnings-as-errors option\n"
2121
after
2222
Code.compiler_options(warnings_as_errors: warnings_as_errors)
2323
end

lib/mix/lib/mix/compilers/test.ex

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,15 @@ defmodule Mix.Compilers.Test do
4242

4343
test_files ->
4444
try do
45-
spawn_link(fn ->
46-
try do
47-
Kernel.ParallelRequire.files(test_files, parallel_require_callbacks)
48-
catch
49-
:error, value ->
50-
exit({value, System.stacktrace()})
51-
:throw, value ->
52-
exit({{:nocatch, value}, System.stacktrace()})
53-
after
54-
ExUnit.Server.cases_loaded()
55-
end
56-
end)
57-
58-
%{failures: failures} = results = ExUnit.run()
45+
task = Task.async(ExUnit, :run, [])
46+
47+
try do
48+
Kernel.ParallelRequire.files(test_files, parallel_require_callbacks)
49+
after
50+
ExUnit.Server.cases_loaded()
51+
end
52+
53+
%{failures: failures} = results = Task.await(task, :infinity)
5954

6055
if failures == 0 do
6156
agent_write_manifest(stale_manifest_pid)

0 commit comments

Comments
 (0)