Skip to content

Commit

Permalink
test: tick processor version check regression test
Browse files Browse the repository at this point in the history
Verify that v8-version log lines are parsed and matched correctly.

Fixes: #16736
PR-URL: #16769
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
bnoordhuis authored and cjihrig committed Nov 7, 2017
1 parent e0c7b3d commit 2294ba4
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/parallel/test-tick-processor-version-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Flags: --expose-internals
'use strict';
require('../common');
const assert = require('assert');
const { versionCheck } = require('internal/v8_prof_polyfill');

assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3'), undefined);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3.3'), undefined);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3.4'), undefined);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,0', '1.2.3.5'), undefined);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3'),
undefined);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3.4'),
undefined);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3-node.1'),
undefined);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3-node.2'),
undefined);
assert.strictEqual(
versionCheck('v8-version,1,2,3,4,-node.1,0', '1.2.3.4-node.2'),
undefined);

{
const expected = 'Unable to read v8-version from log file.';
assert.strictEqual(versionCheck('faux', '1.2.3'), expected);
assert.strictEqual(versionCheck('v8-version', '1.2.3'), expected);
assert.strictEqual(versionCheck('v8-version,1', '1.2.3'), expected);
assert.strictEqual(versionCheck('v8-version,1,2', '1.2.3'), expected);
assert.strictEqual(versionCheck('v8-version,1,2,3', '1.2.3'), expected);
assert.strictEqual(versionCheck('v8-version,1,2,3,4', '1.2.3'), expected);
assert.strictEqual(versionCheck('v8-version,1,2,3,4,5,6,7', '1.2.3'),
expected);
}

{
const expected = 'Testing v8 version different from logging version';
assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '1.2.3'), expected);
assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '1.2.3.4'), expected);
assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '4.3.1.1'), expected);
assert.strictEqual(versionCheck('v8-version,4,3,2,1,0', '4.3.3.1'), expected);
}

0 comments on commit 2294ba4

Please sign in to comment.