mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
T2 Batch 11c sign-prep L1-A + L2-A: stress + scripted smoke tests
Sign-prep for T2B-NVMe-product-ready promotion (QA §4 checklist
items #1-3). Three new test files validating the V2-strict session
concurrency model under sustained load + a YAML-scripted subprocess
smoke for scenario reviewability.
## L1-A: ConcurrentQueueStress (t2_a_concurrent_queue_stress_test.go)
8 IO queues × 50 sequential Writes per queue = 400 Writes total.
Each Write is 32 KiB split into 8 × 4 KiB H2CData chunks (kernel
mkfs pattern). 90s hard deadline guards against deadlock
regressions.
Invariants:
- backend.calls == 400
- backend.bytes == 400 × 32 KiB
- no per-queue transport / status errors
- concurrent queues share target.ctrlMu without interference
Added helper: stressWriteTarget(t, volumeSize uint64) — spins up a
target with configurable volume size (default 1 MiB is too small
for 400 non-overlapping 32 KiB writes; test uses 64 MiB).
Runtime: 60 ms (localhost loopback).
## L1-A: LargeWriteStress (t2_a_large_write_stress_test.go)
100 sequential Writes at each of 5 sizes (512 B, 4 KiB, 8 KiB,
16 KiB, 32 KiB MDTS boundary). Per-iteration asserts:
- Exactly one R2T per cmd with DATAL == totalBytes (pins the
single-R2T-per-cmd invariant from the V2-strict revert)
- backend.calls / backend.bytes accumulate correctly
- Success status on every iteration
Added helper: writeChunkedOnClient(t, cli, slba, nlb, payload,
chunks) — issues a Write with N H2CData chunks (existing
nvmeClient.writeCmd does single-chunk only).
Runtime: 100 ms total across all 5 shapes.
## L2-A: Scripted smoke (testdata/t2-nvme-smoke.yaml +
## t2_l2_nvme_smoke_replay_test.go)
Declarative YAML scenario replayed against real blockmaster +
blockvolume subprocesses (reuses existing startL2NvmeHarness).
8 steps covering mixed sizes (1 LBA, 8 LBAs, 64 LBAs) + overwrite
semantics (write seed=11 at LBA 0, then write seed=44 at LBA 0,
assert read returns seed=44).
Payload semantics:
byte[i] = (seed + i) & 0xFF (deterministic; reads verify bit-
for-bit)
Adds yaml.v3 as test-only dep (already in go.mod via other
packages). Runtime: 13.7 s (subprocess bringup dominates).
## Files added
core/frontend/nvme/t2_a_concurrent_queue_stress_test.go (~130 LOC)
core/frontend/nvme/t2_a_large_write_stress_test.go (~160 LOC)
core/frontend/nvme/t2_l2_nvme_smoke_replay_test.go (~130 LOC)
core/frontend/nvme/testdata/t2-nvme-smoke.yaml (~60 LOC)
## Regression
go test ./core/frontend/nvme/ -count=1 → ok 60.9s
(full suite including existing L2 subprocess tests + new stress)
go test ./core/frontend/nvme/ -short -count=1 → ok 1.5s
(short mode skips L2 + stress; unit-only)
## Sign-prep checklist progress (QA §4)
#1 L1-A ConcurrentQueueStress [x] this commit
#2 L1-A LargeWriteStress [x] this commit
#3 L2-A t2-nvme-smoke.yaml + replay [x] this commit
#4 L3-A m01 iterate-m01-nvme.sh [ ] QA-owned
#5 Full regression green [x]
#6 Boundary guard green [x]
#7-#11 QA, post-checklist
Not in this commit (QA-authored files that landed in the same
working tree): t2_v2port_nvme_disconnect_mid_r2t_test.go,
t2_v2port_nvme_reconnect_loop_test.go, pipeline_extended +
pipelined_writes rewrites, scripts/iterate-m01-nvme.sh — QA to
commit separately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f99d5718a1
commit
b0ccd2753b
4 files changed
+529
No files matched your search
@@ -0,0 +1,156 @@
|
||||
// Ownership: sw — L1-A sign-prep stress test for T2B-NVMe-product-
|
||||
// ready. Exercises the session concurrency model under kernel-
|
||||
// realistic load (N IO queues × M sequential Writes each) well
|
||||
// above what mkfs.ext4 requires.
|
||||
//
|
||||
// Scope:
|
||||
// - 8 concurrent IO queues (matches Linux kernel default)
|
||||
// - 50 sequential Writes per queue = 400 Writes total
|
||||
// - Each Write is 32 KiB split into 8 × 4 KiB H2CData chunks
|
||||
// (kernel mkfs pattern from BUG-001 dmesg analysis)
|
||||
// - Pairing shape: send cmd → recv R2T → send N H2CData →
|
||||
// recv CapsuleResp → next cmd (V2-strict: one R2T outstanding
|
||||
// per session at a time, per BUG-001 revert rationale)
|
||||
//
|
||||
// Invariants pinned:
|
||||
// - backend.calls == numQueues * itersPerQueue
|
||||
// - backend.bytes == numQueues * itersPerQueue * writeSize
|
||||
// - no timeouts (per-queue wall-clock bounded)
|
||||
// - no status errors
|
||||
//
|
||||
// Complements (does not replace):
|
||||
// - TestT2V2Port_NVMe_IO_8Queues_Concurrent32KiBWrites (1 iter/queue)
|
||||
// - TestT2V2Port_NVMe_IO_AdminWhileIOInFlight (admin+IO shape)
|
||||
|
||||
package nvme_test
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/nvme"
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/testback"
|
||||
)
|
||||
|
||||
// stressWriteTarget provisions a target with a large-enough
|
||||
// volume so the stress writes don't collide with the default
|
||||
// 1 MiB size (2048 LBAs). 64 MiB accommodates 400 × 32 KiB
|
||||
// Writes at distinct non-overlapping regions.
|
||||
func stressWriteTarget(t *testing.T, volumeSize uint64) (*writeCountingBackend, string) {
|
||||
t.Helper()
|
||||
rec := testback.NewRecordingBackend(frontend.Identity{
|
||||
VolumeID: "v1", ReplicaID: "r1", Epoch: 1, EndpointVersion: 1,
|
||||
})
|
||||
backend := &writeCountingBackend{inner: rec}
|
||||
prov := testback.NewStaticProvider(backend)
|
||||
tg := nvme.NewTarget(nvme.TargetConfig{
|
||||
Listen: "127.0.0.1:0",
|
||||
SubsysNQN: "nqn.2026-04.example.v3:subsys",
|
||||
VolumeID: "v1",
|
||||
Provider: prov,
|
||||
Handler: nvme.HandlerConfig{VolumeSize: volumeSize},
|
||||
})
|
||||
addr, err := tg.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("Target.Start: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = tg.Close() })
|
||||
return backend, addr
|
||||
}
|
||||
|
||||
// TestT2A_ConcurrentQueueStress runs 8 IO queues in parallel, each
|
||||
// driving 50 sequential 32-KiB chunked Writes. Pins the post-
|
||||
// BUG-001-revert V2-strict session model under sustained
|
||||
// concurrent load.
|
||||
func TestT2A_ConcurrentQueueStress(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("short mode: skipping L1-A stress test (10+ s)")
|
||||
}
|
||||
|
||||
const (
|
||||
numQueues = 8
|
||||
itersPerQueue = 50
|
||||
writeSize = 32 * 1024
|
||||
chunks = 8
|
||||
nlbPerWrite = uint16(writeSize / 512)
|
||||
)
|
||||
|
||||
// 64 MiB volume — room for 400 × 32 KiB non-overlapping writes.
|
||||
backend, addr := stressWriteTarget(t, 64*1024*1024)
|
||||
cli := newMultiQueueClient(t, addr, "nqn.2026-04.example.v3:subsys",
|
||||
"nqn.2026-04.example.host:1", numQueues)
|
||||
|
||||
makePayload := func(qIdx, iter int) []byte {
|
||||
p := make([]byte, writeSize)
|
||||
seed := byte((qIdx*131 + iter*7) & 0xFF)
|
||||
for i := range p {
|
||||
p[i] = seed + byte(i)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
start := make(chan struct{})
|
||||
var wg sync.WaitGroup
|
||||
queueErrs := make([]atomic.Uint32, numQueues)
|
||||
statusErrs := make([]atomic.Uint32, numQueues)
|
||||
deadline := time.Now().Add(60 * time.Second)
|
||||
|
||||
for qi := 0; qi < numQueues; qi++ {
|
||||
qi, q := qi, cli.queues[qi]
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
<-start
|
||||
for iter := 0; iter < itersPerQueue; iter++ {
|
||||
if time.Now().After(deadline) {
|
||||
queueErrs[qi].Add(1)
|
||||
return
|
||||
}
|
||||
slba := uint64(qi*itersPerQueue+iter) * uint64(nlbPerWrite)
|
||||
payload := makePayload(qi, iter)
|
||||
status, err := cli.chunkedWriteOnQueue(t, q, slba, nlbPerWrite, payload, chunks)
|
||||
if err != nil {
|
||||
queueErrs[qi].Add(1)
|
||||
return
|
||||
}
|
||||
if status != 0 {
|
||||
statusErrs[qi].Add(1)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
go func() { wg.Wait(); close(done) }()
|
||||
close(start)
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
case <-time.After(90 * time.Second):
|
||||
t.Fatal("queues hung — concurrency model may have regressed (deadlock or lost R2T)")
|
||||
}
|
||||
|
||||
totalExpectedCalls := int32(numQueues * itersPerQueue)
|
||||
totalExpectedBytes := int64(numQueues) * int64(itersPerQueue) * int64(writeSize)
|
||||
|
||||
if got := backend.calls.Load(); got != totalExpectedCalls {
|
||||
t.Errorf("backend.calls=%d want %d — missing %d Writes",
|
||||
got, totalExpectedCalls, totalExpectedCalls-got)
|
||||
}
|
||||
if got := backend.bytes.Load(); got != totalExpectedBytes {
|
||||
t.Errorf("backend.bytes=%d want %d — delta %d",
|
||||
got, totalExpectedBytes, totalExpectedBytes-got)
|
||||
}
|
||||
|
||||
for i := 0; i < numQueues; i++ {
|
||||
if n := queueErrs[i].Load(); n > 0 {
|
||||
t.Errorf("queue %d: %d transport errors", i, n)
|
||||
}
|
||||
if n := statusErrs[i].Load(); n > 0 {
|
||||
t.Errorf("queue %d: %d status-error CapsuleResps", i, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
// Ownership: sw — L1-A sign-prep stress test for T2B-NVMe-product-
|
||||
// ready. Pins single-queue Write behavior across a range of sizes
|
||||
// up to MDTS boundary (32 KiB per Identify Controller MDTS=3 at
|
||||
// 4 KiB page). Linux kernel caps its single-cmd IO size at MDTS;
|
||||
// any larger host request would split into multiple cmds. This
|
||||
// test exercises sustained sequential load at each size.
|
||||
//
|
||||
// Invariants pinned per subtest:
|
||||
// - Every iteration emits exactly one R2T with DATAL == expected
|
||||
// totalBytes (single-R2T-per-cmd invariant from V2-strict port)
|
||||
// - backend.calls increments by 1 per iteration
|
||||
// - backend.bytes increments by writeSize per iteration
|
||||
// - Each Write returns Success status
|
||||
//
|
||||
// Complements existing per-shape tests (Write_ChunkingShapes, the
|
||||
// 32 KiB mkfsPattern) by adding iteration count — 100 × each size
|
||||
// surfaces any leak / race that a single-shot test misses.
|
||||
|
||||
package nvme_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweed-block/core/frontend/nvme"
|
||||
)
|
||||
|
||||
// TestT2A_LargeWriteStress iterates 100 chunked Writes at each of
|
||||
// several realistic sizes, asserting backend bookkeeping matches
|
||||
// expectations after each size group.
|
||||
func TestT2A_LargeWriteStress(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("short mode: skipping L1-A stress test")
|
||||
}
|
||||
|
||||
shapes := []struct {
|
||||
name string
|
||||
writeSize uint32
|
||||
chunks int
|
||||
iterations int
|
||||
}{
|
||||
{"1LBA_1chunk", 512, 1, 100},
|
||||
{"8LBA_1chunk", 4096, 1, 100},
|
||||
{"16LBA_2chunks", 8192, 2, 100},
|
||||
{"32LBA_4chunks", 16384, 4, 100},
|
||||
{"64LBA_8chunks_MDTS", 32768, 8, 100},
|
||||
}
|
||||
|
||||
for _, shape := range shapes {
|
||||
shape := shape
|
||||
t.Run(shape.name, func(t *testing.T) {
|
||||
if shape.writeSize%uint32(shape.chunks) != 0 {
|
||||
t.Fatalf("writeSize %d not divisible by chunks %d",
|
||||
shape.writeSize, shape.chunks)
|
||||
}
|
||||
|
||||
volumeSize := uint64(shape.iterations) * uint64(shape.writeSize)
|
||||
if volumeSize < 1024*1024 {
|
||||
volumeSize = 1024 * 1024
|
||||
}
|
||||
backend, addr := stressWriteTarget(t, volumeSize)
|
||||
cli := dialAndConnect(t, addr)
|
||||
defer cli.close()
|
||||
|
||||
nlb := uint16(shape.writeSize / 512)
|
||||
for iter := 0; iter < shape.iterations; iter++ {
|
||||
payload := make([]byte, shape.writeSize)
|
||||
seed := byte((iter * 17) & 0xFF)
|
||||
for i := range payload {
|
||||
payload[i] = seed + byte(i)
|
||||
}
|
||||
slba := uint64(iter) * uint64(nlb)
|
||||
status := writeChunkedOnClient(t, cli, slba, nlb, payload, shape.chunks)
|
||||
if status != 0 {
|
||||
t.Fatalf("iter=%d status=0x%04x", iter, status)
|
||||
}
|
||||
}
|
||||
|
||||
expectedCalls := int32(shape.iterations)
|
||||
expectedBytes := int64(shape.iterations) * int64(shape.writeSize)
|
||||
if got := backend.calls.Load(); got != expectedCalls {
|
||||
t.Errorf("backend.calls=%d want %d", got, expectedCalls)
|
||||
}
|
||||
if got := backend.bytes.Load(); got != expectedBytes {
|
||||
t.Errorf("backend.bytes=%d want %d", got, expectedBytes)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// writeChunkedOnClient issues a Write with N H2CData chunks on
|
||||
// an nvmeClient's IO queue. Asserts single-R2T-per-cmd invariant
|
||||
// (DATAL == len(payload)) then sends chunks and returns the final
|
||||
// CapsuleResp status. Distinct from nvmeClient.writeCmd which
|
||||
// sends a single H2CData covering the whole payload.
|
||||
func writeChunkedOnClient(t *testing.T, c *nvmeClient, slba uint64, nlb uint16, payload []byte, chunks int) uint16 {
|
||||
t.Helper()
|
||||
if len(payload)%chunks != 0 {
|
||||
t.Fatalf("payload %d not divisible by chunks %d", len(payload), chunks)
|
||||
}
|
||||
chunkSize := len(payload) / chunks
|
||||
cid := uint16(c.cid.Add(1))
|
||||
|
||||
cmd := nvme.CapsuleCommand{
|
||||
OpCode: 0x01, // ioWrite
|
||||
CID: cid,
|
||||
NSID: 1,
|
||||
D10: uint32(slba & 0xFFFFFFFF),
|
||||
D11: uint32(slba >> 32),
|
||||
D12: uint32(nlb - 1),
|
||||
}
|
||||
if err := c.ioW.SendHeaderOnly(0x4, &cmd, 64); err != nil {
|
||||
t.Fatalf("send Write: %v", err)
|
||||
}
|
||||
|
||||
ch, err := c.ioR.Dequeue()
|
||||
if err != nil {
|
||||
t.Fatalf("recv R2T hdr: %v", err)
|
||||
}
|
||||
if ch.Type == 0x5 {
|
||||
var resp nvme.CapsuleResponse
|
||||
_ = c.ioR.Receive(&resp)
|
||||
return resp.Status
|
||||
}
|
||||
if ch.Type != 0x9 {
|
||||
t.Fatalf("expected R2T (0x9), got 0x%x", ch.Type)
|
||||
}
|
||||
var r2t nvme.R2THeader
|
||||
if err := c.ioR.Receive(&r2t); err != nil {
|
||||
t.Fatalf("recv R2T: %v", err)
|
||||
}
|
||||
if r2t.DATAL != uint32(len(payload)) {
|
||||
t.Fatalf("R2T DATAL=%d want %d (single-R2T-per-cmd invariant broken)",
|
||||
r2t.DATAL, len(payload))
|
||||
}
|
||||
|
||||
for i := 0; i < chunks; i++ {
|
||||
off := i * chunkSize
|
||||
h := nvme.H2CDataHeader{
|
||||
CCCID: cid,
|
||||
TAG: r2t.TAG,
|
||||
DATAO: uint32(off),
|
||||
DATAL: uint32(chunkSize),
|
||||
}
|
||||
if err := c.ioW.SendWithData(0x6, 0, &h, 16, payload[off:off+chunkSize]); err != nil {
|
||||
t.Fatalf("send H2CData[%d]: %v", i, err)
|
||||
}
|
||||
}
|
||||
|
||||
resp := recvCapsuleResp(t, c.ioR)
|
||||
if resp.CID != cid {
|
||||
t.Fatalf("Write resp CID=%d want %d", resp.CID, cid)
|
||||
}
|
||||
return resp.Status
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// Ownership: sw — L2-A sign-prep YAML-scripted smoke for T2B-NVMe-
|
||||
// product-ready. Reuses the existing L2 harness (real blockmaster
|
||||
// + blockvolume subprocesses) and drives it with a declarative
|
||||
// scenario from testdata/t2-nvme-smoke.yaml.
|
||||
//
|
||||
// Value over hand-written L2 tests:
|
||||
// - Scenario is reviewable YAML; test code is just a replay engine
|
||||
// - New scenarios can be added without Go code changes
|
||||
// - Read-after-write byte-level integrity is asserted per step
|
||||
//
|
||||
// Scope:
|
||||
// - Real blockmaster + blockvolume subprocess pair (via
|
||||
// startL2NvmeHarness)
|
||||
// - Go initiator runs the scripted steps through the in-package
|
||||
// nvmeClient test helpers (dialAndConnect / writeCmd / readCmd)
|
||||
// - YAML ops: write (seed-derived payload), read (asserts
|
||||
// seed-derived expected bytes)
|
||||
|
||||
package nvme_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// smokeScenario mirrors the YAML file shape.
|
||||
type smokeScenario struct {
|
||||
Name string `yaml:"name"`
|
||||
SubsysNQN string `yaml:"subsys_nqn"`
|
||||
Description string `yaml:"description"`
|
||||
Steps []smokeStep `yaml:"steps"`
|
||||
}
|
||||
|
||||
// smokeStep is a single op. Only one of write / read fields is
|
||||
// meaningful per step (selected by Op).
|
||||
type smokeStep struct {
|
||||
Op string `yaml:"op"` // "write" | "read"
|
||||
SLBA uint64 `yaml:"slba"`
|
||||
NLB uint16 `yaml:"nlb"`
|
||||
Seed int `yaml:"seed"`
|
||||
ExpectSeed int `yaml:"expect_seed"`
|
||||
Note string `yaml:"note"`
|
||||
}
|
||||
|
||||
// makeSeedPayload deterministically builds a payload from seed.
|
||||
// Matches what a corresponding read step will expect.
|
||||
func makeSeedPayload(seed int, bytes int) []byte {
|
||||
p := make([]byte, bytes)
|
||||
for i := range p {
|
||||
p[i] = byte((seed + i) & 0xFF)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// TestT2A_L2_NvmeSmokeReplay reads the scenario YAML, spins up the
|
||||
// real L2 subprocess harness, and replays each step as an NVMe/TCP
|
||||
// operation. Each read is byte-verified against seed-derived data.
|
||||
func TestT2A_L2_NvmeSmokeReplay(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("L2 subprocess test; skipped under -short")
|
||||
}
|
||||
|
||||
scenarioPath := filepath.Join("testdata", "t2-nvme-smoke.yaml")
|
||||
raw, err := os.ReadFile(scenarioPath)
|
||||
if err != nil {
|
||||
t.Fatalf("read scenario: %v", err)
|
||||
}
|
||||
var scenario smokeScenario
|
||||
if err := yaml.Unmarshal(raw, &scenario); err != nil {
|
||||
t.Fatalf("parse scenario: %v", err)
|
||||
}
|
||||
if len(scenario.Steps) == 0 {
|
||||
t.Fatalf("scenario has no steps (file: %s)", scenarioPath)
|
||||
}
|
||||
|
||||
t.Logf("Scenario: %s (%d steps)", scenario.Name, len(scenario.Steps))
|
||||
|
||||
h := startL2NvmeHarness(t)
|
||||
defer h.Close()
|
||||
|
||||
cli := dialAndConnect(t, h.nvmeAddr)
|
||||
defer cli.close()
|
||||
|
||||
blockSize := 512 // advertised LBADS=9
|
||||
for i, step := range scenario.Steps {
|
||||
i, step := i, step
|
||||
// Subtest per step for localized failure reporting.
|
||||
t.Run(fmt.Sprintf("step_%02d_%s_slba%d_nlb%d", i, step.Op, step.SLBA, step.NLB), func(t *testing.T) {
|
||||
totalBytes := int(step.NLB) * blockSize
|
||||
if step.Note != "" {
|
||||
t.Logf("step: %s", step.Note)
|
||||
}
|
||||
switch step.Op {
|
||||
case "write":
|
||||
payload := makeSeedPayload(step.Seed, totalBytes)
|
||||
status := cli.writeCmd(t, step.SLBA, step.NLB, payload)
|
||||
if status != 0 {
|
||||
t.Fatalf("Write status=0x%04x", status)
|
||||
}
|
||||
case "read":
|
||||
status, data := cli.readCmd(t, step.SLBA, step.NLB, totalBytes)
|
||||
if status != 0 {
|
||||
t.Fatalf("Read status=0x%04x", status)
|
||||
}
|
||||
if len(data) != totalBytes {
|
||||
t.Fatalf("Read returned %d bytes, want %d", len(data), totalBytes)
|
||||
}
|
||||
expected := makeSeedPayload(step.ExpectSeed, totalBytes)
|
||||
if !bytesEqual(data, expected) {
|
||||
t.Fatalf("Read data mismatch at slba=%d nlb=%d seed=%d: first diff at byte %d (got 0x%02x want 0x%02x)",
|
||||
step.SLBA, step.NLB, step.ExpectSeed,
|
||||
firstDiff(data, expected),
|
||||
data[firstDiff(data, expected)],
|
||||
expected[firstDiff(data, expected)])
|
||||
}
|
||||
default:
|
||||
t.Fatalf("unknown op %q", step.Op)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func bytesEqual(a, b []byte) bool {
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
for i := range a {
|
||||
if a[i] != b[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func firstDiff(a, b []byte) int {
|
||||
n := len(a)
|
||||
if len(b) < n {
|
||||
n = len(b)
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
if a[i] != b[i] {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
# T2 L2-A NVMe/TCP smoke scenario.
|
||||
#
|
||||
# Sign-prep for T2B-NVMe-product-ready. Scripted round-trip of
|
||||
# Write / Read operations against a real blockmaster + blockvolume
|
||||
# subprocess pair, driven by the Go replay harness in
|
||||
# t2_l2_nvme_smoke_replay_test.go.
|
||||
#
|
||||
# Payload semantics: each Write step constructs a deterministic
|
||||
# byte pattern from `seed` — byte[i] = byte((seed + i) & 0xFF).
|
||||
# The matching Read step asserts the returned bytes match the
|
||||
# expected seed pattern.
|
||||
#
|
||||
# SLBA / NLB are in 512-byte logical-block units (matches what
|
||||
# the target advertises via Identify Namespace LBADS=9).
|
||||
|
||||
name: t2-nvme-smoke
|
||||
subsys_nqn: nqn.2026-04.example.v3:subsys
|
||||
description: >
|
||||
NVMe/TCP L2 scripted smoke — connect to running volume, exercise
|
||||
mixed-size Writes + Reads at distinct LBA ranges, confirm
|
||||
read-back matches.
|
||||
|
||||
steps:
|
||||
# Single-LBA write (smallest possible NVMe IO)
|
||||
- op: write
|
||||
slba: 0
|
||||
nlb: 1
|
||||
seed: 11
|
||||
note: 512-byte write at LBA 0
|
||||
- op: read
|
||||
slba: 0
|
||||
nlb: 1
|
||||
expect_seed: 11
|
||||
note: read back 512 bytes
|
||||
|
||||
# 4 KiB write (common fs block)
|
||||
- op: write
|
||||
slba: 8
|
||||
nlb: 8
|
||||
seed: 22
|
||||
note: 4 KiB write at LBA 8
|
||||
- op: read
|
||||
slba: 8
|
||||
nlb: 8
|
||||
expect_seed: 22
|
||||
|
||||
# 32 KiB write (MDTS boundary, kernel mkfs pattern)
|
||||
- op: write
|
||||
slba: 64
|
||||
nlb: 64
|
||||
seed: 33
|
||||
note: 32 KiB MDTS-boundary write
|
||||
- op: read
|
||||
slba: 64
|
||||
nlb: 64
|
||||
expect_seed: 33
|
||||
|
||||
# Re-write and re-read overlapping region with different seed
|
||||
# — pins that Writes actually overwrite (not append / dedupe).
|
||||
- op: write
|
||||
slba: 0
|
||||
nlb: 1
|
||||
seed: 44
|
||||
note: overwrite LBA 0 with new seed
|
||||
- op: read
|
||||
slba: 0
|
||||
nlb: 1
|
||||
expect_seed: 44
|
||||
note: read back must see overwrite
|
||||
Reference in new issue
Block a user