Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Upstream Test Mapping

Perl5 Test Suite

The perl5 source tree (perl5-upstream/t/) contains thousands of tests organized by category:

perl5-upstream/t/
  base/     - Fundamental tests
  cmd/      - Control flow
  comp/     - Compilation
  io/       - I/O operations
  op/       - Operators
  re/       - Regular expressions
  run/      - Running perl
  uni/      - Unicode
  lib/      - Library/module tests
  ...

Mapping to PetaPerl Tests

PetaPerl’s test directories correspond to perl5-upstream categories, though the mapping is not 1:1:

perl5-upstreamPetaPerlNotes
t/base/00-base/Fundamental tests
t/comp/01-parsing/Compilation/parsing
t/op/05-op/Operators
t/cmd/10-cmd/Control flow
t/io/55-io/I/O operations
t/re/25-regex/Regular expressions
t/uni/22-unicode/Unicode handling
t/lib/70-core-tier*/Module tests

Porting Process

When porting a test from perl5-upstream:

  1. Convert to raw TAP: Remove use Test::More, use test.pl, and other test framework dependencies. Replace with inline ok sub and print "1..N\n" plan.

  2. Suffix with -perl5.t: Indicates the test originated from perl5-upstream.

  3. Add source comment: Document where the test came from:

    # Ported from perl5-upstream/t/op/arith.t
    
  4. Verify under both runtimes: Run with t/TEST and confirm both perl5 and pperl produce identical output.

  5. Handle unsupported features: If the test uses features pperl doesn’t support, either:

    • Skip those specific subtests with comments explaining why
    • Split the test to separate supported from unsupported portions

re_tests

The regex engine has a specialized test suite based on perl5’s re_tests format. PetaPerl passes 1959/1972 tests (99.3% of perl5-passing tests). The 13 remaining failures are in:

  • Self-referential captures (3 tests)
  • local in code blocks (2 tests)
  • Multi-character case folding (2 tests)
  • Branch reset references (5 tests)
  • String interpolation edge case (1 test)

Coverage Philosophy

PetaPerl does not aim to run the entire perl5 test suite verbatim. Instead:

  • Port selectively: Focus on tests that cover features pperl implements
  • Write new tests: For pperl-specific features (JIT, parallelization, daemon mode)
  • Conformance over coverage: A smaller set of passing tests is better than a large set with many expected failures