From 2e98c544a75cd973f7c5bc579ec5b8e7c1cc578e Mon Sep 17 00:00:00 2001 From: Artem Samoilenko Date: Fri, 13 Sep 2024 13:47:22 -0400 Subject: [PATCH] [Android] Changes for unit tests Now we will have separate suite for java unit tests to run. In addition, tests will be run on x64 emulators like they started doing in the upstream. --- build/commands/lib/test.js | 13 +++++-------- build/commands/scripts/commands.js | 2 +- test/BUILD.gn | 3 ++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/build/commands/lib/test.js b/build/commands/lib/test.js index f00f6a1c8c9f..0a00bb63c70f 100644 --- a/build/commands/lib/test.js +++ b/build/commands/lib/test.js @@ -20,9 +20,9 @@ const getTestsToRun = (config, suite) => { if (suite === 'brave_unit_tests') { if (config.targetOS !== 'android') { testsToRun.push('brave_installer_unittests') - } else { - testsToRun.push('bin/run_brave_public_test_apk') } + } else if (suite === 'brave_java_unit_tests') { + testsToRun = ['bin/run_brave_java_unit_tests'] } return testsToRun } @@ -71,14 +71,11 @@ const buildTests = async (suite, buildConfig = config.defaultBuildConfig, option let testSuites = [ 'brave_unit_tests', 'brave_browser_tests', + 'brave_java_unit_tests', 'brave_network_audit_tests', ] if (testSuites.includes(suite)) { config.buildTargets = ['brave/test:' + suite] - if (suite === 'brave_unit_tests' && config.targetOS === 'android') { - // We need to build the APK for the java tests as well. - config.buildTargets.push('brave/test:brave_public_test_apk') - } } else { config.buildTargets = [suite] } @@ -168,8 +165,8 @@ const runTests = (passthroughArgs, suite, buildConfig, options) => { } if (config.targetOS === 'android') { assert( - config.targetArch === 'x86' || options.manual_android_test_device, - 'Only x86 build can be run automatically. For other builds please run test device manually and specify manual_android_test_device flag.') + config.targetArch === 'x86' || config.targetArch === 'x64' || options.manual_android_test_device, + 'Only x86 and x64 builds can be run automatically. For other builds please run test device manually and specify manual_android_test_device flag.') } if (config.targetOS === 'android' && !options.manual_android_test_device) { // Specify emulator to run tests on diff --git a/build/commands/scripts/commands.js b/build/commands/scripts/commands.js index d5a8802fd698..f70bb9d99e57 100644 --- a/build/commands/scripts/commands.js +++ b/build/commands/scripts/commands.js @@ -246,7 +246,7 @@ program .option('--target_environment ', 'target environment (device, catalyst, simulator)') .option('--run_disabled_tests', 'run disabled tests') .option('--manual_android_test_device', 'indicates that Android test device is run manually') - .option('--android_test_emulator_name