@@ -5,6 +5,7 @@ const fs = require('fs');
55const os = require ( 'os' ) ;
66const path = require ( 'path' ) ;
77const util = require ( 'util' ) ;
8+ const cpus = os . cpus ( ) ;
89
910function findReports ( pid , dir ) {
1011 // Default filenames are of the form
@@ -98,6 +99,7 @@ function _validateContent(report) {
9899 assert . strictEqual ( typeof header . osVersion , 'string' ) ;
99100 assert . strictEqual ( typeof header . osMachine , 'string' ) ;
100101 assert ( Array . isArray ( header . cpus ) ) ;
102+ assert . strictEqual ( header . cpus . length , cpus . length ) ;
101103 header . cpus . forEach ( ( cpu ) => {
102104 assert . strictEqual ( typeof cpu . model , 'string' ) ;
103105 assert . strictEqual ( typeof cpu . speed , 'number' ) ;
@@ -106,6 +108,9 @@ function _validateContent(report) {
106108 assert . strictEqual ( typeof cpu . sys , 'number' ) ;
107109 assert . strictEqual ( typeof cpu . idle , 'number' ) ;
108110 assert . strictEqual ( typeof cpu . irq , 'number' ) ;
111+ assert ( cpus . some ( ( c ) => {
112+ return c . model === cpu . model && c . speed === cpu . speed ;
113+ } ) ) ;
109114 } ) ;
110115 assert . strictEqual ( header . host , os . hostname ( ) ) ;
111116
0 commit comments