Skip to content

Commit 77f5eeb

Browse files
committed
codec: test infra: fix build issues
build issues caused as we separated testv from tbvars. Fixed now
1 parent 404b747 commit 77f5eeb

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

codec/z_all_bench_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,43 +43,43 @@ func benchmarkSuiteNoop(b *testing.B) {
4343
}
4444

4545
func benchmarkSuite(t *testing.B, fns ...func(t *testing.B)) {
46-
defer testv.setBufsize((int)(testv.bufsize))
46+
defer tbvars.setBufsize((int)(testv.bufsize))
4747

4848
f := benchmarkOneFn(fns)
4949
// find . -name "*_test.go" | xargs grep -e 'flag.' | cut -d '&' -f 2 | cut -d ',' -f 1 | grep -e '^bench'
5050

5151
testReinit()
52-
testv.setBufsize(-1)
52+
tbvars.setBufsize(-1)
5353
testReinit()
5454
t.Run("use-bytes.......", f)
5555

56-
testv.setBufsize(1024)
56+
tbvars.setBufsize(1024)
5757
testReinit()
5858
t.Run("use-io-1024-....", f)
5959
}
6060

6161
func benchmarkVeryQuickSuite(t *testing.B, name string, fns ...func(t *testing.B)) {
62-
defer testv.setBufsize((int)(testv.bufsize))
62+
defer tbvars.setBufsize((int)(testv.bufsize))
6363
benchmarkDivider()
6464

65-
testv.setBufsize(-1)
65+
tbvars.setBufsize(-1)
6666
// testv.Depth = depth
6767
testReinit()
6868

6969
t.Run(name+"-bd"+strconv.Itoa(testv.Depth)+"........", benchmarkOneFn(fns))
7070
}
7171

7272
func benchmarkQuickSuite(t *testing.B, name string, fns ...func(t *testing.B)) {
73-
defer testv.setBufsize((int)(testv.bufsize))
73+
defer tbvars.setBufsize((int)(testv.bufsize))
7474
benchmarkVeryQuickSuite(t, name, fns...)
7575

7676
// encoded size of TestStruc is between 20K and 30K for bd=1 // consider buffer=1024 * 16 * testv.Depth
77-
testv.setBufsize(1024) // (value of byteBufSize): use smaller buffer, and more flushes - it's ok.
77+
tbvars.setBufsize(1024) // (value of byteBufSize): use smaller buffer, and more flushes - it's ok.
7878
// testv.Depth = depth
7979
testReinit()
8080
t.Run(name+"-bd"+strconv.Itoa(testv.Depth)+"-buf"+strconv.Itoa((int)(testv.bufsize)), benchmarkOneFn(fns))
8181

82-
testv.setBufsize(0)
82+
tbvars.setBufsize(0)
8383
// testv.Depth = depth
8484
testReinit()
8585
t.Run(name+"-bd"+strconv.Itoa(testv.Depth)+"-io.....", benchmarkOneFn(fns))

codec/z_all_test.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,10 @@ func TestCodecSuite(t *testing.T) {
382382
}
383383

384384
testGroupResetBase := func() {
385-
testv.D = DecodeOptions{}
386-
testv.E = EncodeOptions{}
387-
testv.updateHandleOptions()
385+
tbvars.D = DecodeOptions{}
386+
tbvars.E = EncodeOptions{}
387+
tbvars.R = RPCOptions{}
388+
tbvars.updateHandleOptions()
388389

389390
testv.RpcBufsize = 2048
390391
testv.UseReset = false
@@ -414,7 +415,7 @@ func TestCodecSuite(t *testing.T) {
414415

415416
fnTrueV := func() {
416417
testGroupResetBase()
417-
testv.setBufsize(0)
418+
tbvars.setBufsize(0)
418419
testv.UseReset = true
419420
testv.UseParallel = true
420421

@@ -466,13 +467,13 @@ func TestCodecSuite(t *testing.T) {
466467
}
467468
// --------------
468469
testGroupResetBase()
469-
testv.setBufsize(-1)
470+
tbvars.setBufsize(-1)
470471
testReinit()
471472
testGroupResetHandles()
472473
fnRun("optionsFalse", testCodecGroup)
473474

474475
// --------------
475-
testv.setBufsize(0)
476+
tbvars.setBufsize(0)
476477
testReinit()
477478
testGroupResetHandles()
478479
fnRun("optionsFalse-io", testCodecGroup)
@@ -511,7 +512,7 @@ func TestCodecSuite(t *testing.T) {
511512
// will require a re-fill, and test out bufioEncWriter.writeqstr well.
512513
// Due to last requirement, we prefer 16 to 128.
513514
testv.SkipRPCTests = true
514-
testv.setBufsize(16)
515+
tbvars.setBufsize(16)
515516
// tbvars.D.ReaderBufferSize = 128
516517
// tbvars.E.WriterBufferSize = 128
517518
testReinit()
@@ -524,7 +525,7 @@ func TestCodecSuite(t *testing.T) {
524525
// tbvars.D.ReaderBufferSize = 0
525526
// tbvars.E.WriterBufferSize = 0
526527
testv.SkipRPCTests = false
527-
testv.setBufsize(-1)
528+
tbvars.setBufsize(-1)
528529
// ---
529530
testv.NumRepeatString = 32
530531
testReinit()
@@ -565,10 +566,10 @@ func TestCodecSuite(t *testing.T) {
565566
fnRun("simple-enczeroasnil", testSimpleMammothGroup) // testSimpleGroup
566567

567568
// --------------
568-
defer testv.setBufsize((int)(testv.bufsize))
569-
defer func(b bool) { testv.R.RPCNoBuffer = b }(testv.R.RPCNoBuffer)
570-
testv.setBufsize(16)
571-
testv.R.RPCNoBuffer = false
569+
defer tbvars.setBufsize((int)(testv.bufsize))
570+
defer func(b bool) { tbvars.R.RPCNoBuffer = b }(tbvars.R.RPCNoBuffer)
571+
tbvars.setBufsize(16)
572+
tbvars.R.RPCNoBuffer = false
572573
testReinit()
573574
testGroupResetHandles()
574575
testv.RpcBufsize = 0
@@ -581,7 +582,7 @@ func TestCodecSuite(t *testing.T) {
581582
fnRun("rpc-buf-16", testRpcGroup)
582583
testv.RpcBufsize = 2048
583584
fnRun("rpc-buf-2048", testRpcGroup)
584-
testv.R.RPCNoBuffer = true
585+
tbvars.R.RPCNoBuffer = true
585586
testv.RpcBufsize = 0
586587
fnRun("rpc-buf-0-rpcNoBuffer", testRpcGroup)
587588
testv.RpcBufsize = 0

0 commit comments

Comments
 (0)