diff --git a/.github/workflows/interpreter.yml b/.github/workflows/interpreter.yml index a034a9f5b410..41320ce1d74d 100644 --- a/.github/workflows/interpreter.yml +++ b/.github/workflows/interpreter.yml @@ -42,12 +42,12 @@ jobs: test-interpreter-std_spec: needs: build-interpreter runs-on: ubuntu-22.04 + timeout-minutes: 90 container: image: crystallang/crystal:1.10.1-build - strategy: - matrix: - part: [0, 1, 2, 3] - name: "Test std_spec with interpreter (${{ matrix.part }})" + env: + HANDLE_SIGNAL_IN_INTERPRETER: "1" + name: "Test std_spec with interpreter" steps: - uses: actions/checkout@v4 @@ -61,4 +61,19 @@ jobs: run: chmod +x .build/crystal - name: Run std_spec with interpreter - run: SPEC_SPLIT="${{ matrix.part }}%4" bin/crystal i spec/interpreter_std_spec.cr -- --junit_output .junit/interpreter-std_spec.${{ matrix.part }}.xml + shell: bash + run: | + set -e + export HANDLE_SIGNAL_IN_INTERPRETER=1 + status=0 + for part in $(seq 0 15); do + echo "Running part ${part} of 15" + timeout 900 env SPEC_SPLIT="${part}%16" bin/crystal i spec/interpreter_std_spec.cr -- --junit_output .junit/interpreter-std_spec.${part}.xml 2> /dev/null + job_status=$? + echo $job_status + if [ $job_status -ne 0 ]; then + status=$job_status + fi + done + echo "final status: ${status}" + exit $status diff --git a/spec/generate_interpreter_spec.sh b/spec/generate_interpreter_spec.sh index f3500115a737..4e847bb53dd3 100755 --- a/spec/generate_interpreter_spec.sh +++ b/spec/generate_interpreter_spec.sh @@ -11,6 +11,9 @@ set +x export SPEC_SUITE=$1 export OUT_FILE=$2 export CRYSTAL_BIN=${CRYSTAL_BIN:-./bin/crystal} +# Enable signal handlers in interpreted code +export HANDLE_SIGNAL_IN_INTERPRETER=1 + job_size=${3:-64} command="$0 $*" diff --git a/spec/interpreter_std_spec.cr b/spec/interpreter_std_spec.cr index 6ca5aeac2ea3..a4c8dc1738b0 100644 --- a/spec/interpreter_std_spec.cr +++ b/spec/interpreter_std_spec.cr @@ -1,4 +1,4 @@ -# 2023-04-12 22:54:02-05:00 This file is autogenerated by `spec/generate_interpreter_spec.sh std spec/interpreter_std_spec.cr` +# 2023-11-23 20:33:13-06:00 This file is autogenerated by `spec/generate_interpreter_spec.sh std spec/interpreter_std_spec.cr 4` require "./std/array_spec.cr" require "./std/atomic_spec.cr" require "./std/base64_spec.cr" @@ -62,7 +62,7 @@ require "./std/digest/md5_spec.cr" require "./std/digest/sha1_spec.cr" require "./std/digest/sha256_spec.cr" require "./std/digest/sha512_spec.cr" -# require "./std/dir_spec.cr" (failed to run) +require "./std/dir_spec.cr" require "./std/double_spec.cr" require "./std/ecr/ecr_lexer_spec.cr" require "./std/ecr/ecr_spec.cr" @@ -70,8 +70,8 @@ require "./std/enumerable_spec.cr" require "./std/enum_spec.cr" require "./std/env_spec.cr" require "./std/errno_spec.cr" -# require "./std/exception/call_stack_spec.cr" (failed to run) -# require "./std/exception_spec.cr" (failed to run) +require "./std/exception/call_stack_spec.cr" +require "./std/exception_spec.cr" require "./std/file_spec.cr" require "./std/file/tempfile_spec.cr" require "./std/file_utils_spec.cr" @@ -114,7 +114,7 @@ require "./std/io/argf_spec.cr" require "./std/io/buffered_spec.cr" require "./std/io/byte_format_spec.cr" require "./std/io/delimited_spec.cr" -# require "./std/io/file_descriptor_spec.cr" (failed to run) +require "./std/io/file_descriptor_spec.cr" require "./std/io/hexdump_spec.cr" require "./std/io/io_spec.cr" require "./std/io/memory_spec.cr" @@ -129,7 +129,7 @@ require "./std/json/parser_spec.cr" require "./std/json/pull_parser_spec.cr" require "./std/json/serializable_spec.cr" require "./std/json/serialization_spec.cr" -# require "./std/kernel_spec.cr" (failed to run) +require "./std/kernel_spec.cr" require "./std/levenshtein_spec.cr" # require "./std/llvm/aarch64_spec.cr" (failed to run) # require "./std/llvm/arm_abi_spec.cr" (failed to run) @@ -183,7 +183,7 @@ require "./std/pointer_spec.cr" require "./std/pp_spec.cr" require "./std/pretty_print_spec.cr" require "./std/process/find_executable_spec.cr" -# require "./std/process_spec.cr" (failed to run) +require "./std/process_spec.cr" require "./std/process/status_spec.cr" require "./std/process/utils_spec.cr" require "./std/proc_spec.cr" @@ -231,7 +231,7 @@ require "./std/symbol_spec.cr" # require "./std/syscall_spec.cr" (failed to run) require "./std/system_error_spec.cr" require "./std/system/group_spec.cr" -# require "./std/system_spec.cr" (failed to run) +require "./std/system_spec.cr" require "./std/system/user_spec.cr" require "./std/thread/condition_variable_spec.cr" require "./std/thread/mutex_spec.cr" diff --git a/spec/std/time/format_spec.cr b/spec/std/time/format_spec.cr index c6f8dc9b03bf..0d84749991e2 100644 --- a/spec/std/time/format_spec.cr +++ b/spec/std/time/format_spec.cr @@ -1,4 +1,5 @@ require "../spec_helper" +require "../../support/time" require "spec/helpers/string" def parse_time(format, string) diff --git a/spec/std/time/time_spec.cr b/spec/std/time/time_spec.cr index d257bc70f2d4..bfae4900705e 100644 --- a/spec/std/time/time_spec.cr +++ b/spec/std/time/time_spec.cr @@ -1,4 +1,5 @@ require "../spec_helper" +require "../../support/time" require "spec/helpers/iterate" CALENDAR_WEEK_TEST_DATA = [ diff --git a/src/crystal/system/unix/signal.cr b/src/crystal/system/unix/signal.cr index c30a2b985af2..4d3aed4d984d 100644 --- a/src/crystal/system/unix/signal.cr +++ b/src/crystal/system/unix/signal.cr @@ -56,7 +56,7 @@ module Crystal::System::Signal end end - private def self.start_loop + def self.start_loop spawn(name: "Signal Loop") do loop do value = reader.read_bytes(Int32) diff --git a/src/kernel.cr b/src/kernel.cr index c3b3106ccae3..140ae7384d12 100644 --- a/src/kernel.cr +++ b/src/kernel.cr @@ -590,3 +590,10 @@ end Crystal::Scheduler.init_workers {% end %} {% end %} + +{% if flag?(:interpreted) %} + if ENV["HANDLE_SIGNAL_IN_INTERPRETER"]? == "1" + Signal::CHLD.reset + Crystal::System::Signal.start_loop + end +{% end %}