Skip to content

Commit

Permalink
Revert "Android: Rename target incremental_javac_junit_tests -> build…
Browse files Browse the repository at this point in the history
…_junit_tests"

This reverts commit ad6aed8.

Reason for revert: https://crbug.com/1334000

Original change's description:
> Android: Rename target incremental_javac_junit_tests -> build_junit_tests
>
> so that we can add more build-related tests to it.
>
> * Uses proper java package for the test
> * Moves test target to build/android/BUILD.gn so that it doesn't
>   reference files above it in the directory tree
> * Removes dep on //base's test runner (layering violation)
>
> Also: 
> Bug: 1322737
> Change-Id: Ic8033db3743019a26a15d27403f33f59fcf6d484
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688332
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Peter Wen <wnwen@chromium.org>
> Reviewed-by: Ben Pastene <bpastene@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1011221}

Bug: 1322737, 1334000
Change-Id: Ic7e6a327c57815b4f9458be34e3806c3e9f7b68b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688023
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1011231}
  • Loading branch information
Takuto Ikuta authored and Chromium LUCI CQ committed Jun 7, 2022
1 parent a8b30b5 commit e876645
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 154 deletions.
6 changes: 2 additions & 4 deletions build/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ def CheckNoBadDeps(input_api, output_api):
r'(.+/)?BUILD\.gn',
r'.+\.gni',
]
blocklist_pattern = input_api.re.compile(
r'^[^#]*//(?:base|third_party|components)')
allowlist_pattern = input_api.re.compile(r'^[^#]*//third_party/junit')
bad_pattern = input_api.re.compile(r'^[^#]*//(base|third_party|components)')

warning_message = textwrap.dedent("""
The //build directory is meant to be as hermetic as possible so that
Expand All @@ -38,7 +36,7 @@ def FilterFile(affected_file):
for f in input_api.AffectedSourceFiles(FilterFile):
local_path = f.LocalPath()
for line_number, line in f.ChangedContents():
if blocklist_pattern.search(line) and not allowlist_pattern.search(line):
if (bad_pattern.search(line)):
problems.append('%s:%d\n %s' %
(local_path, line_number, line.strip()))
if problems:
Expand Down
8 changes: 0 additions & 8 deletions build/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ if (enable_java_templates) {
# be created when creating an apk.
jar_excluded_patterns += [ "*/NativeLibraries.class" ]
}

junit_binary("build_junit_tests") {
sources = [ "junit/src/org/chromium/build/IncrementalJavacTest.java" ]
deps = [
"//build/android/test/incremental_javac_gn:no_signature_change_prebuilt_java",
"//third_party/junit",
]
}
}

python_library("devil_chromium_py") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.build;
package test;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;

import org.chromium.testing.local.LocalRobolectricTestRunner;

import test.NoSignatureChangeIncrementalJavacTestHelper;
import org.chromium.base.test.BaseRobolectricTestRunner;

/**
* Checks that build picked up changes to
* {@link NoSignatureChangeIncrementalJavacTestHelper#foo()}.
*/
@RunWith(LocalRobolectricTestRunner.class)
@RunWith(BaseRobolectricTestRunner.class)
@Config(manifest = Config.NONE)
public final class IncrementalJavacTest {
@Test
Expand Down
150 changes: 81 additions & 69 deletions build/android/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,78 +6,90 @@ import("//build/config/android/android_nocompile.gni")
import("missing_symbol_test.gni")
import("nocompile_gn/nocompile_sources.gni")

group("android_nocompile_tests") {
testonly = true
if (enable_java_templates) {
group("android_nocompile_tests") {
testonly = true

# No-compile tests use an output directory dedicated to no-compile tests.
# All test suites use targets in nocompile_gn/BUILD.gn in order to share the
# same target output directory and avoid running 'gn gen' for each
# android_nocompile_test_suite().
deps = [
":android_lint_tests",
":android_lookup_dep_tests",
]
}
# No-compile tests use an output directory dedicated to no-compile tests.
# All test suites use targets in nocompile_gn/BUILD.gn in order to share the
# same target output directory and avoid running 'gn gen' for each
# android_nocompile_test_suite().
deps = [
":android_lint_tests",
":android_lookup_dep_tests",
]
}

android_nocompile_test_suite("android_lint_tests") {
# Depend on lint script so that the action is re-run whenever the script is modified.
pydeps = [ "//build/android/gyp/lint.pydeps" ]
android_nocompile_test_suite("android_lint_tests") {
# Depend on lint script so that the action is re-run whenever the script is modified.
pydeps = [ "//build/android/gyp/lint.pydeps" ]

tests = [
{
target = "nocompile_gn:default_locale_lint_test"
nocompile_sources =
rebase_path(default_locale_lint_test_nocompile_sources,
"",
"nocompile_gn")
expected_compile_output_regex = "Warning:.*DefaultLocale"
},
{
target = "nocompile_gn:new_api_lint_test"
nocompile_sources =
rebase_path(new_api_lint_test_nocompile_sources, "", "nocompile_gn")
expected_compile_output_regex = "Error:.*NewApi"
},
]
}
tests = [
{
target = "nocompile_gn:default_locale_lint_test"
nocompile_sources =
rebase_path(default_locale_lint_test_nocompile_sources,
"",
"nocompile_gn")
expected_compile_output_regex = "Warning:.*DefaultLocale"
},
{
target = "nocompile_gn:new_api_lint_test"
nocompile_sources =
rebase_path(new_api_lint_test_nocompile_sources, "", "nocompile_gn")
expected_compile_output_regex = "Error:.*NewApi"
},
]
}

android_nocompile_test_suite("android_lookup_dep_tests") {
sources = [ rebase_path(
missing_symbol_generated_importer_template_nocompile_source,
"",
"nocompile_gn") ]

android_nocompile_test_suite("android_lookup_dep_tests") {
sources =
[ rebase_path(missing_symbol_generated_importer_template_nocompile_source,
"",
"nocompile_gn") ]
tests = [
{
target = "nocompile_gn:import_child_missing_symbol_test_java"
nocompile_sources =
rebase_path(import_child_missing_symbol_test_nocompile_sources,
"",
"nocompile_gn")
expected_compile_output_regex = "error: package test\.missing_symbol\.sub does not exist\nHint: Add \"//build/android/test/nocompile_gn:sub_b_java\" to deps of //build/android/test/nocompile_gn:import_child_missing_symbol_test_java"
},
{
target = "nocompile_gn:import_parent_missing_symbol_test_java"
nocompile_sources = []
expected_compile_output_regex = "error: cannot find symbol test\.missing_symbol\.B\nHint: Add \"//build/android/test/nocompile_gn:b_java\" to deps of //build/android/test/nocompile_gn:import_parent_missing_symbol_test_java"
},
{
target = "nocompile_gn:import_turbine_missing_symbol_test_java"
nocompile_sources =
rebase_path(import_turbine_missing_symbol_test_nocompile_sources,
"",
"nocompile_gn")
expected_compile_output_regex = "error: symbol not found test\.missing_symbol\.B\nHint: Add \"//build/android/test/nocompile_gn:b_java\" to deps of //build/android/test/nocompile_gn:import_turbine_missing_symbol_test_java"
},
{
target = "nocompile_gn:prebuilt_missing_symbol_test_java"
nocompile_sources = []
expected_compile_output_regex = "error: cannot find symbol test\.missing_symbol\.C\nHint: Add \"//build/android/test/nocompile_gn:c_prebuilt_java\" to deps of //build/android/test/nocompile_gn:prebuilt_missing_symbol_test_java"
},
{
target = "nocompile_gn:cpp_template_missing_symbol_test_java"
nocompile_sources = []
expected_compile_output_regex = "error: cannot find symbol test\.missing_symbol\.D\nHint: Add \"//build/android/test/nocompile_gn:d_java\" to deps of //build/android/test/nocompile_gn:cpp_template_missing_symbol_test_java"
},
]
}

tests = [
{
target = "nocompile_gn:import_child_missing_symbol_test_java"
nocompile_sources =
rebase_path(import_child_missing_symbol_test_nocompile_sources,
"",
"nocompile_gn")
expected_compile_output_regex = "error: package test\.missing_symbol\.sub does not exist\nHint: Add \"//build/android/test/nocompile_gn:sub_b_java\" to deps of //build/android/test/nocompile_gn:import_child_missing_symbol_test_java"
},
{
target = "nocompile_gn:import_parent_missing_symbol_test_java"
nocompile_sources = []
expected_compile_output_regex = "error: cannot find symbol test\.missing_symbol\.B\nHint: Add \"//build/android/test/nocompile_gn:b_java\" to deps of //build/android/test/nocompile_gn:import_parent_missing_symbol_test_java"
},
{
target = "nocompile_gn:import_turbine_missing_symbol_test_java"
nocompile_sources =
rebase_path(import_turbine_missing_symbol_test_nocompile_sources,
"",
"nocompile_gn")
expected_compile_output_regex = "error: symbol not found test\.missing_symbol\.B\nHint: Add \"//build/android/test/nocompile_gn:b_java\" to deps of //build/android/test/nocompile_gn:import_turbine_missing_symbol_test_java"
},
{
target = "nocompile_gn:prebuilt_missing_symbol_test_java"
nocompile_sources = []
expected_compile_output_regex = "error: cannot find symbol test\.missing_symbol\.C\nHint: Add \"//build/android/test/nocompile_gn:c_prebuilt_java\" to deps of //build/android/test/nocompile_gn:prebuilt_missing_symbol_test_java"
},
{
target = "nocompile_gn:cpp_template_missing_symbol_test_java"
nocompile_sources = []
expected_compile_output_regex = "error: cannot find symbol test\.missing_symbol\.D\nHint: Add \"//build/android/test/nocompile_gn:d_java\" to deps of //build/android/test/nocompile_gn:cpp_template_missing_symbol_test_java"
},
]
# Tests that builds which use incremental javac are valid.
junit_binary("incremental_javac_junit_tests") {
sources = [ "../java/test/IncrementalJavacTest.java" ]
deps = [
"incremental_javac_gn:no_signature_change_prebuilt_java",
"//base:base_junit_test_support",
"//third_party/junit",
]
}
}
22 changes: 11 additions & 11 deletions testing/buildbot/chromium.android.fyi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7704,17 +7704,6 @@
"test": "base_junit_tests",
"test_id_prefix": "ninja://base:base_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "build_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "build_junit_tests",
"test_id_prefix": "ninja://build/android/test:build_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "chrome_java_test_pagecontroller_junit_tests",
Expand Down Expand Up @@ -7770,6 +7759,17 @@
"test": "device_junit_tests",
"test_id_prefix": "ninja://device:device_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "incremental_javac_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "incremental_javac_junit_tests",
"test_id_prefix": "ninja://build/android/test:incremental_javac_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "junit_unit_tests",
Expand Down
54 changes: 27 additions & 27 deletions testing/buildbot/chromium.android.json
Original file line number Diff line number Diff line change
Expand Up @@ -1612,12 +1612,6 @@
"test": "base_junit_tests",
"test_id_prefix": "ninja://base:base_junit_tests/"
},
{
"name": "build_junit_tests",
"swarming": {},
"test": "build_junit_tests",
"test_id_prefix": "ninja://build/android/test:build_junit_tests/"
},
{
"name": "chrome_java_test_pagecontroller_junit_tests",
"swarming": {},
Expand Down Expand Up @@ -1648,6 +1642,12 @@
"test": "device_junit_tests",
"test_id_prefix": "ninja://device:device_junit_tests/"
},
{
"name": "incremental_javac_junit_tests",
"swarming": {},
"test": "incremental_javac_junit_tests",
"test_id_prefix": "ninja://build/android/test:incremental_javac_junit_tests/"
},
{
"name": "junit_unit_tests",
"swarming": {},
Expand Down Expand Up @@ -23490,16 +23490,6 @@
"test": "base_junit_tests",
"test_id_prefix": "ninja://base:base_junit_tests/"
},
{
"name": "build_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "build_junit_tests",
"test_id_prefix": "ninja://build/android/test:build_junit_tests/"
},
{
"name": "chrome_java_test_pagecontroller_junit_tests",
"resultdb": {
Expand Down Expand Up @@ -23550,6 +23540,16 @@
"test": "device_junit_tests",
"test_id_prefix": "ninja://device:device_junit_tests/"
},
{
"name": "incremental_javac_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "incremental_javac_junit_tests",
"test_id_prefix": "ninja://build/android/test:incremental_javac_junit_tests/"
},
{
"name": "junit_unit_tests",
"resultdb": {
Expand Down Expand Up @@ -31547,17 +31547,6 @@
"test": "base_junit_tests",
"test_id_prefix": "ninja://base:base_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "build_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "build_junit_tests",
"test_id_prefix": "ninja://build/android/test:build_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "chrome_java_test_pagecontroller_junit_tests",
Expand Down Expand Up @@ -31616,6 +31605,17 @@
"test": "device_junit_tests",
"test_id_prefix": "ninja://device:device_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "incremental_javac_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "incremental_javac_junit_tests",
"test_id_prefix": "ninja://build/android/test:incremental_javac_junit_tests/"
},
{
"isolate_profile_data": true,
"name": "junit_unit_tests",
Expand Down
20 changes: 10 additions & 10 deletions testing/buildbot/chromium.clang.json
Original file line number Diff line number Diff line change
Expand Up @@ -8328,16 +8328,6 @@
"test": "base_junit_tests",
"test_id_prefix": "ninja://base:base_junit_tests/"
},
{
"name": "build_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "build_junit_tests",
"test_id_prefix": "ninja://build/android/test:build_junit_tests/"
},
{
"name": "chrome_java_test_pagecontroller_junit_tests",
"resultdb": {
Expand Down Expand Up @@ -8388,6 +8378,16 @@
"test": "device_junit_tests",
"test_id_prefix": "ninja://device:device_junit_tests/"
},
{
"name": "incremental_javac_junit_tests",
"resultdb": {
"enable": true,
"has_native_resultdb_integration": true
},
"swarming": {},
"test": "incremental_javac_junit_tests",
"test_id_prefix": "ninja://build/android/test:incremental_javac_junit_tests/"
},
{
"name": "junit_unit_tests",
"resultdb": {
Expand Down
Loading

0 comments on commit e876645

Please sign in to comment.