Skip to content

test: golden-corpus + zstd-jni interop coverage#3

Merged
dfa1 merged 2 commits into
mainfrom
test/golden-corpus-integration
Jun 26, 2026
Merged

test: golden-corpus + zstd-jni interop coverage#3
dfa1 merged 2 commits into
mainfrom
test/golden-corpus-integration

Conversation

@dfa1

@dfa1 dfa1 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What

Two new integration-test files plus a CLAUDE.md correction.

GoldenCorpusTest

Drives zstd's own vendored corpus under third_party/zstd/tests/ (canonical, version-matched fixtures from the submodule):

  • golden-compression — round-trip raw inputs across the FFM/JNI boundary both directions
  • golden-decompression — decode known-good frames; java output must equal the zstd-jni reference
  • golden-decompression-errors — malformed frames must be rejected

Submodule-gated (walks up for the dir, empty stream if absent), so shallow clones still build.

ZstdInteropExtrasTest

Closes interop gaps the round-trip suite missed:

  • Checksum — write/verify both directions + corrupt-payload rejection
  • Skippable frames — jni stream skips a java-written skippable frame; java parses its own skippable header
  • Multi-frame concat — streaming decode of joined frames both ways
  • Frame-header read — java reads content size + dict id from jni-produced frames
  • Chunked streaming — driven 7 bytes at a time with flushes, across a payload spread

CLAUDE.md

Fix stale claim: the integration reference is zstd-jni (luben, the zstd C library via JNI) plus the golden corpus — not "the Rust reference".

Test

./mvnw -pl integration-tests -am test — 32 new tests green, checkstyle clean.

🤖 Generated with Claude Code

dfa1 and others added 2 commits June 26, 2026 16:37
Drive zstd's own vendored corpus (third_party/zstd/tests/) from the
integration-tests module: round-trip golden-compression inputs across the
FFM/JNI boundary both directions, cross-check golden-decompression frames
against the zstd-jni reference, and assert golden-decompression-errors
frames are rejected. Submodule-gated so shallow clones still build.

Fix CLAUDE.md: the integration reference is zstd-jni plus the golden
corpus, not "the Rust reference".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add ZstdInteropExtrasTest covering interop paths the round-trip suite
missed: checksum trailers (write/verify both directions + corruption
rejection), skippable frames (jni stream skips a java-written one),
multi-frame concatenation (streaming decode of joined frames both ways),
foreign frame-header parsing (content size and dict id from jni frames),
and streaming driven one tiny chunk at a time across a payload spread.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfa1 dfa1 merged commit 29cd635 into main Jun 26, 2026
1 check passed
@dfa1 dfa1 deleted the test/golden-corpus-integration branch June 26, 2026 15:07
dfa1 added a commit that referenced this pull request Jun 26, 2026
…tinels (#22)

Follow-ups from the code-quality inspection:

- Thread-safety docs (#2): document the four streams as not thread-safe
  (confine to one thread) and the two digested dictionaries as immutable
  and safe to share across threads.
- Null validation (#3): fail fast with a named NullPointerException on
  public byte[]/dictionary/sample/stream arguments instead of an opaque
  NPE deep in native code. requireNative now also rejects null, covering
  every MemorySegment entry point.
- Sentinel DRY (#4): one definition of CONTENTSIZE_UNKNOWN/_ERROR in Zstd,
  reused by ZstdFrame and ZstdFrameHeader (drops a duplicate and the
  CONTENT_SIZE_ERROR naming drift).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant