From 4f178c3f77f7980b1921a2af09a5ab5074b077f0 Mon Sep 17 00:00:00 2001 From: Chris H-C Date: Tue, 20 Jul 2021 14:33:49 +0000 Subject: [PATCH] Bug 1675288 - Move FOG's tests into a 'tests' folder r=TravisLong Differential Revision: https://phabricator.services.mozilla.com/D120015 --- .../glean/docs/dev/new_metric_types.md | 8 ++--- toolkit/components/glean/docs/dev/testing.md | 31 +++++++++---------- toolkit/components/glean/metrics_index.py | 4 +-- toolkit/components/glean/moz.build | 11 +------ .../glean/{ => tests}/gtest/Cargo.toml | 2 +- .../glean/{ => tests}/gtest/TestFog.cpp | 0 .../glean/{ => tests}/gtest/TestFogIPC.cpp | 0 .../glean/{ => tests}/gtest/moz.build | 0 .../glean/{ => tests}/gtest/test.rs | 0 toolkit/components/glean/tests/moz.build | 14 +++++++++ .../glean/{ => tests}/pytest/expect_helper.py | 0 .../{ => tests}/pytest/gifft_output_Event | 0 .../pytest/gifft_output_EventExtra | 0 .../{ => tests}/pytest/gifft_output_Histogram | 0 .../{ => tests}/pytest/gifft_output_Scalar | 0 .../pytest/metrics_expires_number_test.yaml | 0 .../pytest/metrics_expires_versions_test.yaml | 0 .../{ => tests}/pytest/metrics_test.yaml | 0 .../{ => tests}/pytest/metrics_test_output | 0 .../pytest/metrics_test_output_cpp | 0 .../{ => tests}/pytest/metrics_test_output_js | 0 .../glean/{ => tests}/pytest/pings_test.yaml | 0 .../{ => tests}/pytest/pings_test_output | 0 .../{ => tests}/pytest/pings_test_output_cpp | 0 .../{ => tests}/pytest/pings_test_output_js | 0 .../glean/{ => tests}/pytest/python.ini | 0 .../glean/{ => tests}/pytest/test_gifft.py | 4 ++- .../pytest/test_glean_parser_cpp.py | 4 ++- .../pytest/test_glean_parser_js.py | 4 ++- .../pytest/test_glean_parser_rust.py | 4 ++- .../pytest/test_no_expired_metrics.py | 4 ++- .../glean/{ => tests}/test_metrics.yaml | 0 .../glean/{ => tests}/test_pings.yaml | 0 .../glean/{ => tests}/xpcshell/test_GIFFT.js | 6 ---- .../glean/{ => tests}/xpcshell/test_Glean.js | 6 ---- .../{ => tests}/xpcshell/test_GleanAndroid.js | 0 .../{ => tests}/xpcshell/test_GleanIPC.js | 6 ---- .../glean/{ => tests}/xpcshell/xpcshell.ini | 0 toolkit/library/gtest/rust/Cargo.toml | 2 +- 39 files changed, 53 insertions(+), 57 deletions(-) rename toolkit/components/glean/{ => tests}/gtest/Cargo.toml (86%) rename toolkit/components/glean/{ => tests}/gtest/TestFog.cpp (100%) rename toolkit/components/glean/{ => tests}/gtest/TestFogIPC.cpp (100%) rename toolkit/components/glean/{ => tests}/gtest/moz.build (100%) rename toolkit/components/glean/{ => tests}/gtest/test.rs (100%) create mode 100644 toolkit/components/glean/tests/moz.build rename toolkit/components/glean/{ => tests}/pytest/expect_helper.py (100%) rename toolkit/components/glean/{ => tests}/pytest/gifft_output_Event (100%) rename toolkit/components/glean/{ => tests}/pytest/gifft_output_EventExtra (100%) rename toolkit/components/glean/{ => tests}/pytest/gifft_output_Histogram (100%) rename toolkit/components/glean/{ => tests}/pytest/gifft_output_Scalar (100%) rename toolkit/components/glean/{ => tests}/pytest/metrics_expires_number_test.yaml (100%) rename toolkit/components/glean/{ => tests}/pytest/metrics_expires_versions_test.yaml (100%) rename toolkit/components/glean/{ => tests}/pytest/metrics_test.yaml (100%) rename toolkit/components/glean/{ => tests}/pytest/metrics_test_output (100%) rename toolkit/components/glean/{ => tests}/pytest/metrics_test_output_cpp (100%) rename toolkit/components/glean/{ => tests}/pytest/metrics_test_output_js (100%) rename toolkit/components/glean/{ => tests}/pytest/pings_test.yaml (100%) rename toolkit/components/glean/{ => tests}/pytest/pings_test_output (100%) rename toolkit/components/glean/{ => tests}/pytest/pings_test_output_cpp (100%) rename toolkit/components/glean/{ => tests}/pytest/pings_test_output_js (100%) rename toolkit/components/glean/{ => tests}/pytest/python.ini (100%) rename toolkit/components/glean/{ => tests}/pytest/test_gifft.py (95%) rename toolkit/components/glean/{ => tests}/pytest/test_glean_parser_cpp.py (96%) rename toolkit/components/glean/{ => tests}/pytest/test_glean_parser_js.py (96%) rename toolkit/components/glean/{ => tests}/pytest/test_glean_parser_rust.py (97%) rename toolkit/components/glean/{ => tests}/pytest/test_no_expired_metrics.py (93%) rename toolkit/components/glean/{ => tests}/test_metrics.yaml (100%) rename toolkit/components/glean/{ => tests}/test_pings.yaml (100%) rename toolkit/components/glean/{ => tests}/xpcshell/test_GIFFT.js (97%) rename toolkit/components/glean/{ => tests}/xpcshell/test_Glean.js (97%) rename toolkit/components/glean/{ => tests}/xpcshell/test_GleanAndroid.js (100%) rename toolkit/components/glean/{ => tests}/xpcshell/test_GleanIPC.js (94%) rename toolkit/components/glean/{ => tests}/xpcshell/xpcshell.ini (100%) diff --git a/toolkit/components/glean/docs/dev/new_metric_types.md b/toolkit/components/glean/docs/dev/new_metric_types.md index ce4092061666..c31208f7e437 100644 --- a/toolkit/components/glean/docs/dev/new_metric_types.md +++ b/toolkit/components/glean/docs/dev/new_metric_types.md @@ -64,7 +64,7 @@ documenting the compatibility in If you add a GIFFT mirror, don't forget to test that the mirror works. You should be able to do this by adding a task to -[`toolkit/components/glean/xpcshell/test_GIFFT.js`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/xpcshell/test_GIFFT.js). +[`toolkit/components/glean/tests/xpcshell/test_GIFFT.js`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/xpcshell/test_GIFFT.js). ## Rust @@ -164,14 +164,14 @@ Each metric type has six pieces you'll need to cover: Two languages means two test suites. - Add a never-expiring test-only metric of your type to - [`test_metrics.yaml`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/test_metrics.yaml). + [`test_metrics.yaml`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/test_metrics.yaml). - Feel free to be clever with the name, but be sure to make clear that it is test-only. - **C++ Tests (GTest)** - Add a small test case to - [`gtest/TestFog.cpp`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/gtest/TestFog.cpp). + [`gtest/TestFog.cpp`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/gtest/TestFog.cpp). - For more details, peruse the [testing docs](testing.md). - **JS Tests (xpcshell)** - Add a small test case to - [`xpcshell/test_Glean.js`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/xpcshell/test_Glean.js). + [`xpcshell/test_Glean.js`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/xpcshell/test_Glean.js). - For more details, peruse the [testing docs](testing.md). ### 7. API Documentation diff --git a/toolkit/components/glean/docs/dev/testing.md b/toolkit/components/glean/docs/dev/testing.md index cd87793bb8b1..42331fa14dc4 100644 --- a/toolkit/components/glean/docs/dev/testing.md +++ b/toolkit/components/glean/docs/dev/testing.md @@ -7,12 +7,11 @@ testing FOG is a matter of choosing the right tool for the situation. To run all the things, here's the tl;dr: -`MOZ_LOG="timestamp,sync,glean::*:5,fog::*:5,fog_control::*:5,glean_core::*:5" -./mach build && ./mach lint -Ww -o --fix +`./mach build && ./mach lint -Ww -o --fix && ./mach lint --linter clippy toolkit/components/glean/api/src && ./mach rusttests && ./mach gtest FOG* -&& python3 ./mach python-test toolkit/components/glean/pytest -&& ./mach test toolkit/components/glean/xpcshell +&& python3 ./mach python-test toolkit/components/glean/tests/pytest +&& ./mach test toolkit/components/glean/tests/xpcshell && ./mach telemetry-tests-client toolkit/components/telemetry/tests/marionette/tests/client/test_fog* --gecko-log "-"` ## Logging @@ -92,18 +91,18 @@ Because Gecko symbols aren't built for the `rusttests` build, any test that is written for code that uses Gecko symbols should be written as a [`gtest`](https://github.com/google/googletest) -in `toolkit/components/glean/gtest/`. +in `toolkit/components/glean/tests/gtest/`. You can write the actual test code in Rust. It needs to be accompanied by a C++ GTest that calls a C FFI-exported Rust function. See [Testing & Debugging Rust Code](/testing-rust-code/) for more. -See [`toolkit/components/glean/gtest/TestFog.cpp`](https://searchfox.org/mozilla-central/source/toolkit/components/glean/gtest/TestFog.cpp) -and [`toolkit/components/glean/gtest/test.rs`](https://searchfox.org/mozilla-central/source/toolkit/components/glean/gtest/test.rs) +See [`toolkit/components/glean/tests/gtest/TestFog.cpp`](https://searchfox.org/mozilla-central/source/toolkit/components/glean/tests/gtest/TestFog.cpp) +and [`toolkit/components/glean/tests/gtest/test.rs`](https://searchfox.org/mozilla-central/source/toolkit/components/glean/tests/gtest/test.rs) for an example. By necessity these can only be integration tests against the compiled crate. **Note:** When adding a new test file, don't forget to add it to -`toolkit/components/glean/gtest/moz.build` and use the +`toolkit/components/glean/tests/gtest/moz.build` and use the `FOG` prefix in your test names (e.g. `TEST(FOG, YourTestName) { ... }`). @@ -115,18 +114,18 @@ The [Glean Parser](https://github.com/mozilla/glean_parser/) has been augmented to generate FOG-specific APIs for Glean metrics. This augmentation is tested by running: -`mach test toolkit/components/glean/pytest` +`mach test toolkit/components/glean/tests/pytest` These tests require Python 3+. If your default Python is Python 2, you may need to instead run: -`python3 mach python-test toolkit/components/glean/pytest` +`python3 mach python-test toolkit/components/glean/tests/pytest` These tests check the code generator output against known good file contents. If you change the code generator the files will need an update. Run the test suite with the `UPDATE_EXPECT` environment variable set to do that automatically: -`UPDATE_EXPECT=1 mach test toolkit/components/glean/pytest` +`UPDATE_EXPECT=1 mach test toolkit/components/glean/tests/pytest` ## C++ (Treeherder symbol `GTest` (a build task)) @@ -134,11 +133,11 @@ To test the C++ parts of FOG's implementation (like metric types) you should use `gtest`. FOG's `gtest` tests are in -[`gtest/`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/gtest/). +[`gtest/`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/gtest/). You can either add a test case to an existing file or add a new file. If you add a new file, remember to add it to the -[`moz.build`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/gtest/moz.build)) +[`moz.build`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/gtest/moz.build)) or the test runner won't be able to find it. All tests should start with `FOG` so that all tests are run with @@ -150,15 +149,15 @@ To test the JS parts of FOG's implementation (like metric types) you should use `xpcshell`. FOG's `xpcshell` tests are in -[`xpcshell/`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/xpcshell). +[`xpcshell/`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/xpcshell). You can either add a test case to an existing file or add a new file. If you add a new file, remember to add it to the -[`xpcshell.ini`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/xpcshell/xpcshell.ini) +[`xpcshell.ini`](https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/glean/tests/xpcshell/xpcshell.ini) or the test runner will not be able to find it. To run FOG's JS tests, run: -`./mach test toolkit/components/glean/xpcshell` +`./mach test toolkit/components/glean/tests/xpcshell` ## Integration (Marionette, borrowing `telemetry-tests-client` Treeherder symbol `tt(c)`) diff --git a/toolkit/components/glean/metrics_index.py b/toolkit/components/glean/metrics_index.py index b539bfd0c046..a2f7d5cce442 100644 --- a/toolkit/components/glean/metrics_index.py +++ b/toolkit/components/glean/metrics_index.py @@ -8,7 +8,7 @@ # New additions should be added to the bottom of the list. metrics_yamls = [ "toolkit/components/glean/metrics.yaml", - "toolkit/components/glean/test_metrics.yaml", + "toolkit/components/glean/tests/test_metrics.yaml", "toolkit/mozapps/update/metrics.yaml", "browser/base/content/metrics.yaml", ] @@ -17,6 +17,6 @@ metrics_yamls = [ # New additions should be added to the bottom of the list. pings_yamls = [ "toolkit/components/glean/pings.yaml", - "toolkit/components/glean/test_pings.yaml", + "toolkit/components/glean/tests/test_pings.yaml", "toolkit/mozapps/update/pings.yaml", ] diff --git a/toolkit/components/glean/moz.build b/toolkit/components/glean/moz.build index 6183d207fc93..1f80c09b1548 100644 --- a/toolkit/components/glean/moz.build +++ b/toolkit/components/glean/moz.build @@ -6,10 +6,6 @@ SPHINX_TREES["/toolkit/components/glean"] = "docs" -PYTHON_UNITTEST_MANIFESTS += [ - "pytest/python.ini", -] - # Needed so that we can include IPC things. include("/ipc/chromium/chromium-config.mozbuild") @@ -90,12 +86,6 @@ SOURCES += [ "!EventExtraGIFFTMaps.cpp", ] -TEST_DIRS += [ - "gtest", -] - -XPCSHELL_TESTS_MANIFESTS += ["xpcshell/xpcshell.ini"] - # Provides us the list of dependent metrics|pings.yaml. include("metrics_index.py") # GeneratedFile's `inputs` are relative to our dir. @@ -194,6 +184,7 @@ GeneratedFile( ) DIRS += [ + "tests", # Must be in DIRS, not TEST_DIRS or python-test won't find it. "xpcom", ] diff --git a/toolkit/components/glean/gtest/Cargo.toml b/toolkit/components/glean/tests/gtest/Cargo.toml similarity index 86% rename from toolkit/components/glean/gtest/Cargo.toml rename to toolkit/components/glean/tests/gtest/Cargo.toml index 83bfd3d244f1..fada84a36cca 100644 --- a/toolkit/components/glean/gtest/Cargo.toml +++ b/toolkit/components/glean/tests/gtest/Cargo.toml @@ -6,7 +6,7 @@ license = "MPL-2.0" description = "Tests for the FOG crate" [dependencies] -fog = { path = "../api" } +fog = { path = "../../api" } [lib] path = "test.rs" diff --git a/toolkit/components/glean/gtest/TestFog.cpp b/toolkit/components/glean/tests/gtest/TestFog.cpp similarity index 100% rename from toolkit/components/glean/gtest/TestFog.cpp rename to toolkit/components/glean/tests/gtest/TestFog.cpp diff --git a/toolkit/components/glean/gtest/TestFogIPC.cpp b/toolkit/components/glean/tests/gtest/TestFogIPC.cpp similarity index 100% rename from toolkit/components/glean/gtest/TestFogIPC.cpp rename to toolkit/components/glean/tests/gtest/TestFogIPC.cpp diff --git a/toolkit/components/glean/gtest/moz.build b/toolkit/components/glean/tests/gtest/moz.build similarity index 100% rename from toolkit/components/glean/gtest/moz.build rename to toolkit/components/glean/tests/gtest/moz.build diff --git a/toolkit/components/glean/gtest/test.rs b/toolkit/components/glean/tests/gtest/test.rs similarity index 100% rename from toolkit/components/glean/gtest/test.rs rename to toolkit/components/glean/tests/gtest/test.rs diff --git a/toolkit/components/glean/tests/moz.build b/toolkit/components/glean/tests/moz.build new file mode 100644 index 000000000000..b03d01ee3cb2 --- /dev/null +++ b/toolkit/components/glean/tests/moz.build @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +PYTHON_UNITTEST_MANIFESTS += ["pytest/python.ini"] + +TEST_DIRS += ["gtest"] + +XPCSHELL_TESTS_MANIFESTS += ["xpcshell/xpcshell.ini"] + +with Files("**"): + BUG_COMPONENT = ("Toolkit", "Telemetry") diff --git a/toolkit/components/glean/pytest/expect_helper.py b/toolkit/components/glean/tests/pytest/expect_helper.py similarity index 100% rename from toolkit/components/glean/pytest/expect_helper.py rename to toolkit/components/glean/tests/pytest/expect_helper.py diff --git a/toolkit/components/glean/pytest/gifft_output_Event b/toolkit/components/glean/tests/pytest/gifft_output_Event similarity index 100% rename from toolkit/components/glean/pytest/gifft_output_Event rename to toolkit/components/glean/tests/pytest/gifft_output_Event diff --git a/toolkit/components/glean/pytest/gifft_output_EventExtra b/toolkit/components/glean/tests/pytest/gifft_output_EventExtra similarity index 100% rename from toolkit/components/glean/pytest/gifft_output_EventExtra rename to toolkit/components/glean/tests/pytest/gifft_output_EventExtra diff --git a/toolkit/components/glean/pytest/gifft_output_Histogram b/toolkit/components/glean/tests/pytest/gifft_output_Histogram similarity index 100% rename from toolkit/components/glean/pytest/gifft_output_Histogram rename to toolkit/components/glean/tests/pytest/gifft_output_Histogram diff --git a/toolkit/components/glean/pytest/gifft_output_Scalar b/toolkit/components/glean/tests/pytest/gifft_output_Scalar similarity index 100% rename from toolkit/components/glean/pytest/gifft_output_Scalar rename to toolkit/components/glean/tests/pytest/gifft_output_Scalar diff --git a/toolkit/components/glean/pytest/metrics_expires_number_test.yaml b/toolkit/components/glean/tests/pytest/metrics_expires_number_test.yaml similarity index 100% rename from toolkit/components/glean/pytest/metrics_expires_number_test.yaml rename to toolkit/components/glean/tests/pytest/metrics_expires_number_test.yaml diff --git a/toolkit/components/glean/pytest/metrics_expires_versions_test.yaml b/toolkit/components/glean/tests/pytest/metrics_expires_versions_test.yaml similarity index 100% rename from toolkit/components/glean/pytest/metrics_expires_versions_test.yaml rename to toolkit/components/glean/tests/pytest/metrics_expires_versions_test.yaml diff --git a/toolkit/components/glean/pytest/metrics_test.yaml b/toolkit/components/glean/tests/pytest/metrics_test.yaml similarity index 100% rename from toolkit/components/glean/pytest/metrics_test.yaml rename to toolkit/components/glean/tests/pytest/metrics_test.yaml diff --git a/toolkit/components/glean/pytest/metrics_test_output b/toolkit/components/glean/tests/pytest/metrics_test_output similarity index 100% rename from toolkit/components/glean/pytest/metrics_test_output rename to toolkit/components/glean/tests/pytest/metrics_test_output diff --git a/toolkit/components/glean/pytest/metrics_test_output_cpp b/toolkit/components/glean/tests/pytest/metrics_test_output_cpp similarity index 100% rename from toolkit/components/glean/pytest/metrics_test_output_cpp rename to toolkit/components/glean/tests/pytest/metrics_test_output_cpp diff --git a/toolkit/components/glean/pytest/metrics_test_output_js b/toolkit/components/glean/tests/pytest/metrics_test_output_js similarity index 100% rename from toolkit/components/glean/pytest/metrics_test_output_js rename to toolkit/components/glean/tests/pytest/metrics_test_output_js diff --git a/toolkit/components/glean/pytest/pings_test.yaml b/toolkit/components/glean/tests/pytest/pings_test.yaml similarity index 100% rename from toolkit/components/glean/pytest/pings_test.yaml rename to toolkit/components/glean/tests/pytest/pings_test.yaml diff --git a/toolkit/components/glean/pytest/pings_test_output b/toolkit/components/glean/tests/pytest/pings_test_output similarity index 100% rename from toolkit/components/glean/pytest/pings_test_output rename to toolkit/components/glean/tests/pytest/pings_test_output diff --git a/toolkit/components/glean/pytest/pings_test_output_cpp b/toolkit/components/glean/tests/pytest/pings_test_output_cpp similarity index 100% rename from toolkit/components/glean/pytest/pings_test_output_cpp rename to toolkit/components/glean/tests/pytest/pings_test_output_cpp diff --git a/toolkit/components/glean/pytest/pings_test_output_js b/toolkit/components/glean/tests/pytest/pings_test_output_js similarity index 100% rename from toolkit/components/glean/pytest/pings_test_output_js rename to toolkit/components/glean/tests/pytest/pings_test_output_js diff --git a/toolkit/components/glean/pytest/python.ini b/toolkit/components/glean/tests/pytest/python.ini similarity index 100% rename from toolkit/components/glean/pytest/python.ini rename to toolkit/components/glean/tests/pytest/python.ini diff --git a/toolkit/components/glean/pytest/test_gifft.py b/toolkit/components/glean/tests/pytest/test_gifft.py similarity index 95% rename from toolkit/components/glean/pytest/test_gifft.py rename to toolkit/components/glean/tests/pytest/test_gifft.py index 54dc0ea1f9d0..9559e2e0302a 100644 --- a/toolkit/components/glean/pytest/test_gifft.py +++ b/toolkit/components/glean/tests/pytest/test_gifft.py @@ -11,7 +11,9 @@ import sys from expect_helper import expect # Shenanigans to import the FOG glean_parser runner -FOG_ROOT_PATH = path.abspath(path.join(path.dirname(__file__), path.pardir)) +FOG_ROOT_PATH = path.abspath( + path.join(path.dirname(__file__), path.pardir, path.pardir) +) sys.path.append(path.join(FOG_ROOT_PATH, "build_scripts", "glean_parser_ext")) import run_glean_parser diff --git a/toolkit/components/glean/pytest/test_glean_parser_cpp.py b/toolkit/components/glean/tests/pytest/test_glean_parser_cpp.py similarity index 96% rename from toolkit/components/glean/pytest/test_glean_parser_cpp.py rename to toolkit/components/glean/tests/pytest/test_glean_parser_cpp.py index 7a836b477f3d..811d07316797 100644 --- a/toolkit/components/glean/pytest/test_glean_parser_cpp.py +++ b/toolkit/components/glean/tests/pytest/test_glean_parser_cpp.py @@ -11,7 +11,9 @@ import sys from expect_helper import expect # Shenanigans to import the cpp outputter extension -FOG_ROOT_PATH = path.abspath(path.join(path.dirname(__file__), path.pardir)) +FOG_ROOT_PATH = path.abspath( + path.join(path.dirname(__file__), path.pardir, path.pardir) +) sys.path.append(path.join(FOG_ROOT_PATH, "build_scripts", "glean_parser_ext")) import cpp diff --git a/toolkit/components/glean/pytest/test_glean_parser_js.py b/toolkit/components/glean/tests/pytest/test_glean_parser_js.py similarity index 96% rename from toolkit/components/glean/pytest/test_glean_parser_js.py rename to toolkit/components/glean/tests/pytest/test_glean_parser_js.py index b913e5748f1c..16e58ba0a35c 100644 --- a/toolkit/components/glean/pytest/test_glean_parser_js.py +++ b/toolkit/components/glean/tests/pytest/test_glean_parser_js.py @@ -11,7 +11,9 @@ import sys from expect_helper import expect # Shenanigans to import the js outputter extension -FOG_ROOT_PATH = path.abspath(path.join(path.dirname(__file__), path.pardir)) +FOG_ROOT_PATH = path.abspath( + path.join(path.dirname(__file__), path.pardir, path.pardir) +) sys.path.append(path.join(FOG_ROOT_PATH, "build_scripts", "glean_parser_ext")) import js diff --git a/toolkit/components/glean/pytest/test_glean_parser_rust.py b/toolkit/components/glean/tests/pytest/test_glean_parser_rust.py similarity index 97% rename from toolkit/components/glean/pytest/test_glean_parser_rust.py rename to toolkit/components/glean/tests/pytest/test_glean_parser_rust.py index 9b75f9748cc3..eeea2e5343ba 100644 --- a/toolkit/components/glean/pytest/test_glean_parser_rust.py +++ b/toolkit/components/glean/tests/pytest/test_glean_parser_rust.py @@ -12,7 +12,9 @@ import sys from expect_helper import expect # Shenanigans to import the rust outputter extension -FOG_ROOT_PATH = path.abspath(path.join(path.dirname(__file__), path.pardir)) +FOG_ROOT_PATH = path.abspath( + path.join(path.dirname(__file__), path.pardir, path.pardir) +) sys.path.append(path.join(FOG_ROOT_PATH, "build_scripts", "glean_parser_ext")) import run_glean_parser import rust diff --git a/toolkit/components/glean/pytest/test_no_expired_metrics.py b/toolkit/components/glean/tests/pytest/test_no_expired_metrics.py similarity index 93% rename from toolkit/components/glean/pytest/test_no_expired_metrics.py rename to toolkit/components/glean/tests/pytest/test_no_expired_metrics.py index 5d394d4a310c..66b53ef71366 100644 --- a/toolkit/components/glean/pytest/test_no_expired_metrics.py +++ b/toolkit/components/glean/tests/pytest/test_no_expired_metrics.py @@ -8,7 +8,9 @@ from pathlib import Path import sys # Shenanigans to import the metrics index's list of metrics.yamls -FOG_ROOT_PATH = path.abspath(path.join(path.dirname(__file__), path.pardir)) +FOG_ROOT_PATH = path.abspath( + path.join(path.dirname(__file__), path.pardir, path.pardir) +) sys.path.append(FOG_ROOT_PATH) from metrics_index import metrics_yamls diff --git a/toolkit/components/glean/test_metrics.yaml b/toolkit/components/glean/tests/test_metrics.yaml similarity index 100% rename from toolkit/components/glean/test_metrics.yaml rename to toolkit/components/glean/tests/test_metrics.yaml diff --git a/toolkit/components/glean/test_pings.yaml b/toolkit/components/glean/tests/test_pings.yaml similarity index 100% rename from toolkit/components/glean/test_pings.yaml rename to toolkit/components/glean/tests/test_pings.yaml diff --git a/toolkit/components/glean/xpcshell/test_GIFFT.js b/toolkit/components/glean/tests/xpcshell/test_GIFFT.js similarity index 97% rename from toolkit/components/glean/xpcshell/test_GIFFT.js rename to toolkit/components/glean/tests/xpcshell/test_GIFFT.js index 1374f7e25943..4eac5dadbae4 100644 --- a/toolkit/components/glean/xpcshell/test_GIFFT.js +++ b/toolkit/components/glean/tests/xpcshell/test_GIFFT.js @@ -1,12 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/* FIXME: Remove these global markers. - * FOG doesn't follow the stricter naming patterns as expected by tool configuration yet. - * See https://searchfox.org/mozilla-central/source/.eslintrc.js#24 - * Reorganizing the directory structure will take this into account. - */ -/* global add_task, Assert, do_get_profile */ "use strict"; Cu.importGlobalProperties(["Glean"]); diff --git a/toolkit/components/glean/xpcshell/test_Glean.js b/toolkit/components/glean/tests/xpcshell/test_Glean.js similarity index 97% rename from toolkit/components/glean/xpcshell/test_Glean.js rename to toolkit/components/glean/tests/xpcshell/test_Glean.js index 359484c3fa58..3f5692cb8b00 100644 --- a/toolkit/components/glean/xpcshell/test_Glean.js +++ b/toolkit/components/glean/tests/xpcshell/test_Glean.js @@ -1,12 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/* FIXME: Remove these global markers. - * FOG doesn't follow the stricter naming patterns as expected by tool configuration yet. - * See https://searchfox.org/mozilla-central/source/.eslintrc.js#24 - * Reorganizing the directory structure will take this into account. - */ -/* global add_task, Assert, do_get_profile */ "use strict"; Cu.importGlobalProperties(["Glean", "GleanPings"]); diff --git a/toolkit/components/glean/xpcshell/test_GleanAndroid.js b/toolkit/components/glean/tests/xpcshell/test_GleanAndroid.js similarity index 100% rename from toolkit/components/glean/xpcshell/test_GleanAndroid.js rename to toolkit/components/glean/tests/xpcshell/test_GleanAndroid.js diff --git a/toolkit/components/glean/xpcshell/test_GleanIPC.js b/toolkit/components/glean/tests/xpcshell/test_GleanIPC.js similarity index 94% rename from toolkit/components/glean/xpcshell/test_GleanIPC.js rename to toolkit/components/glean/tests/xpcshell/test_GleanIPC.js index 7bb518ea1930..f92049386adb 100644 --- a/toolkit/components/glean/xpcshell/test_GleanIPC.js +++ b/toolkit/components/glean/tests/xpcshell/test_GleanIPC.js @@ -1,12 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -/* FIXME: Remove these global markers. - * FOG doesn't follow the stricter naming patterns as expected by tool configuration yet. - * See https://searchfox.org/mozilla-central/source/.eslintrc.js#24 - * Reorganizing the directory structure will take this into account. - */ -/* global add_task, Assert, do_get_profile, run_test_in_child, runningInParent */ "use strict"; Cu.importGlobalProperties(["Glean", "GleanPings"]); diff --git a/toolkit/components/glean/xpcshell/xpcshell.ini b/toolkit/components/glean/tests/xpcshell/xpcshell.ini similarity index 100% rename from toolkit/components/glean/xpcshell/xpcshell.ini rename to toolkit/components/glean/tests/xpcshell/xpcshell.ini diff --git a/toolkit/library/gtest/rust/Cargo.toml b/toolkit/library/gtest/rust/Cargo.toml index 63a03e87670a..347b296f90a3 100644 --- a/toolkit/library/gtest/rust/Cargo.toml +++ b/toolkit/library/gtest/rust/Cargo.toml @@ -45,7 +45,7 @@ nsstring-gtest = { path = "../../../../xpcom/rust/gtest/nsstring" } xpcom-gtest = { path = "../../../../xpcom/rust/gtest/xpcom" } gkrust-shared = { path = "../../rust/shared" } gecko-fuzz-targets = { path = "../../../../tools/fuzzing/rust", optional = true } -fog-gtest = { path = "../../../components/glean/gtest" } +fog-gtest = { path = "../../../components/glean/tests/gtest" } # Workarounds for https://github.com/rust-lang/rust/issues/58393 mozglue-static = { path = "../../../../mozglue/static/rust" }