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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
|
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
try:
import jsonresults
from jsonresults import JsonResults
except ImportError:
print "ERROR: Add the TestResultServer, google_appengine and yaml/lib directories to your PYTHONPATH"
raise
from django.utils import simplejson
import unittest
JSON_RESULTS_TEMPLATE = (
'{"Webkit":{'
'"allFixableCount":[[TESTDATA_COUNT]],'
'"buildNumbers":[[TESTDATA_BUILDNUMBERS]],'
'"chromeRevision":[[TESTDATA_CHROMEREVISION]],'
'"deferredCounts":[[TESTDATA_COUNTS]],'
'"fixableCount":[[TESTDATA_COUNT]],'
'"fixableCounts":[[TESTDATA_COUNTS]],'
'"secondsSinceEpoch":[[TESTDATA_TIMES]],'
'"tests":{[TESTDATA_TESTS]},'
'"webkitRevision":[[TESTDATA_WEBKITREVISION]],'
'"wontfixCounts":[[TESTDATA_COUNTS]]'
'},'
'"version":[VERSION]'
'}')
JSON_RESULTS_COUNTS_TEMPLATE = (
'{'
'"C":[TESTDATA],'
'"F":[TESTDATA],'
'"I":[TESTDATA],'
'"O":[TESTDATA],'
'"P":[TESTDATA],'
'"T":[TESTDATA],'
'"X":[TESTDATA],'
'"Z":[TESTDATA]}')
JSON_RESULTS_DIRECTORY_TEMPLATE = '[[TESTDATA_DIRECTORY]]:{[TESTDATA_DATA]}'
JSON_RESULTS_TESTS_TEMPLATE = (
'[[TESTDATA_TEST_NAME]]:{'
'"results":[[TESTDATA_TEST_RESULTS]],'
'"times":[[TESTDATA_TEST_TIMES]]}')
JSON_RESULTS_TEST_LIST_TEMPLATE = (
'{"Webkit":{"tests":{[TESTDATA_TESTS]}}}')
class JsonResultsTest(unittest.TestCase):
def setUp(self):
self._builder = "Webkit"
def test_strip_prefix_suffix(self):
json = "['contents']"
self.assertEqual(JsonResults._strip_prefix_suffix("ADD_RESULTS(" + json + ");"), json)
self.assertEqual(JsonResults._strip_prefix_suffix(json), json)
def _make_test_json(self, test_data):
if not test_data:
return ""
builds = test_data["builds"]
tests = test_data["tests"]
if not builds or not tests:
return ""
json = JSON_RESULTS_TEMPLATE
counts = []
build_numbers = []
webkit_revision = []
chrome_revision = []
times = []
for build in builds:
counts.append(JSON_RESULTS_COUNTS_TEMPLATE.replace("[TESTDATA]", build))
build_numbers.append("1000%s" % build)
webkit_revision.append("2000%s" % build)
chrome_revision.append("3000%s" % build)
times.append("100000%s000" % build)
json = json.replace("[TESTDATA_COUNTS]", ",".join(counts))
json = json.replace("[TESTDATA_COUNT]", ",".join(builds))
json = json.replace("[TESTDATA_BUILDNUMBERS]", ",".join(build_numbers))
json = json.replace("[TESTDATA_WEBKITREVISION]", ",".join(webkit_revision))
json = json.replace("[TESTDATA_CHROMEREVISION]", ",".join(chrome_revision))
json = json.replace("[TESTDATA_TIMES]", ",".join(times))
version = str(test_data["version"]) if "version" in test_data else "4"
json = json.replace("[VERSION]", version)
json = json.replace("{[TESTDATA_TESTS]}", simplejson.dumps(tests, separators=(',', ':'), sort_keys=True))
return json
def _test_merge(self, aggregated_data, incremental_data, expected_data, max_builds=jsonresults.JSON_RESULTS_MAX_BUILDS):
aggregated_results = self._make_test_json(aggregated_data)
incremental_results = self._make_test_json(incremental_data)
merged_results = JsonResults.merge(self._builder, aggregated_results, incremental_results, max_builds, sort_keys=True)
if expected_data:
expected_results = self._make_test_json(expected_data)
self.assertEqual(merged_results, expected_results)
else:
self.assertFalse(merged_results)
def _test_get_test_list(self, input_data, expected_data):
input_results = self._make_test_json(input_data)
expected_results = JSON_RESULTS_TEST_LIST_TEMPLATE.replace("{[TESTDATA_TESTS]}", simplejson.dumps(expected_data, separators=(',', ':')))
actual_results = JsonResults.get_test_list(self._builder, input_results)
self.assertEqual(actual_results, expected_results)
def test_merge_null_incremental_results(self):
# Empty incremental results json.
# Nothing to merge.
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]}}},
# Incremental results
None,
# Expect no merge happens.
None)
def test_merge_empty_incremental_results(self):
# No actual incremental test results (only prefix and suffix) to merge.
# Nothing to merge.
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]}}},
# Incremental results
{"builds": [],
"tests": {}},
# Expected no merge happens.
None)
def test_merge_empty_aggregated_results(self):
# No existing aggregated results.
# Merged results == new incremental results.
self._test_merge(
# Aggregated results
None,
# Incremental results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]}}},
# Expected result
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]}}})
def test_merge_duplicate_build_number(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[100, "F"]],
"times": [[100, 0]]}}},
# Incremental results
{"builds": ["2"],
"tests": {"001.html": {
"results": [[1, "F"]],
"times": [[1, 0]]}}},
# Expected results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[100, "F"]],
"times": [[100, 0]]}}})
def test_merge_incremental_single_test_single_run_same_result(self):
# Incremental results has the latest build and same test results for
# that run.
# Insert the incremental results at the first place and sum number
# of runs for "F" (200 + 1) to get merged results.
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"F"]],
"times": [[1,0]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[201,"F"]],
"times": [[201,0]]}}})
def test_merge_single_test_single_run_different_result(self):
# Incremental results has the latest build but different test results
# for that run.
# Insert the incremental results at the first place.
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1, "I"]],
"times": [[1,1]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[1,"I"],[200,"F"]],
"times": [[1,1],[200,0]]}}})
def test_merge_single_test_single_run_result_changed(self):
# Incremental results has the latest build but results which differ from
# the latest result (but are the same as an older result).
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"],[10,"I"]],
"times": [[200,0],[10,1]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"I"]],
"times": [[1,1]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[1,"I"],[200,"F"],[10,"I"]],
"times": [[1,1],[200,0],[10,1]]}}})
def test_merge_multiple_tests_single_run(self):
# All tests have incremental updates.
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]},
"002.html": {
"results": [[100,"I"]],
"times": [[100,1]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"F"]],
"times": [[1,0]]},
"002.html": {
"results": [[1,"I"]],
"times": [[1,1]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[201,"F"]],
"times": [[201,0]]},
"002.html": {
"results": [[101,"I"]],
"times": [[101,1]]}}})
def test_merge_multiple_tests_single_run_one_no_result(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]},
"002.html": {
"results": [[100,"I"]],
"times": [[100,1]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"002.html": {
"results": [[1,"I"]],
"times": [[1,1]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[1,"N"],[200,"F"]],
"times": [[201,0]]},
"002.html": {
"results": [[101,"I"]],
"times": [[101,1]]}}})
def test_merge_single_test_multiple_runs(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]}}},
# Incremental results
{"builds": ["4", "3"],
"tests": {"001.html": {
"results": [[2, "I"]],
"times": [[2,2]]}}},
# Expected results
{"builds": ["4", "3", "2", "1"],
"tests": {"001.html": {
"results": [[2,"I"],[200,"F"]],
"times": [[2,2],[200,0]]}}})
def test_merge_multiple_tests_multiple_runs(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"F"]],
"times": [[200,0]]},
"002.html": {
"results": [[10,"Z"]],
"times": [[10,0]]}}},
# Incremental results
{"builds": ["4", "3"],
"tests": {"001.html": {
"results": [[2, "I"]],
"times": [[2,2]]},
"002.html": {
"results": [[1,"C"]],
"times": [[1,1]]}}},
# Expected results
{"builds": ["4", "3", "2", "1"],
"tests": {"001.html": {
"results": [[2,"I"],[200,"F"]],
"times": [[2,2],[200,0]]},
"002.html": {
"results": [[1,"C"],[10,"Z"]],
"times": [[1,1],[10,0]]}}})
def test_merge_incremental_result_older_build(self):
# Test the build in incremental results is older than the most recent
# build in aggregated results.
self._test_merge(
# Aggregated results
{"builds": ["3", "1"],
"tests": {"001.html": {
"results": [[5,"F"]],
"times": [[5,0]]}}},
# Incremental results
{"builds": ["2"],
"tests": {"001.html": {
"results": [[1, "F"]],
"times": [[1,0]]}}},
# Expected no merge happens.
{"builds": ["2", "3", "1"],
"tests": {"001.html": {
"results": [[6,"F"]],
"times": [[6,0]]}}})
def test_merge_incremental_result_same_build(self):
# Test the build in incremental results is same as the build in
# aggregated results.
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[5,"F"]],
"times": [[5,0]]}}},
# Incremental results
{"builds": ["3", "2"],
"tests": {"001.html": {
"results": [[2, "F"]],
"times": [[2,0]]}}},
# Expected no merge happens.
{"builds": ["3", "2", "2", "1"],
"tests": {"001.html": {
"results": [[7,"F"]],
"times": [[7,0]]}}})
def test_merge_remove_new_test(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[199, "F"]],
"times": [[199, 0]]},
}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1, "F"]],
"times": [[1, 0]]},
"002.html": {
"results": [[1, "P"]],
"times": [[1, 0]]},
"003.html": {
"results": [[1, "N"]],
"times": [[1, 0]]},
"004.html": {
"results": [[1, "X"]],
"times": [[1, 0]]},
}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[200, "F"]],
"times": [[200, 0]]},
}},
max_builds=200)
def test_merge_remove_test(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"P"]],
"times": [[200,0]]},
"002.html": {
"results": [[10,"F"]],
"times": [[10,0]]},
"003.html": {
"results": [[190, 'X'], [9, 'N'], [1,"F"]],
"times": [[200,0]]},
}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"P"]],
"times": [[1,0]]},
"002.html": {
"results": [[1,"P"]],
"times": [[1,0]]},
"003.html": {
"results": [[1,"P"]],
"times": [[1,0]]},
}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"002.html": {
"results": [[1,"P"],[10,"F"]],
"times": [[11,0]]}}},
max_builds=200)
def test_merge_keep_test_with_all_pass_but_slow_time(self):
# Do not remove test where all run pass but max running time >= 5 seconds
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[200,"P"]],
"times": [[200,jsonresults.JSON_RESULTS_MIN_TIME]]},
"002.html": {
"results": [[10,"F"]],
"times": [[10,0]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"P"]],
"times": [[1,1]]},
"002.html": {
"results": [[1,"P"]],
"times": [[1,0]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[201,"P"]],
"times": [[1,1],[200,jsonresults.JSON_RESULTS_MIN_TIME]]},
"002.html": {
"results": [[1,"P"],[10,"F"]],
"times": [[11,0]]}}})
def test_merge_prune_extra_results(self):
# Remove items from test results and times that exceed the max number
# of builds to track.
max_builds = jsonresults.JSON_RESULTS_MAX_BUILDS
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[max_builds,"F"],[1,"I"]],
"times": [[max_builds,0],[1,1]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"T"]],
"times": [[1,1]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[1,"T"],[max_builds,"F"]],
"times": [[1,1],[max_builds,0]]}}})
def test_merge_prune_extra_results_small(self):
# Remove items from test results and times that exceed the max number
# of builds to track, using smaller threshold.
max_builds = jsonresults.JSON_RESULTS_MAX_BUILDS_SMALL
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[max_builds,"F"],[1,"I"]],
"times": [[max_builds,0],[1,1]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"T"]],
"times": [[1,1]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[1,"T"],[max_builds,"F"]],
"times": [[1,1],[max_builds,0]]}}},
int(max_builds))
def test_merge_prune_extra_results_with_new_result_of_same_type(self):
# Test that merging in a new result of the same type as the last result
# causes old results to fall off.
max_builds = jsonresults.JSON_RESULTS_MAX_BUILDS_SMALL
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"001.html": {
"results": [[max_builds,"F"],[1,"N"]],
"times": [[max_builds,0],[1,1]]}}},
# Incremental results
{"builds": ["3"],
"tests": {"001.html": {
"results": [[1,"F"]],
"times": [[1,0]]}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"001.html": {
"results": [[max_builds,"F"]],
"times": [[max_builds,0]]}}},
int(max_builds))
# FIXME: Some data got corrupted and has results and times at the directory level.
# Once we've purged this from all the data, we should throw an error on this case.
def test_merge_directory_hierarchy_extra_results_and_times(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"baz": {
"003.html": {
"results": [[25,"F"]],
"times": [[25,0]]}},
"results": [[25,"F"]],
"times": [[25,0]]}},
# Incremental results
{"builds": ["3"],
"tests": {"baz": {
"003.html": {
"results": [[1,"F"]],
"times": [[1,0]]}}}},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"baz": {
"003.html": {
"results": [[26,"F"]],
"times": [[26,0]]}}},
"version": 4})
def test_merge_build_directory_hierarchy(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"bar": {"baz": {
"003.html": {
"results": [[25,"F"]],
"times": [[25,0]]}}},
"foo": {
"001.html": {
"results": [[50,"F"]],
"times": [[50,0]]},
"002.html": {
"results": [[100,"I"]],
"times": [[100,0]]}}},
"version": 4},
# Incremental results
{"builds": ["3"],
"tests": {"baz": {
"004.html": {
"results": [[1,"I"]],
"times": [[1,0]]}},
"foo": {
"001.html": {
"results": [[1,"F"]],
"times": [[1,0]]},
"002.html": {
"results": [[1,"I"]],
"times": [[1,0]]}}},
"version": 4},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"bar": {"baz": {
"003.html": {
"results": [[1,"N"],[25,"F"]],
"times": [[26,0]]}}},
"baz": {
"004.html": {
"results": [[1,"I"]],
"times": [[1,0]]}},
"foo": {
"001.html": {
"results": [[51,"F"]],
"times": [[51,0]]},
"002.html": {
"results": [[101,"I"]],
"times": [[101,0]]}}},
"version": 4})
# FIXME(aboxhall): Add some tests for xhtml/svg test results.
def test_get_test_name_list(self):
# Get test name list only. Don't include non-test-list data and
# of test result details.
# FIXME: This also tests a temporary bug in the data where directory-level
# results have a results and times values. Once that bug is fixed,
# remove this test-case and assert we don't ever hit it.
self._test_get_test_list(
# Input results
{"builds": ["3", "2", "1"],
"tests": {"foo": {
"001.html": {
"results": [[200,"P"]],
"times": [[200,0]]},
"results": [[1,"N"]],
"times": [[1,0]]},
"002.html": {
"results": [[10,"F"]],
"times": [[10,0]]}}},
# Expected results
{"foo": {"001.html":{}}, "002.html":{}})
def test_gtest(self):
self._test_merge(
# Aggregated results
{"builds": ["2", "1"],
"tests": {"foo.bar": {
"results": [[50,"F"]],
"times": [[50,0]]},
"foo.bar2": {
"results": [[100,"I"]],
"times": [[100,0]]},
},
"version": 3},
# Incremental results
{"builds": ["3"],
"tests": {"foo.bar2": {
"results": [[1,"I"]],
"times": [[1,0]]},
"foo.bar3": {
"results": [[1,"F"]],
"times": [[1,0]]},
},
"version": 4},
# Expected results
{"builds": ["3", "2", "1"],
"tests": {"foo.bar": {
"results": [[1, "N"], [50,"F"]],
"times": [[51,0]]},
"foo.bar2": {
"results": [[101,"I"]],
"times": [[101,0]]},
"foo.bar3": {
"results": [[1,"F"]],
"times": [[1,0]]},
},
"version": 4})
if __name__ == '__main__':
unittest.main()
|