import json import shutil from unittest import mock
import pytest
from mozperftest import utils from mozperftest.environment import METRICS, SYSTEM, TEST from mozperftest.test import xpcshell from mozperftest.test.xpcshell import XPCShellTestError from mozperftest.tests.support import (
EXAMPLE_XPCSHELL_TEST,
MOZINFO,
get_running_env,
temp_file,
)
class XPCShellTests: def __init__(self, log):
self.log = log
# these are the metrics sent by the scripts
self.log.log_raw(
{ "action": "log", "message": '"perfMetrics"', "extra": {"metrics1": 1, "metrics2": 2},
}
)
with temp_file() as output:
env.set_arg("output", output) try: with sys as s, xpcshell as x, metrics as m:
m(x(s(metadata))) finally:
shutil.rmtree(mach_cmd._mach_context.state_dir)
output_file = metadata.get_output() with open(output_file) as f:
output = json.loads(f.read())
# Check some numbers in our data assert len(output["suites"]) == 1 assert len(output["suites"][0]["subtests"]) == 3 assert"value"notin output["suites"][0] assert any(r > 0 for r in output["suites"][0]["subtests"][0]["replicates"])
for subtest in output["suites"][0]["subtests"]: assert subtest["name"].startswith("metrics")
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.