summaryrefslogtreecommitdiff
path: root/test/parallel/test-tick-processor-version-check.js
blob: b253adfb59b6f3abf7632f9e5994854c23a3279c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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);
}