From b39b0bed430c49cbdee9223aaf0d7741d57097c0 Mon Sep 17 00:00:00 2001 From: Kershaw Chang Date: Tue, 21 Mar 2023 09:09:58 +0000 Subject: [PATCH] Bug 1809843 - Run mochitest with Http/3 server on try, r=gbrown,necko-reviewers,ci-and-tooling,valentin,suhaib,jmaher Differential Revision: https://phabricator.services.mozilla.com/D167515 --- netwerk/test/unit/head_trr.js | 2 +- .../mozbuild/mozbuild/action/test_archive.py | 2 +- taskcluster/ci/config.yml | 1 + taskcluster/ci/test/mochitest.yml | 30 +++++++++++++++++++ taskcluster/ci/test/variants.yml | 10 +++++++ testing/mochitest/DoHServer/doh_server.js | 14 +++++++-- testing/mochitest/moz.build | 19 ++++++++++++ testing/mochitest/runtests.py | 1 + .../mozharness/scripts/desktop_unittest.py | 12 ++++++++ testing/xpcshell/dns-packet/index.js | 2 +- testing/xpcshell/moz-http2/moz-http2.js | 2 +- .../xpcshell/{node-ip => node_ip}/.gitignore | 0 testing/xpcshell/{node-ip => node_ip}/.jscsrc | 0 .../xpcshell/{node-ip => node_ip}/.jshintrc | 0 .../xpcshell/{node-ip => node_ip}/.travis.yml | 0 .../xpcshell/{node-ip => node_ip}/README.md | 0 .../xpcshell/{node-ip => node_ip}/lib/ip.js | 0 .../{node-ip => node_ip}/package.json | 0 .../{node-ip => node_ip}/test/api-test.js | 0 tools/rewriting/ThirdPartyPaths.txt | 2 +- 20 files changed, 90 insertions(+), 7 deletions(-) rename testing/xpcshell/{node-ip => node_ip}/.gitignore (100%) rename testing/xpcshell/{node-ip => node_ip}/.jscsrc (100%) rename testing/xpcshell/{node-ip => node_ip}/.jshintrc (100%) rename testing/xpcshell/{node-ip => node_ip}/.travis.yml (100%) rename testing/xpcshell/{node-ip => node_ip}/README.md (100%) rename testing/xpcshell/{node-ip => node_ip}/lib/ip.js (100%) rename testing/xpcshell/{node-ip => node_ip}/package.json (100%) rename testing/xpcshell/{node-ip => node_ip}/test/api-test.js (100%) diff --git a/netwerk/test/unit/head_trr.js b/netwerk/test/unit/head_trr.js index d6d6a79758d1..0e93b2815249 100644 --- a/netwerk/test/unit/head_trr.js +++ b/netwerk/test/unit/head_trr.js @@ -287,7 +287,7 @@ class TRRServerCode { await global.server.listen(port); global.dnsPacket = require(`${__dirname}/../dns-packet`); - global.ip = require(`${__dirname}/../node-ip`); + global.ip = require(`${__dirname}/../node_ip`); let serverPort = global.server.address().port; diff --git a/python/mozbuild/mozbuild/action/test_archive.py b/python/mozbuild/mozbuild/action/test_archive.py index 8624b1703558..7f11bbc488c8 100644 --- a/python/mozbuild/mozbuild/action/test_archive.py +++ b/python/mozbuild/mozbuild/action/test_archive.py @@ -541,7 +541,7 @@ ARCHIVE_FILES = { "mach_test_package_commands.py", "moz-http2/**", "node-http2/**", - "node-ip/**", + "node_ip/**", "node-ws/**", "dns-packet/**", "odoh-wasm/**", diff --git a/taskcluster/ci/config.yml b/taskcluster/ci/config.yml index 8d2c8ccab11e..9ea90140b144 100644 --- a/taskcluster/ci/config.yml +++ b/taskcluster/ci/config.yml @@ -57,6 +57,7 @@ treeherder: 'M-headless-nofis': 'Headless Mochitests without fission enabled.' 'M-headless-spi-nw': 'Headless Mochitests with fission and socketprocess networking.' 'M-headless-spi-nw-nofis': 'Headless Mochitests with fission and socketprocess networking without fission enabled.' + 'M-http3': 'Mochitests with Http/3 server' 'M-aab': 'Mochitests with AAB test_runner.' 'M-aab-nofis': 'Mochitests with AAB test_runner without fission enabled.' 'M-1proc': 'Mochitests without e10s or fission' diff --git a/taskcluster/ci/test/mochitest.yml b/taskcluster/ci/test/mochitest.yml index d4d84083131e..f02a1e3232eb 100644 --- a/taskcluster/ci/test/mochitest.yml +++ b/taskcluster/ci/test/mochitest.yml @@ -66,6 +66,7 @@ mochitest-plain: - webrender-sw - headless - headless+socketprocess_networking + - http3 run-on-projects: by-variant: conditioned_profile: @@ -118,6 +119,10 @@ mochitest-plain: linux1804-64-qr/debug: ['trunk'] linux1804-64(-shippable|-asan)?-qr/opt: ['trunk'] default: [] + http3: + by-test-platform: + linux1804-64-qr/debug: built-projects + default: [] default: by-test-platform: android.*: [] @@ -149,6 +154,31 @@ mochitest-plain: by-test-platform: android-em.*: false default: true + fetches: + toolchain: + by-test-platform: + linux.*: + - linux64-node-12 + - linux64-minidump-stackwalk + - linux64-fix-stacks + macosx.*: + - macosx64-node-12 + - macosx64-minidump-stackwalk + - macosx64-fix-stacks + win.*-64.*: + - win64-node-12 + - win32-minidump-stackwalk + - win32-fix-stacks + win.*32.*: + - win32-node-12 + - win32-minidump-stackwalk + - win32-fix-stacks + android-em-7.*: + - android-system-image-x86_64-linux + - android-avd-x86_64-linux + - android-emulator-linux + - linux64-node-12 + - linux64-minidump-stackwalk mochitest-a11y: description: "Mochitest a11y run" diff --git a/taskcluster/ci/test/variants.yml b/taskcluster/ci/test/variants.yml index cab0eb2b55aa..59ffc1dcb539 100644 --- a/taskcluster/ci/test/variants.yml +++ b/taskcluster/ci/test/variants.yml @@ -276,3 +276,13 @@ msix: mozharness: extra-options: - "--installer-path installer.msix" + +http3: + description: "{description} with http3 server" + component: "Testing::General" + expiration: "2023-09-01" + suffix: "http3" + merge: + mozharness: + extra-options: + - "--use-http3-server" diff --git a/testing/mochitest/DoHServer/doh_server.js b/testing/mochitest/DoHServer/doh_server.js index f909be0b3261..c83c886d0f03 100644 --- a/testing/mochitest/DoHServer/doh_server.js +++ b/testing/mochitest/DoHServer/doh_server.js @@ -14,8 +14,18 @@ const options = { const http2 = require("http2"); const http = require("http"); const url = require("url"); -const dnsPacket = require("../../xpcshell/dns-packet"); -const _ = require("lodash"); + +const path = require("path"); + +let dnsPacket; +let libPath = path.join(__dirname, "../../xpcshell/dns-packet"); +if (fs.existsSync(libPath)) { + // This is the path of dns-packet when running mochitest locally. + dnsPacket = require(libPath); +} else { + // This path is for running mochitest on try. + dnsPacket = require(path.join(__dirname, "./dns_packet")); +} let serverPort = parseInt(process.argv[2].split("=")[1]); let listeningPort = parseInt(process.argv[3].split("=")[1]); diff --git a/testing/mochitest/moz.build b/testing/mochitest/moz.build index 4c882a87b7ff..4ae04779499b 100644 --- a/testing/mochitest/moz.build +++ b/testing/mochitest/moz.build @@ -210,6 +210,25 @@ TEST_HARNESS_FILES.testing.mochitest.websocketprocessbridge += [ "/testing/tools/websocketprocessbridge/websocketprocessbridge_requirements_3.txt", ] +TEST_HARNESS_FILES.testing.mochitest.DoHServer.dns_packet += [ + "../xpcshell/dns-packet/classes.js", + "../xpcshell/dns-packet/index.js", + "../xpcshell/dns-packet/opcodes.js", + "../xpcshell/dns-packet/optioncodes.js", + "../xpcshell/dns-packet/package.json", + "../xpcshell/dns-packet/rcodes.js", + "../xpcshell/dns-packet/test.js", + "../xpcshell/dns-packet/types.js", +] + +TEST_HARNESS_FILES.testing.mochitest.DoHServer.node_ip += [ + "../xpcshell/node_ip/package.json", +] + +TEST_HARNESS_FILES.testing.mochitest.DoHServer.node_ip.lib += [ + "../xpcshell/node_ip/lib/ip.js", +] + with Files("**"): BUG_COMPONENT = ("Testing", "Mochitest") SCHEDULES.exclusive = ["mochitest"] diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 7efe3a3179e4..0203e4a73ad4 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -3287,6 +3287,7 @@ toolbar#nav-bar { "e10s": options.e10s, "fission": not options.disable_fission, "headless": options.headless, + "http3": options.useHttp3Server, # Until the test harness can understand default pref values, # (https://bugzilla.mozilla.org/show_bug.cgi?id=1577912) this value # should by synchronized with the default pref value indicated in diff --git a/testing/mozharness/scripts/desktop_unittest.py b/testing/mozharness/scripts/desktop_unittest.py index ededd3042473..5c789b540d2f 100755 --- a/testing/mozharness/scripts/desktop_unittest.py +++ b/testing/mozharness/scripts/desktop_unittest.py @@ -322,6 +322,15 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM "times in which case the test must contain at least one of the given tags.", }, ], + [ + ["--use-http3-server"], + { + "action": "store_true", + "default": False, + "dest": "useHttp3Server", + "help": "Whether to use the Http3 server", + }, + ], ] + copy.deepcopy(testing_config_options) + copy.deepcopy(code_coverage_config_options) @@ -621,6 +630,9 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM ]: base_cmd.append("--disable-fission") + if c["useHttp3Server"]: + base_cmd.append("--use-http3-server") + # Ignore chunking if we have user specified test paths if not (self.verify_enabled or self.per_test_coverage): test_paths = self._get_mozharness_test_paths(suite_category, suite) diff --git a/testing/xpcshell/dns-packet/index.js b/testing/xpcshell/dns-packet/index.js index 26b214ef4ef6..f1b735273100 100644 --- a/testing/xpcshell/dns-packet/index.js +++ b/testing/xpcshell/dns-packet/index.js @@ -6,7 +6,7 @@ exports.rcodes = rcodes; const opcodes = require('./opcodes') const classes = require('./classes') const optioncodes = require('./optioncodes') -const ip = require('../node-ip') +const ip = require('../node_ip') const QUERY_FLAG = 0 const RESPONSE_FLAG = 1 << 15 diff --git a/testing/xpcshell/moz-http2/moz-http2.js b/testing/xpcshell/moz-http2/moz-http2.js index 23cb8bb00361..2f168b29d048 100644 --- a/testing/xpcshell/moz-http2/moz-http2.js +++ b/testing/xpcshell/moz-http2/moz-http2.js @@ -16,7 +16,7 @@ var fs = require("fs"); var url = require("url"); var crypto = require("crypto"); const dnsPacket = require(`${node_http2_root}/../dns-packet`); -const ip = require(`${node_http2_root}/../node-ip`); +const ip = require(`${node_http2_root}/../node_ip`); const { fork } = require("child_process"); const path = require("path"); const zlib = require("zlib"); diff --git a/testing/xpcshell/node-ip/.gitignore b/testing/xpcshell/node_ip/.gitignore similarity index 100% rename from testing/xpcshell/node-ip/.gitignore rename to testing/xpcshell/node_ip/.gitignore diff --git a/testing/xpcshell/node-ip/.jscsrc b/testing/xpcshell/node_ip/.jscsrc similarity index 100% rename from testing/xpcshell/node-ip/.jscsrc rename to testing/xpcshell/node_ip/.jscsrc diff --git a/testing/xpcshell/node-ip/.jshintrc b/testing/xpcshell/node_ip/.jshintrc similarity index 100% rename from testing/xpcshell/node-ip/.jshintrc rename to testing/xpcshell/node_ip/.jshintrc diff --git a/testing/xpcshell/node-ip/.travis.yml b/testing/xpcshell/node_ip/.travis.yml similarity index 100% rename from testing/xpcshell/node-ip/.travis.yml rename to testing/xpcshell/node_ip/.travis.yml diff --git a/testing/xpcshell/node-ip/README.md b/testing/xpcshell/node_ip/README.md similarity index 100% rename from testing/xpcshell/node-ip/README.md rename to testing/xpcshell/node_ip/README.md diff --git a/testing/xpcshell/node-ip/lib/ip.js b/testing/xpcshell/node_ip/lib/ip.js similarity index 100% rename from testing/xpcshell/node-ip/lib/ip.js rename to testing/xpcshell/node_ip/lib/ip.js diff --git a/testing/xpcshell/node-ip/package.json b/testing/xpcshell/node_ip/package.json similarity index 100% rename from testing/xpcshell/node-ip/package.json rename to testing/xpcshell/node_ip/package.json diff --git a/testing/xpcshell/node-ip/test/api-test.js b/testing/xpcshell/node_ip/test/api-test.js similarity index 100% rename from testing/xpcshell/node-ip/test/api-test.js rename to testing/xpcshell/node_ip/test/api-test.js diff --git a/tools/rewriting/ThirdPartyPaths.txt b/tools/rewriting/ThirdPartyPaths.txt index e886b2d7752a..d3cf743fb331 100644 --- a/tools/rewriting/ThirdPartyPaths.txt +++ b/tools/rewriting/ThirdPartyPaths.txt @@ -162,7 +162,7 @@ testing/talos/talos/tests/v8_7/ testing/web-platform/tests/resources/webidl2/ testing/web-platform/tests/tools/third_party/ testing/xpcshell/dns-packet/ -testing/xpcshell/node-ip/ +testing/xpcshell/node_ip/ testing/xpcshell/node-http2/ testing/xpcshell/node-ws/ testing/xpcshell/odoh-wasm/