Preserve valid TAP when unsupported fork follows a fixed plan

オープン
#2,231 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, perl
領域
backend, testing

調査の方向性

Start by reading SystemOperator.fork() and the fixed-plan handling in Test::Builder, then trace how the fork handler decides whether to emit a whole-file skip plan. Add focused regression coverage for a fixed plan followed by unsupported fork() before the first assertion. Confirm valid TAP with the planned assertions skipped on JVM and interpreter, check standard Perl behavior, and rerun Test-UsedModules 0.03 Build test.

索引モデルが issue の本文から書いたものです。

説明

area:backend area:cpan-port area:runtime bug

Summary

When a test declares a fixed Test::More plan and then reaches PerlOnJava's unsupported fork(), the fork handler emits a second top-level 1..0 # SKIP plan and exits. The original plan has already been printed even when no assertions have run, so TAP is invalid. This breaks Test-UsedModules 0.03 t/02_self.t on both JVM and interpreter backends.

Reproduction

The archived CPAN run 20261129-192130-74689 reports:

  • t/00_compile.t and t/01_export_ok.t: pass.
  • t/02_self.t: fails with Parse errors: More than one plan found in TAP output and Bad plan. You planned 3 tests but ran 0.
  • t/03_succ.t and t/04_fail.t: explicitly skipped because fork is unsupported on the Java/JVM platform.

The failing test has this structure:

use Test::UsedModules;
use Test::More;

all_used_modules_ok();
done_testing;

all_used_modules_ok() calls its Test::Builder object's plan(tests => 3) before checking files. Its first check calls fork() before any assertion has run. PerlOnJava writes 1..3, then the unsupported-fork path writes 1..0 # SKIP fork() not supported on this platform (Java/JVM) to the same TAP stream. The TAP parser consequently rejects the file.

Root cause

SystemOperator.fork() uses current_test() == 0 to decide that it can emit a whole-file skip plan. That condition does not mean no TAP plan has been declared or printed: a fixed plan may already be active while the assertion count is still zero. The later fixed-plan handling fills remaining assertions with Test::Builder::skip(), but it is reached only after the zero-current-test branch.

The same failure was reproduced with the CPAN Build test command on JVM and interpreter backends. Direct execution of t/02_self.t on both backends emitted the two plans. System Perl's focused prove -Ilib t/02_self.t passed (3 tests), and the archived full system-Perl oracle passed all five files (23 tests).

Expected behavior

When a fixed plan is already active, unsupported fork() should preserve valid TAP by marking the remaining planned assertions skipped, including when zero assertions have run. It should not append a second top-level plan. Keep the existing whole-file skip behavior for tests that have emitted no plan.

Acceptance evidence

  • Add focused regression coverage for a fixed Test::More plan followed by unsupported fork() before the first assertion.
  • Confirm the TAP is valid and the planned assertions are represented as skipped on JVM and interpreter.
  • Validate the test's standard-Perl behavior with system Perl.
  • Re-run Test-UsedModules 0.03 Build test; the two fork-only files may remain intentionally skipped, but t/02_self.t should no longer fail TAP parsing.

This is a TAP handling defect around an unsupported operation; it does not request implementing fork().

Related qualification tracker: #1646. That tracker records unsupported-fork exclusions but does not cover this invalid-TAP case.

主要言語
Perl
スター
67
フォーク
9
平均マージ
6時間 45分
マージ済み PR(30日)
104

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fglock/PerlOnJava のほかの issue

fglock/PerlOnJava の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。