File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,11 @@ const { internalBinding } = require('internal/test/binding');
1111const { getGenericUsageCount } = internalBinding ( 'debug' ) ;
1212const assert = require ( 'assert' ) ;
1313
14- const initialCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.ZeroFilled' ) ;
14+ const initialUninitializedCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.Uninitialized' ) ;
15+ const initialZeroFilledCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.ZeroFilled' ) ;
1516const buffer = Buffer . allocUnsafe ( Buffer . poolSize + 1 ) ;
16- assert . strictEqual ( buffer . every ( ( b ) => b === 0 ) , true ) ;
17- const newCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.ZeroFilled' ) ;
18- assert . notStrictEqual ( newCount , initialCount ) ;
17+ assert ( buffer . every ( ( b ) => b === 0 ) ) ;
18+ const newUninitializedCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.Uninitialized' ) ;
19+ const newZeroFilledCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.ZeroFilled' ) ;
20+ assert . strictEqual ( newUninitializedCount , initialUninitializedCount ) ;
21+ assert . notStrictEqual ( newZeroFilledCount , initialZeroFilledCount ) ;
Original file line number Diff line number Diff line change @@ -11,10 +11,13 @@ const { internalBinding } = require('internal/test/binding');
1111const { getGenericUsageCount } = internalBinding ( 'debug' ) ;
1212const assert = require ( 'assert' ) ;
1313
14- const initialCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.Uninitialized' ) ;
14+ const initialUninitializedCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.Uninitialized' ) ;
15+ const initialZeroFilledCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.ZeroFilled' ) ;
1516Buffer . allocUnsafe ( Buffer . poolSize + 1 ) ;
1617// We can't reliably check the contents of the buffer here because the OS or memory allocator
1718// used might zero-fill memory for us, or they might happen to return reused memory that was
18- // previously used by a process that zero-filled it.
19- const newCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.Uninitialized' ) ;
20- assert . notStrictEqual ( newCount , initialCount ) ;
19+ // previously used by a process that zero-filled it. So instead we just check the usage counts.
20+ const newUninitializedCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.Uninitialized' ) ;
21+ const newZeroFilledCount = getGenericUsageCount ( 'NodeArrayBufferAllocator.Allocate.ZeroFilled' ) ;
22+ assert . notStrictEqual ( newUninitializedCount , initialUninitializedCount ) ;
23+ assert . strictEqual ( newZeroFilledCount , initialZeroFilledCount ) ;
You can’t perform that action at this time.
0 commit comments