| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 'ffffe000-fffff000': []}; | 316 'ffffe000-fffff000': []}; |
| 317 assertTrue(name in symbols); | 317 assertTrue(name in symbols); |
| 318 var syms = symbols[name]; | 318 var syms = symbols[name]; |
| 319 for (var i = 0; i < syms.length; ++i) { | 319 for (var i = 0; i < syms.length; ++i) { |
| 320 symbolAdder.apply(null, syms[i]); | 320 symbolAdder.apply(null, syms[i]); |
| 321 } | 321 } |
| 322 }; | 322 }; |
| 323 | 323 |
| 324 | 324 |
| 325 function PrintMonitor(outputOrFileName) { | 325 function PrintMonitor(outputOrFileName) { |
| 326 var expectedOut = typeof outputOrFileName == 'string' ? | 326 var expectedOut = this.expectedOut = typeof outputOrFileName == 'string' ? |
| 327 this.loadExpectedOutput(outputOrFileName) : outputOrFileName; | 327 this.loadExpectedOutput(outputOrFileName) : outputOrFileName; |
| 328 var outputPos = 0; | 328 var outputPos = 0; |
| 329 var diffs = this.diffs = []; | 329 var diffs = this.diffs = []; |
| 330 var realOut = this.realOut = []; | 330 var realOut = this.realOut = []; |
| 331 var unexpectedOut = this.unexpectedOut = null; | 331 var unexpectedOut = this.unexpectedOut = null; |
| 332 | 332 |
| 333 this.oldPrint = print; | 333 this.oldPrint = print; |
| 334 print = function(str) { | 334 print = function(str) { |
| 335 var strSplit = str.split('\n'); | 335 var strSplit = str.split('\n'); |
| 336 for (var i = 0; i < strSplit.length; ++i) { | 336 for (var i = 0; i < strSplit.length; ++i) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 352 | 352 |
| 353 PrintMonitor.prototype.loadExpectedOutput = function(fileName) { | 353 PrintMonitor.prototype.loadExpectedOutput = function(fileName) { |
| 354 var output = readFile(fileName); | 354 var output = readFile(fileName); |
| 355 return output.split('\n'); | 355 return output.split('\n'); |
| 356 }; | 356 }; |
| 357 | 357 |
| 358 | 358 |
| 359 PrintMonitor.prototype.finish = function() { | 359 PrintMonitor.prototype.finish = function() { |
| 360 print = this.oldPrint; | 360 print = this.oldPrint; |
| 361 if (this.diffs.length > 0 || this.unexpectedOut != null) { | 361 if (this.diffs.length > 0 || this.unexpectedOut != null) { |
| 362 print("===== actual output: ====="); |
| 362 print(this.realOut.join('\n')); | 363 print(this.realOut.join('\n')); |
| 364 print("===== expected output: ====="); |
| 365 print(this.expectedOut.join('\n')); |
| 363 assertEquals([], this.diffs); | 366 assertEquals([], this.diffs); |
| 364 assertNull(this.unexpectedOut); | 367 assertNull(this.unexpectedOut); |
| 365 } | 368 } |
| 366 }; | 369 }; |
| 367 | 370 |
| 368 | 371 |
| 369 function driveTickProcessorTest( | 372 function driveTickProcessorTest( |
| 370 separateIc, ignoreUnknown, stateFilter, logInput, refOutput) { | 373 separateIc, ignoreUnknown, stateFilter, logInput, refOutput) { |
| 371 // TEST_FILE_NAME must be provided by test runner. | 374 // TEST_FILE_NAME must be provided by test runner. |
| 372 assertEquals('string', typeof TEST_FILE_NAME); | 375 assertEquals('string', typeof TEST_FILE_NAME); |
| 373 var pathLen = TEST_FILE_NAME.lastIndexOf('/'); | 376 var pathLen = TEST_FILE_NAME.lastIndexOf('/'); |
| 374 if (pathLen == -1) { | 377 if (pathLen == -1) { |
| 375 pathLen = TEST_FILE_NAME.lastIndexOf('\\'); | 378 pathLen = TEST_FILE_NAME.lastIndexOf('\\'); |
| 376 } | 379 } |
| 377 assertTrue(pathLen != -1); | 380 assertTrue(pathLen != -1); |
| 378 var testsPath = TEST_FILE_NAME.substr(0, pathLen + 1); | 381 var testsPath = TEST_FILE_NAME.substr(0, pathLen + 1); |
| 379 var tp = new TickProcessor(new CppEntriesProviderMock(), | 382 var tp = new TickProcessor(new CppEntriesProviderMock(), |
| 380 separateIc, | 383 separateIc, |
| 381 TickProcessor.CALL_GRAPH_SIZE, | 384 TickProcessor.CALL_GRAPH_SIZE, |
| 382 ignoreUnknown, | 385 ignoreUnknown, |
| 383 stateFilter, | 386 stateFilter, |
| 384 undefined, | 387 undefined, |
| 385 "0", | 388 "0", |
| 386 "auto,auto"); | 389 "auto,auto", |
| 390 false); |
| 387 var pm = new PrintMonitor(testsPath + refOutput); | 391 var pm = new PrintMonitor(testsPath + refOutput); |
| 388 tp.processLogFileInTest(testsPath + logInput); | 392 tp.processLogFileInTest(testsPath + logInput); |
| 389 tp.printStatistics(); | 393 tp.printStatistics(); |
| 390 pm.finish(); | 394 pm.finish(); |
| 391 }; | 395 }; |
| 392 | 396 |
| 393 | 397 |
| 394 (function testProcessing() { | 398 (function testProcessing() { |
| 395 var testData = { | 399 var testData = { |
| 396 'Default': [ | 400 'Default': [ |
| (...skipping 10 matching lines...) Expand all Loading... |
| 407 'tickprocessor-test.log', 'tickprocessor-test.gc-state'], | 411 'tickprocessor-test.log', 'tickprocessor-test.gc-state'], |
| 408 'FunctionInfo': [ | 412 'FunctionInfo': [ |
| 409 false, false, null, | 413 false, false, null, |
| 410 'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info'] | 414 'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info'] |
| 411 }; | 415 }; |
| 412 for (var testName in testData) { | 416 for (var testName in testData) { |
| 413 print('=== testProcessing-' + testName + ' ==='); | 417 print('=== testProcessing-' + testName + ' ==='); |
| 414 driveTickProcessorTest.apply(null, testData[testName]); | 418 driveTickProcessorTest.apply(null, testData[testName]); |
| 415 } | 419 } |
| 416 })(); | 420 })(); |
| OLD | NEW |