Browse Source

build: remove native specs (#40190)

Shelley Vohr 1 year ago
parent
commit
592a30aa0b
6 changed files with 7 additions and 87 deletions
  1. 1 1
      .circleci/config/base.yml
  2. 0 19
      BUILD.gn
  3. 2 4
      appveyor-woa.yml
  4. 3 6
      appveyor.yml
  5. 0 3
      script/native-test-targets.json
  6. 1 54
      script/spec-runner.js

+ 1 - 1
.circleci/config/base.yml

@@ -1210,7 +1210,7 @@ commands:
           build-type: << parameters.build-type >>
       - *step-maybe-electron-dist-strip
       - step-electron-dist-build:
-          additional-targets: shell_browser_ui_unittests electron:node_headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
+          additional-targets: electron:node_headers third_party/electron_node:overlapped-checker electron:hunspell_dictionaries_zip
 
       - *step-show-goma-stats
 

+ 0 - 19
BUILD.gn

@@ -1328,25 +1328,6 @@ if (is_mac) {
   }
 }
 
-test("shell_browser_ui_unittests") {
-  sources = [
-    "//electron/shell/browser/ui/accelerator_util_unittests.cc",
-    "//electron/shell/browser/ui/run_all_unittests.cc",
-  ]
-
-  configs += [ ":electron_lib_config" ]
-
-  deps = [
-    ":electron_lib",
-    "//base",
-    "//base/test:test_support",
-    "//testing/gmock",
-    "//testing/gtest",
-    "//ui/base",
-    "//ui/strings",
-  ]
-}
-
 template("dist_zip") {
   _runtime_deps_target = "${target_name}__deps"
   _runtime_deps_file =

+ 2 - 4
appveyor-woa.yml

@@ -156,7 +156,6 @@ for:
       - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
       - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
       - ninja -C out/Default electron:electron_dist_zip
-      - ninja -C out/Default shell_browser_ui_unittests
       - gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
       # Remove unused args from mksnapshot_args
       - ps: >-
@@ -195,7 +194,7 @@ for:
           if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
             Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
           } else {
-            $artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
+            $artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
             foreach($artifact_name in $artifacts_to_validate) {
               if ($artifact_name -eq 'ffmpeg.zip') {
                 $artifact_file = "out\ffmpeg\ffmpeg.zip"
@@ -233,7 +232,6 @@ for:
       - cd C:\projects\src
       - if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
       - if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
-      - if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
       - if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
       - if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
       - if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
@@ -277,7 +275,7 @@ for:
             if ($job.name -eq "Build Arm on X64 Windows") {
               $jobId = $job.jobId
               foreach($artifact_name in $artifacts_to_download) {
-                if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
+                if ($artifact_name -eq 'electron.lib') {
                   $outfile = "src\out\Default\$artifact_name"
                 } else {
                   $outfile = $artifact_name

+ 3 - 6
appveyor.yml

@@ -154,7 +154,6 @@ for:
       - gn gen out/ffmpeg "--args=import(\"//electron/build/args/ffmpeg.gn\") %GN_EXTRA_ARGS%"
       - ninja -C out/ffmpeg electron:electron_ffmpeg_zip
       - ninja -C out/Default electron:electron_dist_zip
-      - ninja -C out/Default shell_browser_ui_unittests
       - gn desc out/Default v8:run_mksnapshot_default args > out/Default/default_mksnapshot_args
       # Remove unused args from mksnapshot_args
       - ps: >-
@@ -193,7 +192,7 @@ for:
           if ($env:SHOULD_SKIP_ARTIFACT_VALIDATION -eq 'true') {
             Write-warning "Skipping artifact validation for doc-only $env:APPVEYOR_PROJECT_NAME"
           } else {
-            $artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
+            $artifacts_to_validate = 'dist.zip','windows_toolchain_profile.json','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib','hunspell_dictionaries.zip'
             foreach($artifact_name in $artifacts_to_validate) {
               if ($artifact_name -eq 'ffmpeg.zip') {
                 $artifact_file = "out\ffmpeg\ffmpeg.zip"
@@ -231,7 +230,6 @@ for:
       - cd C:\projects\src
       - if exist out\Default\windows_toolchain_profile.json ( appveyor-retry appveyor PushArtifact out\Default\windows_toolchain_profile.json )
       - if exist out\Default\dist.zip (appveyor-retry appveyor PushArtifact out\Default\dist.zip)
-      - if exist out\Default\shell_browser_ui_unittests.exe (appveyor-retry appveyor PushArtifact out\Default\shell_browser_ui_unittests.exe)
       - if exist out\Default\chromedriver.zip (appveyor-retry appveyor PushArtifact out\Default\chromedriver.zip)
       - if exist out\ffmpeg\ffmpeg.zip (appveyor-retry appveyor PushArtifact out\ffmpeg\ffmpeg.zip)
       - if exist node_headers.zip (appveyor-retry appveyor PushArtifact node_headers.zip)
@@ -268,12 +266,12 @@ for:
           # Download build artifacts
           $apiUrl = 'https://ci.appveyor.com/api'
           $build_info = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/builds/$env:APPVEYOR_BUILD_ID"
-          $artifacts_to_download = @('dist.zip','shell_browser_ui_unittests.exe','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
+          $artifacts_to_download = @('dist.zip','chromedriver.zip','ffmpeg.zip','node_headers.zip','mksnapshot.zip','electron.lib')
           foreach ($job in $build_info.build.jobs) {
             if ($job.name -eq "Build") {
               $jobId = $job.jobId
               foreach($artifact_name in $artifacts_to_download) {
-                if ($artifact_name -eq 'shell_browser_ui_unittests.exe' -Or $artifact_name -eq 'electron.lib') {
+                if ($artifact_name -eq 'electron.lib') {
                   $outfile = "src\out\Default\$artifact_name"
                 } else {
                   $outfile = $artifact_name
@@ -307,7 +305,6 @@ for:
             $env:npm_config_arch = "ia32"
           }
       - echo Running main test suite & node script/yarn test -- --trace-uncaught --runners=main --enable-logging=file --log-file=%cd%\electron.log
-      - echo Running native test suite & node script/yarn test -- --trace-uncaught --runners=native --enable-logging=file --log-file=%cd%\electron.log
       - cd ..
       - echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg
       - echo "About to verify mksnapshot"

+ 0 - 3
script/native-test-targets.json

@@ -1,3 +0,0 @@
-[
-  "shell_browser_ui_unittests"
-]

+ 1 - 54
script/spec-runner.js

@@ -15,7 +15,6 @@ const fail = '✗'.red;
 
 const args = require('minimist')(process.argv, {
   string: ['runners', 'target', 'electronVersion'],
-  boolean: ['buildNativeTests'],
   unknown: arg => unknownFlags.push(arg)
 });
 
@@ -35,8 +34,7 @@ const BASE = path.resolve(__dirname, '../..');
 const NPX_CMD = process.platform === 'win32' ? 'npx.cmd' : 'npx';
 
 const runners = new Map([
-  ['main', { description: 'Main process specs', run: runMainProcessElectronTests }],
-  ['native', { description: 'Native specs', run: runNativeElectronTests }]
+  ['main', { description: 'Main process specs', run: runMainProcessElectronTests }]
 ]);
 
 const specHashPath = path.resolve(__dirname, '../spec/.hash');
@@ -183,57 +181,6 @@ async function runTestUsingElectron (specDir, testName) {
   console.log(`${pass} Electron ${testName} process tests passed.`);
 }
 
-async function runNativeElectronTests () {
-  let testTargets = require('./native-test-targets.json');
-  const outDir = `out/${utils.getOutDir()}`;
-
-  // If native tests are being run, only one arg would be relevant
-  if (args.target && !testTargets.includes(args.target)) {
-    console.log(`${fail} ${args.target} must be a subset of [${[testTargets].join(', ')}]`);
-    process.exit(1);
-  }
-
-  // Optionally build all native test targets
-  if (args.buildNativeTests) {
-    for (const target of testTargets) {
-      const build = childProcess.spawnSync('ninja', ['-C', outDir, target], {
-        cwd: path.resolve(__dirname, '../..'),
-        stdio: 'inherit'
-      });
-
-      // Exit if test target failed to build
-      if (build.status !== 0) {
-        console.log(`${fail} ${target} failed to build.`);
-        process.exit(1);
-      }
-    }
-  }
-
-  // If a specific target was passed, only build and run that target
-  if (args.target) testTargets = [args.target];
-
-  // Run test targets
-  const failures = [];
-  for (const target of testTargets) {
-    console.info('\nRunning native test for target:', target);
-    const testRun = childProcess.spawnSync(`./${outDir}/${target}`, {
-      cwd: path.resolve(__dirname, '../..'),
-      stdio: 'inherit'
-    });
-
-    // Collect failures and log at end
-    if (testRun.status !== 0) failures.push({ target });
-  }
-
-  // Exit if any failures
-  if (failures.length > 0) {
-    console.log(`${fail} Electron native tests failed for the following targets: `, failures);
-    process.exit(1);
-  }
-
-  console.log(`${pass} Electron native tests passed.`);
-}
-
 async function runMainProcessElectronTests () {
   await runTestUsingElectron('spec', 'main');
 }