From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- testing/condprofile/condprof/tests/__init__.py | 0 testing/condprofile/condprof/tests/fakefirefox.py | 7 + .../condprofile/condprof/tests/fakegeckodriver.py | 144 ++ .../condprofile/condprof/tests/ftp_mozilla.html | 1484 ++++++++++++++++++++ .../condprofile/condprof/tests/profile/prefs.js | 1 + testing/condprofile/condprof/tests/profile/user.js | 9 + testing/condprofile/condprof/tests/python.toml | 4 + testing/condprofile/condprof/tests/test_client.py | 126 ++ testing/condprofile/condprof/tests/test_runner.py | 123 ++ 9 files changed, 1898 insertions(+) create mode 100644 testing/condprofile/condprof/tests/__init__.py create mode 100755 testing/condprofile/condprof/tests/fakefirefox.py create mode 100755 testing/condprofile/condprof/tests/fakegeckodriver.py create mode 100644 testing/condprofile/condprof/tests/ftp_mozilla.html create mode 100644 testing/condprofile/condprof/tests/profile/prefs.js create mode 100644 testing/condprofile/condprof/tests/profile/user.js create mode 100644 testing/condprofile/condprof/tests/python.toml create mode 100644 testing/condprofile/condprof/tests/test_client.py create mode 100644 testing/condprofile/condprof/tests/test_runner.py (limited to 'testing/condprofile/condprof/tests') diff --git a/testing/condprofile/condprof/tests/__init__.py b/testing/condprofile/condprof/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/testing/condprofile/condprof/tests/fakefirefox.py b/testing/condprofile/condprof/tests/fakefirefox.py new file mode 100755 index 0000000000..82e24dd081 --- /dev/null +++ b/testing/condprofile/condprof/tests/fakefirefox.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 +VERSION = """\ +Mozilla Firefox 70.0\ +""" + +if __name__ == "__main__": + print(VERSION) diff --git a/testing/condprofile/condprof/tests/fakegeckodriver.py b/testing/condprofile/condprof/tests/fakegeckodriver.py new file mode 100755 index 0000000000..ab40401aaf --- /dev/null +++ b/testing/condprofile/condprof/tests/fakegeckodriver.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python3 +import argparse +import json +from http.server import BaseHTTPRequestHandler, HTTPServer +from uuid import uuid4 + +_SESSIONS = {} + + +class Window: + def __init__(self, handle, title="about:blank"): + self.handle = handle + self.title = title + + def visit_url(self, url): + print("Visiting %s" % url) + # XXX todo, load the URL for real + self.url = url + + +class Session: + def __init__(self, uuid): + self.session_id = uuid + self.autoinc = 0 + self.windows = {} + self.active_handle = self.new_window() + + def visit(self, url): + self.windows[self.active_handle].visit_url(url) + + def new_window(self): + w = Window(self.autoinc) + self.windows[w.handle] = w + self.autoinc += 1 + return w.handle + + +class RequestHandler(BaseHTTPRequestHandler): + def _set_headers(self, status=200): + self.send_response(status) + self.send_header("Content-type", "application/json") + self.end_headers() + + def _send_response(self, status=200, data=None): + if data is None: + data = {} + data = json.dumps(data).encode("utf8") + self._set_headers(status) + self.wfile.write(data) + + def _parse_path(self): + path = self.path.lstrip("/") + sections = path.split("/") + session = None + action = [] + if len(sections) > 1: + session_id = sections[1] + if session_id in _SESSIONS: + session = _SESSIONS[session_id] + action = sections[2:] + return session, action + + def do_GET(self): + print("GET " + self.path) + if self.path == "/status": + return self._send_response(data={"ready": "OK"}) + + session, action = self._parse_path() + if action == ["window", "handles"]: + data = {"value": list(session.windows.keys())} + return self._send_response(data=data) + + if action == ["moz", "context"]: + data = {"value": "chrome"} + return self._send_response(data=data) + + return self._send_response(status=404) + + def do_POST(self): + print("POST " + self.path) + content_length = int(self.headers["Content-Length"]) + post_data = json.loads(self.rfile.read(content_length)) + + # new session + if self.path == "/session": + uuid = str(uuid4()) + _SESSIONS[uuid] = Session(uuid) + return self._send_response(data={"sessionId": uuid}) + + session, action = self._parse_path() + if action == ["url"]: + session.visit(post_data["url"]) + return self._send_response() + + if action == ["window", "new"]: + if session is None: + return self._send_response(404) + handle = session.new_window() + return self._send_response(data={"handle": handle, "type": "tab"}) + + if action == ["timeouts"]: + return self._send_response() + + if action == ["execute", "async"]: + return self._send_response(data={"logs": []}) + + # other commands not supported yet, we just return 200s + return self._send_response() + + def do_DELETE(self): + return self._send_response() + session, action = self._parse_path() + if session is not None: + del _SESSIONS[session.session_id] + return self._send_response() + return self._send_response(status=404) + + +VERSION = """\ +geckodriver 0.24.0 ( 2019-01-28) + +The source code of this program is available from +testing/geckodriver in https://hg.mozilla.org/mozilla-central. + +This program is subject to the terms of the Mozilla Public License 2.0. +You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.\ +""" + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="FakeGeckodriver") + parser.add_argument("--log", type=str, default=None) + parser.add_argument("--port", type=int, default=4444) + parser.add_argument("--marionette-port", type=int, default=2828) + parser.add_argument("--version", action="store_true", default=False) + parser.add_argument("--verbose", "-v", action="count") + args = parser.parse_args() + + if args.version: + print(VERSION) + else: + HTTPServer.allow_reuse_address = True + server = HTTPServer(("127.0.0.1", args.port), RequestHandler) + server.serve_forever() diff --git a/testing/condprofile/condprof/tests/ftp_mozilla.html b/testing/condprofile/condprof/tests/ftp_mozilla.html new file mode 100644 index 0000000000..c970f8483b --- /dev/null +++ b/testing/condprofile/condprof/tests/ftp_mozilla.html @@ -0,0 +1,1484 @@ + + + + + Directory Listing: /pub/firefox/nightly/latest-mozilla-central/ + + +

Index of /pub/firefox/nightly/latest-mozilla-central/

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeNameSizeLast Modified
Dir..
Dirmar-tools/
FileFirefox Installer.en-US.exe294K02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.langpack.xpi453K02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-i686.awsy.tests.tar.gz20K01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.buildhub.json1K01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.checksums8K01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.common.tests.tar.gz45M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.complete.mar57M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.cppunittest.tests.tar.gz12M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.crashreporter-symbols.zip79M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.json85501-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.mochitest.tests.tar.gz65M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.mozinfo.json91601-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.reftest.tests.tar.gz53M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.talos.tests.tar.gz18M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.tar.bz271M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.tar.bz2.asc83301-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.test_packages.json1K01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.txt9901-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.web-platform.tests.tar.gz53M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686.xpcshell.tests.tar.gz9M01-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-i686_info.txt2301-Sep-2019 23:49
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.awsy.tests.tar.gz20K02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.buildhub.json1K02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.checksums8K02-Sep-2019 01:44
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.common.tests.tar.gz55M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.complete.mar208M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.cppunittest.tests.tar.gz118M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.json86002-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.mochitest.tests.tar.gz65M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.mozinfo.json92702-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.reftest.tests.tar.gz53M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.talos.tests.tar.gz18M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.tar.bz2276M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.tar.bz2.asc83302-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.test_packages.json1K02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.txt9902-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.web-platform.tests.tar.gz53M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter.xpcshell.tests.tar.gz10M02-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64-asan-reporter_info.txt2302-Sep-2019 01:43
Filefirefox-70.0a1.en-US.linux-x86_64.awsy.tests.tar.gz20K02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.buildhub.json1K02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.checksums8K02-Sep-2019 00:07
Filefirefox-70.0a1.en-US.linux-x86_64.common.tests.tar.gz45M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.complete.mar57M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.cppunittest.tests.tar.gz12M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.crashreporter-symbols.zip74M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.json84602-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.mochitest.tests.tar.gz65M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.mozinfo.json92102-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.reftest.tests.tar.gz53M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.talos.tests.tar.gz18M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.tar.bz271M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.tar.bz2.asc83302-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.test_packages.json1K02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.txt9902-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.web-platform.tests.tar.gz53M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64.xpcshell.tests.tar.gz9M02-Sep-2019 00:06
Filefirefox-70.0a1.en-US.linux-x86_64_info.txt2302-Sep-2019 00:06
Filefirefox-70.0a1.en-US.mac.awsy.tests.tar.gz20K01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.buildhub.json1K01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.checksums7K01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.common.tests.tar.gz20M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.complete.mar60M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.cppunittest.tests.tar.gz10M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.crashreporter-symbols.zip54M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.dmg79M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.json1K01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.mochitest.tests.tar.gz65M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.mozinfo.json92301-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.pkg83M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.reftest.tests.tar.gz53M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.talos.tests.tar.gz18M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.test_packages.json1K01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.txt9901-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.web-platform.tests.tar.gz53M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac.xpcshell.tests.tar.gz9M01-Sep-2019 23:19
Filefirefox-70.0a1.en-US.mac_info.txt2301-Sep-2019 23:19
Filefirefox-70.0a1.en-US.win32.awsy.tests.tar.gz20K02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.buildhub.json1K02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.checksums8K02-Sep-2019 00:49
Filefirefox-70.0a1.en-US.win32.common.tests.tar.gz22M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.complete.mar51M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.cppunittest.tests.tar.gz10M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.crashreporter-symbols.zip34M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.installer.exe48M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.installer.msi48M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.json88402-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.mochitest.tests.tar.gz65M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.mozinfo.json94802-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.reftest.tests.tar.gz53M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.talos.tests.tar.gz18M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.test_packages.json1K02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.txt9902-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.web-platform.tests.tar.gz53M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.xpcshell.tests.tar.gz9M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32.zip70M02-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win32_info.txt2302-Sep-2019 00:48
Filefirefox-70.0a1.en-US.win64-aarch64.awsy.tests.tar.gz20K02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.buildhub.json91402-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.checksums8K02-Sep-2019 01:16
Filefirefox-70.0a1.en-US.win64-aarch64.common.tests.tar.gz20M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.complete.mar78M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.cppunittest.tests.tar.gz10M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.crashreporter-symbols.zip20M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.installer.exe74M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.json70502-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.mochitest.tests.tar.gz65M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.mozinfo.json94602-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.reftest.tests.tar.gz53M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.talos.tests.tar.gz18M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.test_packages.json1K02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.txt9902-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.web-platform.tests.tar.gz53M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.xpcshell.tests.tar.gz9M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64.zip110M02-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-aarch64_info.txt2302-Sep-2019 01:15
Filefirefox-70.0a1.en-US.win64-asan-reporter.awsy.tests.tar.gz20K02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.buildhub.json1K02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.checksums7K02-Sep-2019 00:17
Filefirefox-70.0a1.en-US.win64-asan-reporter.common.tests.tar.gz22M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.complete.mar201M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.cppunittest.tests.tar.gz56M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.installer.exe191M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.json89402-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.mochitest.tests.tar.gz65M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.mozinfo.json95702-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.reftest.tests.tar.gz53M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.talos.tests.tar.gz18M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.test_packages.json1K02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.txt9902-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.web-platform.tests.tar.gz53M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.xpcshell.tests.tar.gz9M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter.zip307M02-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64-asan-reporter_info.txt2302-Sep-2019 00:16
Filefirefox-70.0a1.en-US.win64.awsy.tests.tar.gz20K02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.buildhub.json1K02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.checksums8K02-Sep-2019 00:45
Filefirefox-70.0a1.en-US.win64.common.tests.tar.gz22M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.complete.mar53M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.cppunittest.tests.tar.gz11M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.crashreporter-symbols.zip25M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.installer.exe50M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.installer.msi50M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.json88002-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.mochitest.tests.tar.gz65M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.mozinfo.json95102-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.reftest.tests.tar.gz53M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.talos.tests.tar.gz18M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.test_packages.json1K02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.txt9902-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.web-platform.tests.tar.gz53M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.xpcshell.tests.tar.gz9M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64.zip73M02-Sep-2019 00:44
Filefirefox-70.0a1.en-US.win64_info.txt2302-Sep-2019 00:44
Filejsshell-linux-i686.zip11M01-Sep-2019 23:49
Filejsshell-linux-x86_64.zip11M02-Sep-2019 00:06
Filejsshell-mac.zip11M01-Sep-2019 23:19
Filejsshell-win32.zip10M02-Sep-2019 00:48
Filejsshell-win64-aarch64.zip1M02-Sep-2019 01:15
Filejsshell-win64.zip11M02-Sep-2019 00:44
Filemozharness.zip2M02-Sep-2019 01:43
+ + diff --git a/testing/condprofile/condprof/tests/profile/prefs.js b/testing/condprofile/condprof/tests/profile/prefs.js new file mode 100644 index 0000000000..abbe0fb70b --- /dev/null +++ b/testing/condprofile/condprof/tests/profile/prefs.js @@ -0,0 +1 @@ +user_pref("gfx.blacklist.direct2d", 1); diff --git a/testing/condprofile/condprof/tests/profile/user.js b/testing/condprofile/condprof/tests/profile/user.js new file mode 100644 index 0000000000..c1efc79c10 --- /dev/null +++ b/testing/condprofile/condprof/tests/profile/user.js @@ -0,0 +1,9 @@ + +#Prefs used for the unit test +user_pref("focusmanager.testmode", true); +user_pref("marionette.defaultPrefs.port", 2828); +user_pref("marionette.port", 2828); +user_pref("remote.log.level", "Trace"); +user_pref("marionette.log.truncate", false); +user_pref("extensions.autoDisableScopes", 0); +user_pref("devtools.debugger.remote-enabled", true); diff --git a/testing/condprofile/condprof/tests/python.toml b/testing/condprofile/condprof/tests/python.toml new file mode 100644 index 0000000000..14cffb2f5c --- /dev/null +++ b/testing/condprofile/condprof/tests/python.toml @@ -0,0 +1,4 @@ +[DEFAULT] +subsuite = "condprof" + +["test_client.py"] diff --git a/testing/condprofile/condprof/tests/test_client.py b/testing/condprofile/condprof/tests/test_client.py new file mode 100644 index 0000000000..8410133e16 --- /dev/null +++ b/testing/condprofile/condprof/tests/test_client.py @@ -0,0 +1,126 @@ +import json +import os +import re +import shutil +import tarfile +import tempfile +import unittest + +import responses +from mozprofile.prefs import Preferences + +from condprof.client import ROOT_URL, TC_SERVICE, get_profile +from condprof.util import _DEFAULT_SERVER + +PROFILE = re.compile(ROOT_URL + "/.*/.*tgz") +PROFILE_FOR_TESTS = os.path.join(os.path.dirname(__file__), "profile") +SECRETS = re.compile(_DEFAULT_SERVER + "/.*") +SECRETS_PROXY = re.compile("http://taskcluster/secrets/.*") + + +class TestClient(unittest.TestCase): + def setUp(self): + self.profile_dir = tempfile.mkdtemp() + + # creating profile.tgz on the fly for serving it + profile_tgz = os.path.join(self.profile_dir, "profile.tgz") + with tarfile.open(profile_tgz, "w:gz") as tar: + tar.add(PROFILE_FOR_TESTS, arcname=".") + + # self.profile_data is the tarball we're sending back via HTTP + with open(profile_tgz, "rb") as f: + self.profile_data = f.read() + + self.target = tempfile.mkdtemp() + self.download_dir = os.path.expanduser("~/.condprof-cache") + if os.path.exists(self.download_dir): + shutil.rmtree(self.download_dir) + + responses.add( + responses.GET, + PROFILE, + body=self.profile_data, + headers={"content-length": str(len(self.profile_data)), "ETag": "'12345'"}, + status=200, + ) + + responses.add( + responses.HEAD, + PROFILE, + body="", + headers={"content-length": str(len(self.profile_data)), "ETag": "'12345'"}, + status=200, + ) + + responses.add(responses.HEAD, TC_SERVICE, body="", status=200) + + secret = {"secret": {"username": "user", "password": "pass"}} + secret = json.dumps(secret) + for pattern in (SECRETS, SECRETS_PROXY): + responses.add( + responses.GET, + pattern, + body=secret, + headers={"content-length": str(len(secret))}, + status=200, + ) + + def tearDown(self): + shutil.rmtree(self.target) + shutil.rmtree(self.download_dir) + shutil.rmtree(self.profile_dir) + + @responses.activate + def test_cache(self): + download_dir = os.path.expanduser("~/.condprof-cache") + if os.path.exists(download_dir): + num_elmts = len(os.listdir(download_dir)) + else: + num_elmts = 0 + + get_profile(self.target, "win64", "settled", "default") + + # grabbing a profile should generate two files + self.assertEqual(len(os.listdir(download_dir)), num_elmts + 2) + + # we do at least two network calls when getting a file, + # a HEAD and a GET and possibly a TC secret + self.assertTrue(len(responses.calls) >= 2) + + # reseting the response counters + responses.calls.reset() + + # and we should reuse them without downloading the file again + get_profile(self.target, "win64", "settled", "default") + + # grabbing a profile should not download new stuff + self.assertEqual(len(os.listdir(download_dir)), num_elmts + 2) + + # and do a single extra HEAD call, everything else is cached, + # even the TC secret + self.assertEqual(len(responses.calls), 2) + + prefs_js = os.path.join(self.target, "prefs.js") + prefs = Preferences.read_prefs(prefs_js) + + # check that the gfx.blacklist prefs where cleaned out + for name, value in prefs: + self.assertFalse(name.startswith("gfx.blacklist")) + + # check that we have the startupScanScopes option forced + prefs = dict(prefs) + self.assertEqual(prefs["extensions.startupScanScopes"], 1) + + # make sure we don't have any marionette option set + user_js = os.path.join(self.target, "user.js") + for name, value in Preferences.read_prefs(user_js): + self.assertFalse(name.startswith("marionette.")) + + +if __name__ == "__main__": + try: + import mozunit + except ImportError: + pass + else: + mozunit.main(runwith="unittest") diff --git a/testing/condprofile/condprof/tests/test_runner.py b/testing/condprofile/condprof/tests/test_runner.py new file mode 100644 index 0000000000..e200a537e1 --- /dev/null +++ b/testing/condprofile/condprof/tests/test_runner.py @@ -0,0 +1,123 @@ +import asyncio +import os +import re +import shutil +import tarfile +import tempfile +import unittest + +import responses + +from condprof import client +from condprof.client import ROOT_URL, TC_SERVICE +from condprof.main import main + +client.RETRIES = 1 +client.RETRY_PAUSE = 0 +GECKODRIVER = os.path.join(os.path.dirname(__file__), "fakegeckodriver.py") +FIREFOX = os.path.join(os.path.dirname(__file__), "fakefirefox.py") +CHANGELOG = re.compile(ROOT_URL + "/.*/changelog.json") +FTP = "https://ftp.mozilla.org/pub/firefox/nightly/latest-mozilla-central/" +PROFILE = re.compile(ROOT_URL + "/.*/.*tgz") + + +with open(os.path.join(os.path.dirname(__file__), "ftp_mozilla.html")) as f: + FTP_PAGE = f.read() + +FTP_ARCHIVE = re.compile( + "https://ftp.mozilla.org/pub/firefox/nightly/" "latest-mozilla-central/firefox.*" +) + +ADDON = re.compile("https://addons.mozilla.org/.*/.*xpi") + + +async def fakesleep(duration): + if duration > 1: + duration = 1 + await asyncio.realsleep(duration) + + +asyncio.realsleep = asyncio.sleep +asyncio.sleep = fakesleep + + +class TestRunner(unittest.TestCase): + def setUp(self): + self.archive_dir = tempfile.mkdtemp() + responses.add(responses.GET, CHANGELOG, json={"error": "not found"}, status=404) + responses.add( + responses.GET, FTP, content_type="text/html", body=FTP_PAGE, status=200 + ) + + profile_tgz = os.path.join(os.path.dirname(__file__), "profile.tgz") + profile = os.path.join(os.path.dirname(__file__), "profile") + + with tarfile.open(profile_tgz, "w:gz") as tar: + tar.add(profile, arcname=".") + + with open(profile_tgz, "rb") as f: + PROFILE_DATA = f.read() + + os.remove(profile_tgz) + + responses.add( + responses.GET, + FTP_ARCHIVE, + body="1", + headers={"content-length": "1"}, + status=200, + ) + + responses.add( + responses.GET, + PROFILE, + body=PROFILE_DATA, + headers={"content-length": str(len(PROFILE_DATA))}, + status=200, + ) + + responses.add( + responses.HEAD, + PROFILE, + body="", + headers={"content-length": str(len(PROFILE_DATA))}, + status=200, + ) + + responses.add(responses.HEAD, FTP_ARCHIVE, body="", status=200) + + responses.add( + responses.GET, ADDON, body="1", headers={"content-length": "1"}, status=200 + ) + + responses.add( + responses.HEAD, ADDON, body="", headers={"content-length": "1"}, status=200 + ) + + responses.add(responses.HEAD, TC_SERVICE, body="", status=200) + + def tearDown(self): + shutil.rmtree(self.archive_dir) + + @responses.activate + def test_runner(self): + if "FXA_USERNAME" not in os.environ: + os.environ["FXA_USERNAME"] = "me" + if "FXA_PASSWORD" not in os.environ: + os.environ["FXA_PASSWORD"] = "password" + try: + args = [ + "--geckodriver", + GECKODRIVER, + "--firefox", + FIREFOX, + self.archive_dir, + ] + main(args) + # XXX we want a bunch of assertions here to check + # that the archives dir gets filled correctly + finally: + if os.environ["FXA_USERNAME"] == "me": + del os.environ["FXA_USERNAME"] + if os.environ["FXA_PASSWORD"] == "password": + del os.environ["FXA_PASSWORD"] -- cgit v1.2.3