| 1 |
# This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 |
|
| 5 |
import json |
| 6 |
import os |
| 7 |
from pathlib import Path |
| 8 |
|
| 9 |
import pytest |
| 10 |
from mozunit import main |
| 11 |
from skipfails import Kind, Skipfails |
| 12 |
|
| 13 |
DATA_PATH = Path(__file__).with_name("data") |
| 14 |
|
| 15 |
|
| 16 |
def test_get_revision(): |
| 17 |
"""Test get_revision""" |
| 18 |
|
| 19 |
sf = Skipfails() |
| 20 |
with pytest.raises(ValueError) as e_info: |
| 21 |
sf.get_revision("") |
| 22 |
assert str(e_info.value) == "try_url scheme not https" |
| 23 |
|
| 24 |
with pytest.raises(ValueError) as e_info: |
| 25 |
sf.get_revision("https://foo.bar") |
| 26 |
assert str(e_info.value) == "try_url server not treeherder.mozilla.org" |
| 27 |
|
| 28 |
with pytest.raises(ValueError) as e_info: |
| 29 |
sf.get_revision("https://treeherder.mozilla.org") |
| 30 |
assert str(e_info.value) == "try_url query missing" |
| 31 |
|
| 32 |
with pytest.raises(ValueError) as e_info: |
| 33 |
sf.get_revision("https://treeherder.mozilla.org?a=1") |
| 34 |
assert str(e_info.value) == "try_url query missing revision" |
| 35 |
|
| 36 |
revision, repo = sf.get_revision( |
| 37 |
"https://treeherder.mozilla.org/jobs?repo=try&revision=5b1738d0af571777199ff3c694b1590ff574946b" |
| 38 |
) |
| 39 |
assert revision == "5b1738d0af571777199ff3c694b1590ff574946b" |
| 40 |
assert repo == "try" |
| 41 |
|
| 42 |
|
| 43 |
def test_get_tasks(): |
| 44 |
"""Test get_tasks import of mozci""" |
| 45 |
|
| 46 |
from mozci.push import Push |
| 47 |
|
| 48 |
revision = "5b1738d0af571777199ff3c694b1590ff574946b" |
| 49 |
repo = "try" |
| 50 |
push = Push(revision, repo) |
| 51 |
assert push is not None |
| 52 |
|
| 53 |
|
| 54 |
def get_failures( |
| 55 |
tasks_name, exp_f_name, task_details=None, error_summary=None, implicit_vars=False |
| 56 |
): |
| 57 |
"""Runs Skipfails.get_failures on tasks to compare with failures""" |
| 58 |
sf = Skipfails(implicit_vars=implicit_vars) |
| 59 |
assert sf.implicit_vars == implicit_vars |
| 60 |
if task_details is not None: # preload task details cache, if needed |
| 61 |
if isinstance(task_details, str): # read file |
| 62 |
task_details = sf.read_json(DATA_PATH.joinpath(task_details)) |
| 63 |
sf.tasks = task_details |
| 64 |
if error_summary is not None: # preload task details cache, if needed |
| 65 |
if isinstance(error_summary, str): # read file |
| 66 |
error_summary = sf.read_json(DATA_PATH.joinpath(error_summary)) |
| 67 |
sf.error_summary = error_summary |
| 68 |
tasks = sf.read_tasks(DATA_PATH.joinpath(tasks_name)) |
| 69 |
exp_f = sf.read_failures(DATA_PATH.joinpath(exp_f_name)) |
| 70 |
expected_failures = json.dumps(exp_f, indent=2, sort_keys=True).strip() |
| 71 |
failures = sf.get_failures(tasks) |
| 72 |
actual_failures = json.dumps(failures, indent=2, sort_keys=True).strip() |
| 73 |
assert actual_failures == expected_failures |
| 74 |
|
| 75 |
|
| 76 |
def test_get_failures_1(): |
| 77 |
"""Test get_failures 1""" |
| 78 |
task_details = {"dwOJ8M9ERSmk6oI2KXg6hg": {}} |
| 79 |
get_failures("wayland-tasks-1.json", "wayland-failures-1.json", task_details) |
| 80 |
|
| 81 |
|
| 82 |
def test_get_failures_2(): |
| 83 |
"""Test get_failures 2""" |
| 84 |
task_details = { |
| 85 |
"Y7r1q2xWSu-2bRAofEfeBw": {}, |
| 86 |
"Z7r1q2xWSu-2bRAofEfeBw": {}, |
| 87 |
"X7r1q2xWSu-2bRAofEfeBw": {}, |
| 88 |
} |
| 89 |
get_failures("wayland-tasks-2.json", "wayland-failures-2.json", task_details) |
| 90 |
|
| 91 |
|
| 92 |
def test_get_failures_3(): |
| 93 |
"""Test get_failures 3""" |
| 94 |
task_details = { |
| 95 |
"b7_ahjGtQ_-ZMNBG_hUZUw": {}, |
| 96 |
"WVczuxkuSRKZg_jMiGyQsA": {}, |
| 97 |
"UOZUIVAaTZKmRwArq5WkDw": {}, |
| 98 |
} |
| 99 |
get_failures("wayland-tasks-3.json", "wayland-failures-3.json", task_details) |
| 100 |
|
| 101 |
|
| 102 |
def test_get_failures_4(): |
| 103 |
"""Test get_failures 4""" |
| 104 |
task_details = { |
| 105 |
"bxMVPbPMTru_bfAivc1sPA": {}, |
| 106 |
"EDql3NKPR3W6OEU3mLeKbg": {}, |
| 107 |
"FDql3NKPR3W6OEU3mLeKbg": {}, |
| 108 |
} |
| 109 |
get_failures("wayland-tasks-4.json", "wayland-failures-4.json", task_details) |
| 110 |
|
| 111 |
|
| 112 |
def test_get_failures_5(): |
| 113 |
"""Test get_failures 5""" |
| 114 |
|
| 115 |
task_details = { |
| 116 |
"Bgc6We1sSjakIo3V9crldw": { |
| 117 |
"expires": "2024-01-09T16:05:56.825Z", |
| 118 |
"extra": { |
| 119 |
"suite": "mochitest-browser", |
| 120 |
"test-setting": { |
| 121 |
"build": {"type": "opt"}, |
| 122 |
"platform": { |
| 123 |
"arch": "64", |
| 124 |
"os": {"name": "linux", "version": "22.04"}, |
| 125 |
"display": "wayland", |
| 126 |
}, |
| 127 |
"runtime": {}, |
| 128 |
}, |
| 129 |
}, |
| 130 |
} |
| 131 |
} |
| 132 |
get_failures("wayland-tasks-5.json", "wayland-failures-5.json", task_details) |
| 133 |
|
| 134 |
|
| 135 |
def test_get_failures_6(): |
| 136 |
"""Test get_failures 6""" |
| 137 |
|
| 138 |
task_details = { |
| 139 |
"AKYqxtoWStigj_5yHVqAeg": { |
| 140 |
"expires": "2024-03-19T03:29:11.050Z", |
| 141 |
"extra": { |
| 142 |
"suite": "web-platform-tests", |
| 143 |
"test-setting": { |
| 144 |
"build": { |
| 145 |
"type": "opt", |
| 146 |
"shippable": True, |
| 147 |
}, |
| 148 |
"platform": { |
| 149 |
"arch": "32", |
| 150 |
"os": {"name": "linux", "version": "1804"}, |
| 151 |
}, |
| 152 |
"runtime": {}, |
| 153 |
}, |
| 154 |
}, |
| 155 |
} |
| 156 |
} |
| 157 |
get_failures("wpt-tasks-1.json", "wpt-failures-1.json", task_details) |
| 158 |
|
| 159 |
|
| 160 |
def test_get_failures_7(): |
| 161 |
"""Test get_failures 7""" |
| 162 |
|
| 163 |
get_failures( |
| 164 |
"reftest-tasks-1.json", |
| 165 |
"reftest-failures-1.json", |
| 166 |
"reftest-extra-1.json", |
| 167 |
"reftest-summary-1.json", |
| 168 |
True, |
| 169 |
) |
| 170 |
|
| 171 |
|
| 172 |
def test_get_bug_by_id(): |
| 173 |
"""Test get_bug_by_id""" |
| 174 |
|
| 175 |
sf = Skipfails() |
| 176 |
id = 1682371 |
| 177 |
# preload bug cache |
| 178 |
bugs_filename = f"bug-{id}.json" |
| 179 |
sf.bugs = sf.read_bugs(DATA_PATH.joinpath(bugs_filename)) |
| 180 |
# function under test |
| 181 |
bug = sf.get_bug_by_id(id) |
| 182 |
assert bug is not None |
| 183 |
assert bug.id == id |
| 184 |
assert bug.product == "Testing" |
| 185 |
assert bug.component == "General" |
| 186 |
assert ( |
| 187 |
bug.summary |
| 188 |
== "create tool to quickly parse and identify all failures from a try push and ideally annotate manifests" |
| 189 |
) |
| 190 |
|
| 191 |
|
| 192 |
def test_get_bugs_by_summary(): |
| 193 |
"""Test get_bugs_by_summary""" |
| 194 |
|
| 195 |
sf = Skipfails() |
| 196 |
id = 1682371 |
| 197 |
# preload bug cache |
| 198 |
bugs_filename = f"bug-{id}.json" |
| 199 |
sf.bugs = sf.read_bugs(DATA_PATH.joinpath(bugs_filename)) |
| 200 |
# function under test |
| 201 |
summary = "create tool to quickly parse and identify all failures from a try push and ideally annotate manifests" |
| 202 |
bugs = sf.get_bugs_by_summary(summary) |
| 203 |
assert len(bugs) == 1 |
| 204 |
assert bugs[0].id == id |
| 205 |
assert bugs[0].product == "Testing" |
| 206 |
assert bugs[0].component == "General" |
| 207 |
assert bugs[0].summary == summary |
| 208 |
|
| 209 |
|
| 210 |
def test_get_variants(): |
| 211 |
"""Test get_variants""" |
| 212 |
|
| 213 |
sf = Skipfails() |
| 214 |
variants = sf.get_variants() |
| 215 |
assert "1proc" in variants |
| 216 |
assert variants["1proc"] == "e10s" |
| 217 |
assert "webrender-sw" in variants |
| 218 |
assert variants["webrender-sw"] == "swgl" |
| 219 |
assert "aab" in variants |
| 220 |
assert variants["aab"] == "aab" |
| 221 |
|
| 222 |
|
| 223 |
def test_task_to_skip_if(): |
| 224 |
"""Test task_to_skip_if""" |
| 225 |
|
| 226 |
# Windows 2009 task |
| 227 |
sf = Skipfails() |
| 228 |
task_id = "UP-t3xrGSDWvUNjFGIt_aQ" |
| 229 |
task_details = { |
| 230 |
"expires": "2024-01-09T16:05:56.825Z", |
| 231 |
"extra": { |
| 232 |
"suite": "mochitest-plain", |
| 233 |
"test-setting": { |
| 234 |
"build": {"type": "debug"}, |
| 235 |
"platform": { |
| 236 |
"arch": "32", |
| 237 |
"os": {"build": "24h2", "name": "windows", "version": "11"}, |
| 238 |
}, |
| 239 |
"runtime": {}, |
| 240 |
}, |
| 241 |
}, |
| 242 |
} |
| 243 |
sf.tasks[task_id] = task_details |
| 244 |
sf.platform_permutations = { |
| 245 |
"test-manifest": { |
| 246 |
"win": { |
| 247 |
"11.26100": { |
| 248 |
"x86": {"debug": {"no_variant": {}}, "opt": {"no_variant": {}}} |
| 249 |
} |
| 250 |
} |
| 251 |
} |
| 252 |
} |
| 253 |
# function under test |
| 254 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 255 |
assert ( |
| 256 |
skip_if |
| 257 |
== "os == 'win' && os_version == '11.26100' && processor == 'x86' && debug" |
| 258 |
) |
| 259 |
|
| 260 |
# Failed task on specific runtime on x86_64 |
| 261 |
sf = Skipfails() |
| 262 |
task_id = "I3iXyGDATDSDyzGh4YfNJw" |
| 263 |
task_details = { |
| 264 |
"expires": "2024-01-09T16:05:56.825Z", |
| 265 |
"extra": { |
| 266 |
"suite": "web-platform-tests-crashtest", |
| 267 |
"test-setting": { |
| 268 |
"build": {"type": "debug"}, |
| 269 |
"platform": { |
| 270 |
"arch": "64", |
| 271 |
"os": {"name": "macosx", "version": "1015"}, |
| 272 |
}, |
| 273 |
"runtime": {"webrender-sw": True}, |
| 274 |
}, |
| 275 |
}, |
| 276 |
} |
| 277 |
sf.tasks[task_id] = task_details |
| 278 |
sf.platform_permutations = { |
| 279 |
"test-manifest": { |
| 280 |
"mac": { |
| 281 |
"10.15": { |
| 282 |
"x86_64": { |
| 283 |
"debug": {"swgl": {}, "no_variant": {}}, |
| 284 |
"opt": {"no_variant": {}}, |
| 285 |
} |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
} |
| 290 |
# function under test |
| 291 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 292 |
assert ( |
| 293 |
skip_if |
| 294 |
== "os == 'mac' && os_version == '10.15' && processor == 'x86_64' && debug && swgl" |
| 295 |
) |
| 296 |
|
| 297 |
# Failed task on specific runtime on aarch64 |
| 298 |
sf = Skipfails() |
| 299 |
task_id = "bAkMaQIVQp6oeEIW6fzBDw" |
| 300 |
task_details = { |
| 301 |
"expires": "2024-01-09T16:05:56.825Z", |
| 302 |
"extra": { |
| 303 |
"suite": "mochitest-media", |
| 304 |
"test-setting": { |
| 305 |
"build": {"type": "debug"}, |
| 306 |
"platform": { |
| 307 |
"arch": "aarch64", |
| 308 |
"os": {"name": "macosx", "version": "1015"}, |
| 309 |
}, |
| 310 |
"runtime": {"webrender-sw": True}, |
| 311 |
}, |
| 312 |
}, |
| 313 |
} |
| 314 |
sf.tasks[task_id] = task_details |
| 315 |
sf.platform_permutations = { |
| 316 |
"test-manifest": { |
| 317 |
"mac": { |
| 318 |
"10.15": { |
| 319 |
"aarch64": { |
| 320 |
"debug": {"swgl": {}, "no_variant": {}}, |
| 321 |
"opt": {"no_variant": {}}, |
| 322 |
} |
| 323 |
} |
| 324 |
} |
| 325 |
} |
| 326 |
} |
| 327 |
# function under test |
| 328 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 329 |
assert ( |
| 330 |
skip_if |
| 331 |
== "os == 'mac' && os_version == '10.15' && processor == 'aarch64' && debug && swgl" |
| 332 |
) |
| 333 |
|
| 334 |
# Hacks for macosx 11 |
| 335 |
sf = Skipfails() |
| 336 |
task_id = "bAkMaQIVQp6oeEIW6fzBDw" |
| 337 |
task_details = { |
| 338 |
"expires": "2024-01-09T16:05:56.825Z", |
| 339 |
"extra": { |
| 340 |
"suite": "mochitest-media", |
| 341 |
"test-setting": { |
| 342 |
"build": {"type": "debug"}, |
| 343 |
"platform": { |
| 344 |
"arch": "aarch64", |
| 345 |
"os": {"name": "macosx", "version": "1100"}, |
| 346 |
}, |
| 347 |
"runtime": {"webrender-sw": True}, |
| 348 |
}, |
| 349 |
}, |
| 350 |
} |
| 351 |
sf.tasks[task_id] = task_details |
| 352 |
sf.platform_permutations = { |
| 353 |
"test-manifest": { |
| 354 |
"mac": { |
| 355 |
"11.20": { |
| 356 |
"aarch64": { |
| 357 |
"debug": {"swgl": {}, "no_variant": {}}, |
| 358 |
"opt": {"no_variant": {}}, |
| 359 |
} |
| 360 |
} |
| 361 |
} |
| 362 |
} |
| 363 |
} |
| 364 |
# function under test |
| 365 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 366 |
assert ( |
| 367 |
skip_if |
| 368 |
== "os == 'mac' && os_version == '11.20' && arch == 'aarch64' && debug && swgl" |
| 369 |
) |
| 370 |
|
| 371 |
# Do not include build type or test variant if everything failed |
| 372 |
sf = Skipfails() |
| 373 |
task_id = "AKYqxtoWStigj_5yHVqAeg" |
| 374 |
task_details = { |
| 375 |
"expires": "2024-03-19T03:29:11.050Z", |
| 376 |
"extra": { |
| 377 |
"suite": "web-platform-tests", |
| 378 |
"test-setting": { |
| 379 |
"build": { |
| 380 |
"type": "opt", |
| 381 |
}, |
| 382 |
"platform": { |
| 383 |
"arch": "32", |
| 384 |
"os": {"name": "linux", "version": "1804"}, |
| 385 |
}, |
| 386 |
"runtime": {}, |
| 387 |
}, |
| 388 |
}, |
| 389 |
} |
| 390 |
sf.tasks[task_id] = task_details |
| 391 |
sf.platform_permutations = { |
| 392 |
"test-manifest": {"linux": {"18.04": {"x86": {"opt": {"no_variant": {}}}}}} |
| 393 |
} |
| 394 |
# function under test |
| 395 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 396 |
assert skip_if == "os == 'linux' && os_version == '18.04' && processor == 'x86'" |
| 397 |
|
| 398 |
sf = Skipfails() |
| 399 |
task_id = "QFo2jGFvTKGVcoqHCBpMGw" |
| 400 |
task_details = { |
| 401 |
"expires": "2024-03-19T03:29:11.050Z", |
| 402 |
"extra": { |
| 403 |
"suite": "web-platform-tests", |
| 404 |
"test-setting": { |
| 405 |
"build": { |
| 406 |
"type": "opt", |
| 407 |
}, |
| 408 |
"platform": { |
| 409 |
"arch": "32", |
| 410 |
"os": {"name": "linux", "version": "1804"}, |
| 411 |
}, |
| 412 |
"runtime": {"xorigin": True}, |
| 413 |
}, |
| 414 |
}, |
| 415 |
} |
| 416 |
sf.tasks[task_id] = task_details |
| 417 |
sf.platform_permutations = { |
| 418 |
"test-manifest": {"linux": {"18.04": {"x86": {"opt": {"xorigin": {}}}}}} |
| 419 |
} |
| 420 |
# function under test |
| 421 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 422 |
assert skip_if == "os == 'linux' && os_version == '18.04' && processor == 'x86'" |
| 423 |
|
| 424 |
# Only the test without variant failed |
| 425 |
sf = Skipfails() |
| 426 |
task_id = "Xvdt2gbEQ3iDVAZPddY9PQ" |
| 427 |
task_details = { |
| 428 |
"expires": "2024-03-19T03:29:11.050Z", |
| 429 |
"extra": { |
| 430 |
"suite": "web-platform-tests", |
| 431 |
"test-setting": { |
| 432 |
"build": { |
| 433 |
"type": "opt", |
| 434 |
}, |
| 435 |
"platform": { |
| 436 |
"arch": "32", |
| 437 |
"os": {"name": "linux", "version": "1804"}, |
| 438 |
}, |
| 439 |
"runtime": {}, |
| 440 |
}, |
| 441 |
}, |
| 442 |
} |
| 443 |
sf.tasks[task_id] = task_details |
| 444 |
sf.platform_permutations = { |
| 445 |
"test-manifest": { |
| 446 |
"linux": {"18.04": {"x86": {"opt": {"no_variant": {}, "xorigin": {}}}}} |
| 447 |
} |
| 448 |
} |
| 449 |
# function under test |
| 450 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 451 |
assert ( |
| 452 |
skip_if |
| 453 |
== "os == 'linux' && os_version == '18.04' && processor == 'x86' && opt && !xorigin" |
| 454 |
) |
| 455 |
|
| 456 |
# Missing platform permutation for the task |
| 457 |
sf = Skipfails() |
| 458 |
task_id = "czj2mQwqQv6PwON5aijPJg" |
| 459 |
task_details = { |
| 460 |
"expires": "2024-03-19T03:29:11.050Z", |
| 461 |
"extra": { |
| 462 |
"suite": "web-platform-tests", |
| 463 |
"test-setting": { |
| 464 |
"build": { |
| 465 |
"type": "opt", |
| 466 |
}, |
| 467 |
"platform": { |
| 468 |
"arch": "32", |
| 469 |
"os": {"name": "linux", "version": "1804"}, |
| 470 |
}, |
| 471 |
"runtime": {}, |
| 472 |
}, |
| 473 |
}, |
| 474 |
} |
| 475 |
sf.tasks[task_id] = task_details |
| 476 |
sf.platform_permutations = {} |
| 477 |
# function under test |
| 478 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 479 |
assert ( |
| 480 |
skip_if == "os == 'linux' && os_version == '18.04' && processor == 'x86' && opt" |
| 481 |
) |
| 482 |
|
| 483 |
sf = Skipfails() |
| 484 |
task_id = "czj2mQwqQv6PwON5aijPJg" |
| 485 |
task_details = { |
| 486 |
"expires": "2024-03-19T03:29:11.050Z", |
| 487 |
"extra": { |
| 488 |
"suite": "web-platform-tests", |
| 489 |
"test-setting": { |
| 490 |
"build": { |
| 491 |
"type": "opt", |
| 492 |
}, |
| 493 |
"platform": { |
| 494 |
"arch": "32", |
| 495 |
"os": {"name": "linux", "version": "1804"}, |
| 496 |
}, |
| 497 |
"runtime": {"xorigin": True}, |
| 498 |
}, |
| 499 |
}, |
| 500 |
} |
| 501 |
sf.tasks[task_id] = task_details |
| 502 |
sf.platform_permutations = {} |
| 503 |
# function under test |
| 504 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 505 |
assert ( |
| 506 |
skip_if |
| 507 |
== "os == 'linux' && os_version == '18.04' && processor == 'x86' && opt && xorigin" |
| 508 |
) |
| 509 |
|
| 510 |
# Full fail with everal tasks |
| 511 |
sf = Skipfails() |
| 512 |
sf.platform_permutations = { |
| 513 |
"test-manifest": { |
| 514 |
"linux": { |
| 515 |
"18.04": { |
| 516 |
"x86": { |
| 517 |
"opt": {"no_variant": {}, "xorigin": {}}, |
| 518 |
"debug": {"no_variant": {}}, |
| 519 |
} |
| 520 |
} |
| 521 |
} |
| 522 |
} |
| 523 |
} |
| 524 |
task_id = "PPWic3zuRIyGdzUXC-XCvw" |
| 525 |
task_details = { |
| 526 |
"expires": "2024-03-19T03:29:11.050Z", |
| 527 |
"extra": { |
| 528 |
"suite": "web-platform-tests", |
| 529 |
"test-setting": { |
| 530 |
"build": { |
| 531 |
"type": "opt", |
| 532 |
}, |
| 533 |
"platform": { |
| 534 |
"arch": "32", |
| 535 |
"os": {"name": "linux", "version": "1804"}, |
| 536 |
}, |
| 537 |
"runtime": {"xorigin": True}, |
| 538 |
}, |
| 539 |
}, |
| 540 |
} |
| 541 |
sf.tasks[task_id] = task_details |
| 542 |
# function under test |
| 543 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 544 |
assert ( |
| 545 |
skip_if |
| 546 |
== "os == 'linux' && os_version == '18.04' && processor == 'x86' && opt && xorigin" |
| 547 |
) |
| 548 |
|
| 549 |
task_id = "c_OXt3mESB-G-aElu0hoxg" |
| 550 |
task_details = { |
| 551 |
"expires": "2024-03-19T03:29:11.050Z", |
| 552 |
"extra": { |
| 553 |
"suite": "web-platform-tests", |
| 554 |
"test-setting": { |
| 555 |
"build": { |
| 556 |
"type": "opt", |
| 557 |
}, |
| 558 |
"platform": { |
| 559 |
"arch": "32", |
| 560 |
"os": {"name": "linux", "version": "1804"}, |
| 561 |
}, |
| 562 |
"runtime": {}, |
| 563 |
}, |
| 564 |
}, |
| 565 |
} |
| 566 |
sf.tasks[task_id] = task_details |
| 567 |
# function under test |
| 568 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 569 |
assert ( |
| 570 |
skip_if == "os == 'linux' && os_version == '18.04' && processor == 'x86' && opt" |
| 571 |
) |
| 572 |
|
| 573 |
task_id = "ShPeY1F8SY6Gm-1VSjsyUA" |
| 574 |
task_details = { |
| 575 |
"expires": "2024-03-19T03:29:11.050Z", |
| 576 |
"extra": { |
| 577 |
"suite": "web-platform-tests", |
| 578 |
"test-setting": { |
| 579 |
"build": { |
| 580 |
"type": "debug", |
| 581 |
}, |
| 582 |
"platform": { |
| 583 |
"arch": "32", |
| 584 |
"os": {"name": "linux", "version": "1804"}, |
| 585 |
}, |
| 586 |
"runtime": {}, |
| 587 |
}, |
| 588 |
}, |
| 589 |
} |
| 590 |
sf.tasks[task_id] = task_details |
| 591 |
# function under test |
| 592 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 593 |
assert skip_if == "os == 'linux' && os_version == '18.04' && processor == 'x86'" |
| 594 |
|
| 595 |
# Multiple failed tasks allowing for optimized skip if |
| 596 |
sf = Skipfails() |
| 597 |
sf.platform_permutations = { |
| 598 |
"test-manifest": { |
| 599 |
"linux": { |
| 600 |
"18.04": { |
| 601 |
"x86": { |
| 602 |
"opt": {"no_variant": {}}, |
| 603 |
"debug": {"no_variant": {}, "xorigin": {}}, |
| 604 |
} |
| 605 |
} |
| 606 |
} |
| 607 |
} |
| 608 |
} |
| 609 |
task_id = "Zc17K1IQRXOsGoSgegA_kA" |
| 610 |
task_details = { |
| 611 |
"expires": "2024-03-19T03:29:11.050Z", |
| 612 |
"extra": { |
| 613 |
"suite": "web-platform-tests", |
| 614 |
"test-setting": { |
| 615 |
"build": { |
| 616 |
"type": "debug", |
| 617 |
}, |
| 618 |
"platform": { |
| 619 |
"arch": "32", |
| 620 |
"os": {"name": "linux", "version": "1804"}, |
| 621 |
}, |
| 622 |
"runtime": {"xorigin": True}, |
| 623 |
}, |
| 624 |
}, |
| 625 |
} |
| 626 |
sf.tasks[task_id] = task_details |
| 627 |
# function under test |
| 628 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 629 |
assert ( |
| 630 |
skip_if |
| 631 |
== "os == 'linux' && os_version == '18.04' && processor == 'x86' && debug && xorigin" |
| 632 |
) |
| 633 |
|
| 634 |
task_id = "ChOXnndsQQODAGpDqscbMg" |
| 635 |
task_details = { |
| 636 |
"expires": "2024-03-19T03:29:11.050Z", |
| 637 |
"extra": { |
| 638 |
"suite": "web-platform-tests", |
| 639 |
"test-setting": { |
| 640 |
"build": { |
| 641 |
"type": "debug", |
| 642 |
}, |
| 643 |
"platform": { |
| 644 |
"arch": "32", |
| 645 |
"os": {"name": "linux", "version": "1804"}, |
| 646 |
}, |
| 647 |
"runtime": {}, |
| 648 |
}, |
| 649 |
}, |
| 650 |
} |
| 651 |
sf.tasks[task_id] = task_details |
| 652 |
# function under test |
| 653 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 654 |
assert ( |
| 655 |
skip_if |
| 656 |
== "os == 'linux' && os_version == '18.04' && processor == 'x86' && debug" |
| 657 |
) |
| 658 |
|
| 659 |
task_id = "caDMGUmnT7muCqNWj6w3nQ" |
| 660 |
task_details = { |
| 661 |
"expires": "2024-03-19T03:29:11.050Z", |
| 662 |
"extra": { |
| 663 |
"suite": "web-platform-tests", |
| 664 |
"test-setting": { |
| 665 |
"build": { |
| 666 |
"type": "opt", |
| 667 |
}, |
| 668 |
"platform": { |
| 669 |
"arch": "32", |
| 670 |
"os": {"name": "linux", "version": "1804"}, |
| 671 |
}, |
| 672 |
"runtime": {}, |
| 673 |
}, |
| 674 |
}, |
| 675 |
} |
| 676 |
sf.tasks[task_id] = task_details |
| 677 |
# function under test |
| 678 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.TOML, "test-path") |
| 679 |
assert skip_if == "os == 'linux' && os_version == '18.04' && processor == 'x86'" |
| 680 |
|
| 681 |
|
| 682 |
def test_task_to_skip_if_wpt(): |
| 683 |
"""Test task_to_skip_if_wpt""" |
| 684 |
|
| 685 |
# preload task cache |
| 686 |
task_id = "AKYqxtoWStigj_5yHVqAeg" |
| 687 |
task_details = { |
| 688 |
"expires": "2024-03-19T03:29:11.050Z", |
| 689 |
"extra": { |
| 690 |
"suite": "web-platform-tests", |
| 691 |
"test-setting": { |
| 692 |
"build": { |
| 693 |
"type": "opt", |
| 694 |
"shippable": True, |
| 695 |
}, |
| 696 |
"platform": { |
| 697 |
"arch": "32", |
| 698 |
"os": {"name": "linux", "version": "1804"}, |
| 699 |
}, |
| 700 |
"runtime": {}, |
| 701 |
}, |
| 702 |
}, |
| 703 |
} |
| 704 |
sf = Skipfails() |
| 705 |
sf.tasks[task_id] = task_details |
| 706 |
sf.platform_permutations = { |
| 707 |
"test-manifest": { |
| 708 |
"linux": { |
| 709 |
"18.04": { |
| 710 |
"x86": {"debug": {"no_variant": {}}, "opt": {"no_variant": {}}} |
| 711 |
} |
| 712 |
} |
| 713 |
} |
| 714 |
} |
| 715 |
# function under test |
| 716 |
skip_if = sf.task_to_skip_if("test-manifest", task_id, Kind.WPT, "test-path") |
| 717 |
assert ( |
| 718 |
skip_if |
| 719 |
== 'os == "linux" and os_version == "18.04" and processor == "x86" and opt' |
| 720 |
) |
| 721 |
|
| 722 |
|
| 723 |
def test_task_to_skip_if_reftest(): |
| 724 |
"""Test task_to_skip_if_reftest""" |
| 725 |
|
| 726 |
# preload task cache |
| 727 |
task_id = "AKYqxtoWStigj_5yHVqAeg" |
| 728 |
task_details = { |
| 729 |
"expires": "2024-03-19T03:29:11.050Z", |
| 730 |
"extra": { |
| 731 |
"suite": "reftest", |
| 732 |
"test-setting": { |
| 733 |
"build": { |
| 734 |
"type": "opt", |
| 735 |
"shippable": True, |
| 736 |
}, |
| 737 |
"platform": { |
| 738 |
"arch": "32", |
| 739 |
"os": {"name": "linux", "version": "1804"}, |
| 740 |
}, |
| 741 |
"runtime": {}, |
| 742 |
}, |
| 743 |
}, |
| 744 |
} |
| 745 |
sf = Skipfails(implicit_vars=True) |
| 746 |
sf.tasks[task_id] = task_details |
| 747 |
# function under test |
| 748 |
skip_if = sf.task_to_skip_if("", task_id, Kind.LIST, "test-path") |
| 749 |
assert skip_if == "gtkWidget&&optimized&&!is64Bit" |
| 750 |
|
| 751 |
|
| 752 |
def test_task_to_skip_if_reftest2(): |
| 753 |
"""Test task_to_skip_if_reftest2""" |
| 754 |
|
| 755 |
# preload task cache |
| 756 |
task_id = "ajp7DRgGQbyfnIAklKA7Tw" |
| 757 |
task_details = { |
| 758 |
"expires": "2024-03-19T03:29:11.050Z", |
| 759 |
"extra": { |
| 760 |
"suite": "reftest", |
| 761 |
"test-setting": { |
| 762 |
"build": {"tsan": True, "type": "opt"}, |
| 763 |
"runtime": {"webrender-sw": True}, |
| 764 |
"platform": {"os": {"name": "linux", "version": "1804"}, "arch": "64"}, |
| 765 |
}, |
| 766 |
}, |
| 767 |
} |
| 768 |
sf = Skipfails(implicit_vars=True) |
| 769 |
sf.tasks[task_id] = task_details |
| 770 |
# function under test |
| 771 |
skip_if = sf.task_to_skip_if("", task_id, Kind.LIST, "test-path") |
| 772 |
assert skip_if == "gtkWidget&&ThreadSanitizer&&swgl" |
| 773 |
|
| 774 |
|
| 775 |
def test_task_to_skip_if_reftest3(): |
| 776 |
"""Test task_to_skip_if_reftest3""" |
| 777 |
|
| 778 |
# preload task cache |
| 779 |
task_id = "UP-t3xrGSDWvUNjFGIt_aQ" |
| 780 |
task_details = { |
| 781 |
"expires": "2024-01-09T16:05:56.825Z", |
| 782 |
"extra": { |
| 783 |
"suite": "mochitest-plain", |
| 784 |
"test-setting": { |
| 785 |
"build": {"type": "debug"}, |
| 786 |
"platform": { |
| 787 |
"arch": "32", |
| 788 |
"os": {"build": "24h2", "name": "windows", "version": "11"}, |
| 789 |
}, |
| 790 |
"runtime": {}, |
| 791 |
}, |
| 792 |
}, |
| 793 |
} |
| 794 |
sf = Skipfails(implicit_vars=False) |
| 795 |
sf.tasks[task_id] = task_details |
| 796 |
# function under test |
| 797 |
skip_if = sf.task_to_skip_if("", task_id, Kind.LIST, "test-path") |
| 798 |
assert skip_if == "winWidget&&isDebugBuild&&fission&&!is64Bit&&!swgl&&!nogpu" |
| 799 |
|
| 800 |
|
| 801 |
def test_task_to_skip_if_reftest4(): |
| 802 |
"""Test task_to_skip_if_reftest4""" |
| 803 |
|
| 804 |
# preload task cache |
| 805 |
task_id = "ajp7DRgGQbyfnIAklKA7Tw" |
| 806 |
task_details = { |
| 807 |
"expires": "2024-03-19T03:29:11.050Z", |
| 808 |
"extra": { |
| 809 |
"suite": "reftest", |
| 810 |
"test-setting": { |
| 811 |
"build": {"tsan": True, "type": "opt"}, |
| 812 |
"runtime": {}, |
| 813 |
"platform": {"os": {"name": "linux", "version": "1804"}, "arch": "64"}, |
| 814 |
}, |
| 815 |
}, |
| 816 |
} |
| 817 |
sf = Skipfails(implicit_vars=False) |
| 818 |
sf.tasks[task_id] = task_details |
| 819 |
# function under test |
| 820 |
skip_if = sf.task_to_skip_if("", task_id, Kind.LIST, "test-path") |
| 821 |
assert skip_if == "gtkWidget&&ThreadSanitizer&&fission&&!swgl&&!nogpu" |
| 822 |
|
| 823 |
|
| 824 |
def test_wpt_add_skip_if(): |
| 825 |
"""Test wpt_add_skip_if""" |
| 826 |
|
| 827 |
sf = Skipfails() |
| 828 |
manifest_before1 = "" |
| 829 |
anyjs = {} |
| 830 |
filename = "myfile.html" |
| 831 |
anyjs[filename] = False |
| 832 |
skip_if = 'os == "linux" and processor == "x86" and not debug' |
| 833 |
bug_reference = "Bug 123" |
| 834 |
disabled = " disabled:\n" |
| 835 |
condition = " if " + skip_if + ": " + bug_reference + "\n" |
| 836 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 837 |
manifest_before1, anyjs, skip_if, bug_reference |
| 838 |
) |
| 839 |
manifest_expected1 = "[myfile.html]\n" + disabled + condition + "\n" |
| 840 |
assert manifest_str == manifest_expected1 |
| 841 |
manifest_before2 = """[myfile.html] |
| 842 |
expected: |
| 843 |
if fission: [OK, FAIL] |
| 844 |
[< [Test 5\\] 1 out of 2 assertions were failed.] |
| 845 |
expected: FAIL |
| 846 |
""" |
| 847 |
manifest_expected2 = ( |
| 848 |
"""[myfile.html] |
| 849 |
expected: |
| 850 |
if fission: [OK, FAIL] |
| 851 |
""" |
| 852 |
+ disabled |
| 853 |
+ condition |
| 854 |
+ """ |
| 855 |
[< [Test 5\\] 1 out of 2 assertions were failed.] |
| 856 |
expected: FAIL |
| 857 |
""" |
| 858 |
) |
| 859 |
anyjs[filename] = False |
| 860 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 861 |
manifest_before2, anyjs, skip_if, bug_reference |
| 862 |
) |
| 863 |
assert manifest_str == manifest_expected2 |
| 864 |
anyjs[filename] = False |
| 865 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 866 |
manifest_expected2, anyjs, skip_if, bug_reference |
| 867 |
) |
| 868 |
assert manifest_str == manifest_expected2 |
| 869 |
manifest_before4 = """;https: //bugzilla.mozilla.org/show_bug.cgi?id=1838684 |
| 870 |
expected: [FAIL, PASS] |
| 871 |
[custom-highlight-painting-overlapping-highlights-002.html] |
| 872 |
expected: |
| 873 |
[PASS, FAIL] |
| 874 |
""" |
| 875 |
anyjs[filename] = False |
| 876 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 877 |
manifest_before4, anyjs, skip_if, bug_reference |
| 878 |
) |
| 879 |
manifest_expected4 = manifest_before4 + "\n" + manifest_expected1 |
| 880 |
assert manifest_str == manifest_expected4 |
| 881 |
manifest_before5 = """[myfile.html] |
| 882 |
disabled: |
| 883 |
if os == 'win' && os_version == '11.26100' && processor == '32' && debug: Bug 456 |
| 884 |
""" |
| 885 |
anyjs[filename] = False |
| 886 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 887 |
manifest_before5, anyjs, skip_if, bug_reference |
| 888 |
) |
| 889 |
manifest_expected5 = manifest_before5 + condition + "\n" |
| 890 |
assert manifest_str == manifest_expected5 |
| 891 |
manifest_before6 = """[myfile.html] |
| 892 |
[Window Size] |
| 893 |
expected: |
| 894 |
if product == "firefox_android": FAIL |
| 895 |
""" |
| 896 |
anyjs[filename] = False |
| 897 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 898 |
manifest_before6, anyjs, skip_if, bug_reference |
| 899 |
) |
| 900 |
manifest_expected6 = ( |
| 901 |
"""[myfile.html] |
| 902 |
disabled: |
| 903 |
""" |
| 904 |
+ condition |
| 905 |
+ """ |
| 906 |
[Window Size] |
| 907 |
expected: |
| 908 |
if product == "firefox_android": FAIL |
| 909 |
""" |
| 910 |
) |
| 911 |
assert manifest_str == manifest_expected6 |
| 912 |
manifest_before7 = """[myfile.html] |
| 913 |
fuzzy: |
| 914 |
if os == "android": maxDifference=0-255;totalPixels=0-105 # bug 1392254 |
| 915 |
if os == "linux": maxDifference=0-255;totalPixels=0-136 # bug 1599638 |
| 916 |
maxDifference=0-1;totalPixels=0-80 |
| 917 |
disabled: |
| 918 |
if os == "win": https://bugzilla.mozilla.org/show_bug.cgi?id=1314684 |
| 919 |
""" |
| 920 |
anyjs[filename] = False |
| 921 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 922 |
manifest_before7, anyjs, skip_if, bug_reference |
| 923 |
) |
| 924 |
manifest_expected7 = manifest_before7 + condition + "\n" |
| 925 |
assert manifest_str == manifest_expected7 |
| 926 |
manifest_before8 = """[myfile.html] |
| 927 |
disabled: |
| 928 |
if os == "linux" and os_version == "22.04" and processor == "x86_64" and debug and display == "wayland": Bug TBD |
| 929 |
expected: |
| 930 |
if swgl and (os == "linux") and debug and not fission: [PASS, FAIL] |
| 931 |
|
| 932 |
""" |
| 933 |
anyjs[filename] = False |
| 934 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 935 |
manifest_before8, anyjs, skip_if, bug_reference |
| 936 |
) |
| 937 |
manifest_expected8 = ( |
| 938 |
"""[myfile.html] |
| 939 |
disabled: |
| 940 |
if os == "linux" and os_version == "22.04" and processor == "x86_64" and debug and display == "wayland": Bug TBD |
| 941 |
""" |
| 942 |
+ condition |
| 943 |
+ """ expected: |
| 944 |
if swgl and (os == "linux") and debug and not fission: [PASS, FAIL] |
| 945 |
|
| 946 |
""" |
| 947 |
) |
| 948 |
assert manifest_str == manifest_expected8 |
| 949 |
manifest_before9 = """[myfile.html] |
| 950 |
disabled: |
| 951 |
if os == "linux" and os_version == "22.04" and processor == "x86_64" and debug and display == "wayland": Bug TBD |
| 952 |
|
| 953 |
""" |
| 954 |
anyjs[filename] = False |
| 955 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 956 |
manifest_before9, anyjs, skip_if, bug_reference |
| 957 |
) |
| 958 |
manifest_expected9 = ( |
| 959 |
"""[myfile.html] |
| 960 |
disabled: |
| 961 |
if os == "linux" and os_version == "22.04" and processor == "x86_64" and debug and display == "wayland": Bug TBD |
| 962 |
""" |
| 963 |
+ condition |
| 964 |
+ "\n" |
| 965 |
) |
| 966 |
assert manifest_str == manifest_expected9 |
| 967 |
manifest_before10 = """[myfile.html] |
| 968 |
disabled: |
| 969 |
if os == "linux" and os_version == "22.04" and processor == "x86_64" and not debug and display == "wayland": Bug TBD |
| 970 |
|
| 971 |
[3P fetch: Cross site window setting HTTP cookies] |
| 972 |
""" |
| 973 |
anyjs[filename] = False |
| 974 |
manifest_str, additional_comment_ = sf.wpt_add_skip_if( |
| 975 |
manifest_before10, anyjs, skip_if, bug_reference |
| 976 |
) |
| 977 |
manifest_expected10 = ( |
| 978 |
"""[myfile.html] |
| 979 |
disabled: |
| 980 |
if os == "linux" and os_version == "22.04" and processor == "x86_64" and not debug and display == "wayland": Bug TBD |
| 981 |
""" |
| 982 |
+ condition |
| 983 |
+ """\n [3P fetch: Cross site window setting HTTP cookies] |
| 984 |
""" |
| 985 |
) |
| 986 |
assert manifest_str == manifest_expected10 |
| 987 |
|
| 988 |
|
| 989 |
def test_get_filename_in_manifest(): |
| 990 |
"""Test get_filename_in_manifest""" |
| 991 |
|
| 992 |
sf = Skipfails() |
| 993 |
|
| 994 |
assert ( |
| 995 |
sf.get_filename_in_manifest( |
| 996 |
"browser/components/sessionstore/test/browser.toml", |
| 997 |
"browser/components/sessionstore/test/browser_closed_tabs_windows.js", |
| 998 |
) |
| 999 |
== "browser_closed_tabs_windows.js" |
| 1000 |
) |
| 1001 |
assert ( |
| 1002 |
sf.get_filename_in_manifest( |
| 1003 |
"browser/base/content/test/webrtc/gracePeriod/browser.toml", |
| 1004 |
"browser/base/content/test/webrtc/browser_devices_get_user_media_grace.js", |
| 1005 |
) |
| 1006 |
== "../browser_devices_get_user_media_grace.js" |
| 1007 |
) |
| 1008 |
assert ( |
| 1009 |
sf.get_filename_in_manifest( |
| 1010 |
"dom/animation/test/mochitest.toml", |
| 1011 |
"dom/animation/test/document-timeline/test_document-timeline.html", |
| 1012 |
) |
| 1013 |
== "document-timeline/test_document-timeline.html" |
| 1014 |
) |
| 1015 |
|
| 1016 |
|
| 1017 |
def test_label_to_platform_testname(): |
| 1018 |
"""Test label_to_platform_testname""" |
| 1019 |
|
| 1020 |
sf = Skipfails() |
| 1021 |
label = "test-linux2204-64-wayland/opt-mochitest-browser-chrome-swr-13" |
| 1022 |
platform, testname = sf.label_to_platform_testname(label) |
| 1023 |
assert platform == "test-linux2204-64-wayland/opt" |
| 1024 |
assert testname == "mochitest-browser-chrome" |
| 1025 |
|
| 1026 |
|
| 1027 |
def test_reftest_add_fuzzy_if(): |
| 1028 |
"""Test reftest_add_fuzzy_if""" |
| 1029 |
|
| 1030 |
sf = Skipfails(implicit_vars=True) |
| 1031 |
manifest_path = DATA_PATH.joinpath("reftest-1-before.list") |
| 1032 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1033 |
after_path = DATA_PATH.joinpath("reftest-1-after.list") |
| 1034 |
after_str = open(after_path, encoding="utf-8").read() |
| 1035 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1036 |
manifest_str, |
| 1037 |
"fuzzy(0-11,0-7155) == blur-inside-clipPath.svg blur-inside-clipPath-ref.svg", |
| 1038 |
"gtkWidget", |
| 1039 |
[10, 12], |
| 1040 |
[7000, 8000], |
| 1041 |
2, |
| 1042 |
False, |
| 1043 |
"Bug TBD", |
| 1044 |
) |
| 1045 |
assert additional_comment == "" |
| 1046 |
assert manifest_str == after_str |
| 1047 |
|
| 1048 |
|
| 1049 |
def test_reftest_add_fuzzy_if2(): |
| 1050 |
"""Test reftest_add_fuzzy_if2""" |
| 1051 |
|
| 1052 |
sf = Skipfails(implicit_vars=True) |
| 1053 |
manifest_path = DATA_PATH.joinpath("reftest-2-before.list") |
| 1054 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1055 |
after_path = DATA_PATH.joinpath("reftest-2-after.list") |
| 1056 |
after_str = open(after_path, encoding="utf-8").read() |
| 1057 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1058 |
manifest_str, |
| 1059 |
"fuzzy(0-11,0-7155) HTTP(..) == blur-inside-clipPath.svg blur-inside-clipPath-ref.svg", |
| 1060 |
"gtkWidget", |
| 1061 |
[10, 12], |
| 1062 |
[7000, 8000], |
| 1063 |
2, |
| 1064 |
False, |
| 1065 |
"Bug TBD", |
| 1066 |
) |
| 1067 |
assert additional_comment == "" |
| 1068 |
assert manifest_str == after_str |
| 1069 |
|
| 1070 |
|
| 1071 |
def test_reftest_add_fuzzy_if3(): |
| 1072 |
"""Test reftest_add_fuzzy_if3""" |
| 1073 |
|
| 1074 |
sf = Skipfails(implicit_vars=True) |
| 1075 |
manifest_path = DATA_PATH.joinpath("reftest-2-after.list") |
| 1076 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1077 |
after_path = DATA_PATH.joinpath("reftest-3-after.list") |
| 1078 |
after_str = open(after_path, encoding="utf-8").read() |
| 1079 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1080 |
manifest_str, |
| 1081 |
"fuzzy(0-11,0-7155) fuzzy-if(gtkWidget,10-12,7000-8400) HTTP(..) == blur-inside-clipPath.svg blur-inside-clipPath-ref.svg", |
| 1082 |
"gtkWidget", |
| 1083 |
[9, 13], |
| 1084 |
[7500, 7900], |
| 1085 |
2, |
| 1086 |
False, |
| 1087 |
"Bug TBD", |
| 1088 |
) |
| 1089 |
assert additional_comment == "" |
| 1090 |
assert manifest_str == after_str |
| 1091 |
|
| 1092 |
|
| 1093 |
def test_reftest_add_fuzzy_if4(): |
| 1094 |
"""Test reftest_add_fuzzy_if4""" |
| 1095 |
|
| 1096 |
# Now with the relaxed merge policy the additional condition has been merged |
| 1097 |
# instead of added.... |
| 1098 |
# fuzzy-if(winWidget,0-177,0-1) fuzzy-if(winWidget&&!is64Bit&&isDebugBuild,0-152,0-1) == 23605-5.html 23605-5-ref.html # Bug TBD |
| 1099 |
|
| 1100 |
sf = Skipfails(implicit_vars=True) |
| 1101 |
manifest_path = DATA_PATH.joinpath("reftest-4-before.list") |
| 1102 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1103 |
after_path = DATA_PATH.joinpath("reftest-4-after.list") |
| 1104 |
after_str = open(after_path, encoding="utf-8").read() |
| 1105 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1106 |
manifest_str, |
| 1107 |
"fuzzy-if(winWidget,0-177,0-1) == 23605-5.html 23605-5-ref.html", |
| 1108 |
"winWidget&&!is64Bit&&isDebugBuild", |
| 1109 |
[139, 145], |
| 1110 |
[1, 1], |
| 1111 |
2, |
| 1112 |
True, |
| 1113 |
"Bug TBD", |
| 1114 |
) |
| 1115 |
assert additional_comment == "" |
| 1116 |
assert manifest_str == after_str |
| 1117 |
# assert ( |
| 1118 |
# additional_comment |
| 1119 |
# == "NOTE: more than one fuzzy-if for the OS = winWidget ==> may require manual review" |
| 1120 |
# ) |
| 1121 |
|
| 1122 |
|
| 1123 |
def test_reftest_add_fuzzy_if5(): |
| 1124 |
"""Test reftest_add_fuzzy_if5""" |
| 1125 |
|
| 1126 |
sf = Skipfails(implicit_vars=True) |
| 1127 |
manifest_path = DATA_PATH.joinpath("reftest-2-after.list") |
| 1128 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1129 |
after_path = DATA_PATH.joinpath("reftest-5-after.list") |
| 1130 |
after_str = open(after_path, encoding="utf-8").read() |
| 1131 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1132 |
manifest_str, |
| 1133 |
"fuzzy(0-11,0-7155) fuzzy-if(gtkWidget,10-12,7000-8400) HTTP(..) == blur-inside-clipPath.svg blur-inside-clipPath-ref.svg", |
| 1134 |
"gtkWidget&&!is64Bit", |
| 1135 |
[5, 6], |
| 1136 |
[3000, 4000], |
| 1137 |
2, |
| 1138 |
False, |
| 1139 |
"Bug TBD", |
| 1140 |
) |
| 1141 |
assert additional_comment == "" |
| 1142 |
assert manifest_str == after_str |
| 1143 |
|
| 1144 |
|
| 1145 |
def test_reftest_add_fuzzy_if6(): |
| 1146 |
"""Test reftest_add_fuzzy_if6""" |
| 1147 |
|
| 1148 |
sf = Skipfails(implicit_vars=True) |
| 1149 |
manifest_path = DATA_PATH.joinpath("reftest-6-before.list") |
| 1150 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1151 |
after_path = DATA_PATH.joinpath("reftest-6-after.list") |
| 1152 |
after_str = open(after_path, encoding="utf-8").read() |
| 1153 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1154 |
manifest_str, |
| 1155 |
"fuzzy(16-51,5234-5622) fuzzy-if(swgl,32-38,1600-91746) fuzzy-if(useDrawSnapshot,16-16,11600-11600) fuzzy-if(cocoaWidget,16-73,5212-5622) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm ../reftest_img.html?src=color_quads/720p.png", |
| 1156 |
"Android&&isDebugBuild&&!fission&&swgl", |
| 1157 |
[1, 32], |
| 1158 |
[1, 1760], |
| 1159 |
2, |
| 1160 |
True, |
| 1161 |
"Bug TBD", |
| 1162 |
) |
| 1163 |
assert additional_comment == "" |
| 1164 |
assert manifest_str == after_str |
| 1165 |
|
| 1166 |
|
| 1167 |
def test_reftest_add_fuzzy_if7(): |
| 1168 |
"""Test reftest_add_fuzzy_if7""" |
| 1169 |
|
| 1170 |
sf = Skipfails(implicit_vars=False) |
| 1171 |
manifest_path = DATA_PATH.joinpath("reftest-7-before.list") |
| 1172 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1173 |
after_path = DATA_PATH.joinpath("reftest-7-after.list") |
| 1174 |
after_str = open(after_path, encoding="utf-8").read() |
| 1175 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1176 |
manifest_str, |
| 1177 |
"skip-if(winWidget&&isCoverageBuild) fuzzy(0-16,75-1941) fuzzy-if(Android,28-255,273680-359920) fuzzy-if(appleSilicon,30-48,1835-187409) fuzzy-if(cocoaWidget,30-32,187326-187407) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.h264.mp4 ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm", |
| 1178 |
"cocoaWidget", |
| 1179 |
[], |
| 1180 |
[], |
| 1181 |
2, |
| 1182 |
False, |
| 1183 |
"Bug TBD", |
| 1184 |
) |
| 1185 |
assert additional_comment == "" |
| 1186 |
assert manifest_str == after_str |
| 1187 |
|
| 1188 |
|
| 1189 |
def test_reftest_add_fuzzy_if8(): |
| 1190 |
"""Test reftest_add_fuzzy_if8""" |
| 1191 |
|
| 1192 |
sf = Skipfails(implicit_vars=True) |
| 1193 |
manifest_path = DATA_PATH.joinpath("reftest-6-after.list") |
| 1194 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1195 |
after_path = DATA_PATH.joinpath("reftest-8-after.list") |
| 1196 |
after_str = open(after_path, encoding="utf-8").read() |
| 1197 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1198 |
manifest_str, |
| 1199 |
"fuzzy(16-51,5234-5622) fuzzy-if(swgl,32-38,1600-91746) fuzzy-if(useDrawSnapshot,16-16,11600-11600) fuzzy-if(Android&&isDebugBuild&&!fission&&swgl,0-33,0-1848) fuzzy-if(cocoaWidget,16-73,5212-5622) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm ../reftest_img.html?src=color_quads/720p.png", |
| 1200 |
"cocoaWidget", |
| 1201 |
[0, 0], |
| 1202 |
[0, 0], |
| 1203 |
2, |
| 1204 |
True, |
| 1205 |
"Bug TBD", |
| 1206 |
) |
| 1207 |
assert additional_comment == "" |
| 1208 |
assert manifest_str == after_str |
| 1209 |
|
| 1210 |
|
| 1211 |
def test_reftest_add_fuzzy_if9(): |
| 1212 |
"""Test reftest_add_fuzzy_if9""" |
| 1213 |
|
| 1214 |
sf = Skipfails(implicit_vars=True) |
| 1215 |
manifest_path = DATA_PATH.joinpath("reftest-9-before.list") |
| 1216 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1217 |
after_path = DATA_PATH.joinpath("reftest-9-after.list") |
| 1218 |
after_str = open(after_path, encoding="utf-8").read() |
| 1219 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1220 |
manifest_str, |
| 1221 |
"fuzzy(0-201,0-1486) fuzzy-if(Android&&(fission||!fission),201-267,42-1560) fuzzy-if(Android&&!fission&&(swgl||!swgl),201-267,40-1560) fuzzy-if(Android&&isDebugBuild&&!fission&&swgl,198-207,1439-1510) fuzzy-if(cocoaWidget&&isDebugBuild&&swgl,198-267,40-1510) fuzzy-if(gtkWidget&&swgl,198-267,40-1510) fuzzy-if(gtkWidget&&!fission&&swgl,0-267,0-1510) fuzzy-if(gtkWidget&&!fission&&(swgl||!swgl),201-267,40-1560) == element-paint-transform-02.html element-paint-transform-02-ref.html", |
| 1222 |
"gtkWidget&&isDebugBuild&&!fission&&swgl", |
| 1223 |
[198], |
| 1224 |
[1439], |
| 1225 |
2, |
| 1226 |
True, |
| 1227 |
"Bug TBD", |
| 1228 |
) |
| 1229 |
assert manifest_str == after_str |
| 1230 |
|
| 1231 |
|
| 1232 |
def test_reftest_add_fuzzy_if10(): |
| 1233 |
"""Test reftest_add_fuzzy_if10""" |
| 1234 |
|
| 1235 |
sf = Skipfails(implicit_vars=False) |
| 1236 |
manifest_path = DATA_PATH.joinpath("reftest-10-before.list") |
| 1237 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1238 |
after_path = DATA_PATH.joinpath("reftest-10-after.list") |
| 1239 |
after_str = open(after_path, encoding="utf-8").read() |
| 1240 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1241 |
manifest_str, |
| 1242 |
"skip-if(winWidget&&isCoverageBuild) fuzzy(0-16,75-1941) fuzzy-if(Android,28-255,273680-359920) fuzzy-if(appleSilicon,30-48,1835-187409) fuzzy-if(cocoaWidget,0-0,0-0) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.h264.mp4 ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm", |
| 1243 |
"cocoaWidget", |
| 1244 |
[], |
| 1245 |
[], |
| 1246 |
2, |
| 1247 |
True, |
| 1248 |
"Bug TBD", |
| 1249 |
) |
| 1250 |
assert additional_comment == "fuzzy-if removed as calculated range is 0-0,0-0" |
| 1251 |
assert manifest_str == after_str |
| 1252 |
|
| 1253 |
|
| 1254 |
def test_reftest_add_fuzzy_if11(): |
| 1255 |
"""Test reftest_add_fuzzy_if11""" |
| 1256 |
|
| 1257 |
sf = Skipfails(implicit_vars=False) |
| 1258 |
manifest_path = DATA_PATH.joinpath("reftest-10-before.list") |
| 1259 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1260 |
manifest_str, additional_comment = sf.reftest_add_fuzzy_if( |
| 1261 |
manifest_str, |
| 1262 |
"skip-if(winWidget&&isCoverageBuild) fuzzy(0-16,75-1941) fuzzy-if(Android,28-255,273680-359920) fuzzy-if(cocoaWidget,30-32,187326-187407) fuzzy-if(appleSilicon,30-48,1835-187409) == ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.h264.mp4 ../reftest_video.html?src=color_quads/720p.png.bt709.bt709.tv.yuv420p.av1.webm", |
| 1263 |
"winWidget", |
| 1264 |
[], |
| 1265 |
[], |
| 1266 |
2, |
| 1267 |
True, |
| 1268 |
"Bug TBD", |
| 1269 |
) |
| 1270 |
assert additional_comment == "fuzzy-if not added as calculated range is 0-0,0-0" |
| 1271 |
assert manifest_str == "" |
| 1272 |
|
| 1273 |
|
| 1274 |
def test_reftest_get_lineno(): |
| 1275 |
"""Test reftest_get_lineno""" |
| 1276 |
|
| 1277 |
sf = Skipfails() |
| 1278 |
mods = [ |
| 1279 |
"pref(gfx.font_rendering.colr_v1.enabled,true)", |
| 1280 |
"fuzzy(0-8,0-10100)", |
| 1281 |
"==", |
| 1282 |
"colrv1-01.html#C", |
| 1283 |
"colrv1-01-ref.html#C", |
| 1284 |
] |
| 1285 |
allmods = " ".join(mods) |
| 1286 |
lineno = sf.reftest_find_lineno( |
| 1287 |
"testing/test/data/fontface_reftest.list", mods, allmods |
| 1288 |
) |
| 1289 |
assert lineno == 171 |
| 1290 |
|
| 1291 |
|
| 1292 |
def test_reftest_get_lineno2(): |
| 1293 |
"""Test reftest_get_lineno2""" |
| 1294 |
|
| 1295 |
sf = Skipfails() |
| 1296 |
mods = [ |
| 1297 |
"pref(image.downscale-during-decode.enabled,true)", |
| 1298 |
"fuzzy(0-53,0-6391)", |
| 1299 |
"fuzzy-if(appleSilicon,0-20,0-11605)", |
| 1300 |
"fuzzy-if(gtkWidget,18-19,5502-5568)", |
| 1301 |
"skip-if(Android)", |
| 1302 |
"==", |
| 1303 |
"downscale-moz-icon-1.html", |
| 1304 |
"downscale-moz-icon-1-ref.html", |
| 1305 |
] |
| 1306 |
allmods = " ".join(mods) |
| 1307 |
lineno = sf.reftest_find_lineno( |
| 1308 |
"testing/test/data/downscaling_reftest.list", mods, allmods |
| 1309 |
) |
| 1310 |
assert lineno == 183 |
| 1311 |
|
| 1312 |
|
| 1313 |
def test_reftest_get_lineno3(): |
| 1314 |
"""Test reftest_get_lineno3""" |
| 1315 |
|
| 1316 |
sf = Skipfails() |
| 1317 |
mods = [ |
| 1318 |
"pref(webgl.force-enabled,true)", |
| 1319 |
"skip-if(Android)", |
| 1320 |
"fuzzy(0-235,0-3104)", |
| 1321 |
"==", |
| 1322 |
"1177726-text-stroke-bounds.html", |
| 1323 |
"1177726-text-stroke-bounds-ref.html", |
| 1324 |
] |
| 1325 |
allmods = " ".join(mods) |
| 1326 |
lineno = sf.reftest_find_lineno( |
| 1327 |
"testing/test/data/dom_canvas_reftest.list", mods, allmods |
| 1328 |
) |
| 1329 |
assert lineno == 233 |
| 1330 |
|
| 1331 |
|
| 1332 |
def test_reftest_skip_failure_win_32(capsys): |
| 1333 |
"""Test reftest_skip_failure_win_32""" |
| 1334 |
|
| 1335 |
sf = Skipfails(verbose=True, bugzilla="disable", implicit_vars=True) |
| 1336 |
manifest = "layout/reftests/svg/reftest.list" |
| 1337 |
kind = Kind.LIST |
| 1338 |
path = "fuzzy(0-1,0-5) fuzzy-if(winWidget,0-96,0-21713) skip-if(winWidget&&isCoverageBuild) fuzzy-if(Android&&device,0-4,0-946) == radialGradient-basic-03.svg radialGradient-basic-03-ref.html" |
| 1339 |
anyjs = None |
| 1340 |
differences = [68] |
| 1341 |
pixels = [21668] |
| 1342 |
lineno = 419 |
| 1343 |
status = "FAIL" |
| 1344 |
label = "test-windows11-32-24h2-qr/debug-reftest-1" |
| 1345 |
classification = "disable_recommended" |
| 1346 |
task_id = "BpoP8I2CRZekXUKoSIZjUQ" |
| 1347 |
try_url = "https://treeherder.mozilla.org/jobs?repo=try&tier=1%2C2%2C3&revision=3e54b0b81de7d6a3e6a2c3408892ffd6430bc137&selectedTaskRun=BpoP8I2CRZekXUKoSIZjUQ.0" |
| 1348 |
revision = "3e54b0b81de7d6a3e6a2c3408892ffd6430bc137" |
| 1349 |
repo = "try" |
| 1350 |
meta_bug_id = None |
| 1351 |
task_details = { # pre-cache task details |
| 1352 |
"expires": "2024-01-09T16:05:56.825Z", |
| 1353 |
"extra": { |
| 1354 |
"suite": "reftest", |
| 1355 |
"test-setting": { |
| 1356 |
"build": {"type": "debug"}, |
| 1357 |
"platform": { |
| 1358 |
"arch": "32", |
| 1359 |
"os": {"build": "24h2", "name": "windows", "version": "11"}, |
| 1360 |
}, |
| 1361 |
"runtime": {}, |
| 1362 |
}, |
| 1363 |
}, |
| 1364 |
} |
| 1365 |
sf.tasks[task_id] = task_details |
| 1366 |
|
| 1367 |
sf.skip_failure( |
| 1368 |
manifest, |
| 1369 |
kind, |
| 1370 |
path, |
| 1371 |
anyjs, |
| 1372 |
differences, |
| 1373 |
pixels, |
| 1374 |
lineno, |
| 1375 |
status, |
| 1376 |
label, |
| 1377 |
classification, |
| 1378 |
task_id, |
| 1379 |
try_url, |
| 1380 |
revision, |
| 1381 |
repo, |
| 1382 |
meta_bug_id, |
| 1383 |
) |
| 1384 |
capsys.readouterr() |
| 1385 |
# assert ( |
| 1386 |
# captured.err.find( |
| 1387 |
# "Skipping failures for Windows 32-bit are temporarily disabled" |
| 1388 |
# ) |
| 1389 |
# > 0 |
| 1390 |
# ) |
| 1391 |
|
| 1392 |
|
| 1393 |
def test_reftest_skip_failure_reorder(capsys): |
| 1394 |
"""Test reftest_skip_failure_reorder""" |
| 1395 |
|
| 1396 |
manifest_before_path = DATA_PATH.joinpath("reftest-reorder-before.list") |
| 1397 |
manifest_before = open(manifest_before_path, encoding="utf-8").read() |
| 1398 |
manifest_path = DATA_PATH.joinpath("reftest-reorder.list") |
| 1399 |
manifest_fp = open(manifest_path, "w", encoding="utf-8") |
| 1400 |
manifest_fp.write(manifest_before) |
| 1401 |
manifest_fp.close() |
| 1402 |
manifest_after_path = DATA_PATH.joinpath("reftest-reorder-after.list") |
| 1403 |
manifest_after = open(manifest_after_path, encoding="utf-8").read() |
| 1404 |
sf = Skipfails(verbose=True, bugzilla="disable", implicit_vars=True) |
| 1405 |
manifest = "testing/test/data/reftest-reorder.list" |
| 1406 |
kind = Kind.LIST |
| 1407 |
path = "fuzzy-if(cocoaWidget,0-80,0-76800) fuzzy-if(appleSilicon,0-80,0-76800) skip-if(Android) fuzzy-if(winWidget,0-63,0-76799) fuzzy-if(gtkWidget,0-70,0-2032) HTTP(..) == short.mp4.firstframe.html short.mp4.firstframe-ref.html" |
| 1408 |
anyjs = None |
| 1409 |
differences = [59, 61] |
| 1410 |
pixels = [2032, 2133] |
| 1411 |
lineno = 2 |
| 1412 |
status = "FAIL" |
| 1413 |
label = "test-linux1804-64-asan-qr/opt-reftest-nofis-7" |
| 1414 |
classification = "disable_failure" |
| 1415 |
task_id = "a9Pz5yFJTxOL_uM-BEvGoQ" |
| 1416 |
try_url = "https://treeherder.mozilla.org/jobs?repo=try&tier=1%2C2%2C3&revision=3e54b0b81de7d6a3e6a2c3408892ffd6430bc137&selectedTaskRun=BpoP8I2CRZekXUKoSIZjUQ.0" |
| 1417 |
revision = "3e54b0b81de7d6a3e6a2c3408892ffd6430bc137" |
| 1418 |
repo = "try" |
| 1419 |
meta_bug_id = None |
| 1420 |
task_details = { # pre-cache task details |
| 1421 |
"expires": "2024-01-09T16:05:56.825Z", |
| 1422 |
"extra": { |
| 1423 |
"suite": "reftest", |
| 1424 |
"test-setting": { |
| 1425 |
"build": {"asan": True, "type": "opt"}, |
| 1426 |
"platform": { |
| 1427 |
"arch": "64", |
| 1428 |
"os": {"name": "linux", "version": "1804"}, |
| 1429 |
}, |
| 1430 |
"runtime": {"no-fission": True}, |
| 1431 |
}, |
| 1432 |
}, |
| 1433 |
} |
| 1434 |
sf.tasks[task_id] = task_details |
| 1435 |
|
| 1436 |
sf.skip_failure( |
| 1437 |
manifest, |
| 1438 |
kind, |
| 1439 |
path, |
| 1440 |
anyjs, |
| 1441 |
differences, |
| 1442 |
pixels, |
| 1443 |
lineno, |
| 1444 |
status, |
| 1445 |
label, |
| 1446 |
classification, |
| 1447 |
task_id, |
| 1448 |
try_url, |
| 1449 |
revision, |
| 1450 |
repo, |
| 1451 |
meta_bug_id, |
| 1452 |
) |
| 1453 |
assert os.path.exists(manifest_path) |
| 1454 |
manifest_str = open(manifest_path, encoding="utf-8").read() |
| 1455 |
assert manifest_str == manifest_after |
| 1456 |
os.remove(manifest_path) |
| 1457 |
# captured = capsys.readouterr() |
| 1458 |
# assert ( |
| 1459 |
# captured.err.find( |
| 1460 |
# "NOTE: more than one fuzzy-if for the OS = gtkWidget ==> may require manual review" |
| 1461 |
# ) |
| 1462 |
# > 0 |
| 1463 |
# ) |
| 1464 |
|
| 1465 |
|
| 1466 |
if __name__ == "__main__": |
| 1467 |
main() |