Disable ferrochrome tests that running ChromeOS VM

Bug: 379800648
Test: TH
Change-Id: I91fa65b2a503f663f63c01eae8eb7d22684132d6
diff --git a/TEST_MAPPING b/TEST_MAPPING
index e197b25..8cb01d7 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -72,11 +72,6 @@
       "name": "TerminalAppTests"
     }
   ],
-  "ferrochrome-postsubmit": [
-    {
-      "name": "ferrochrome-tests"
-    }
-  ],
   "postsubmit": [
     {
       "name": "CtsMicrodroidDisabledTestCases"
diff --git a/docs/custom_vm.md b/docs/custom_vm.md
index b02fbf7..2863eb6 100644
--- a/docs/custom_vm.md
+++ b/docs/custom_vm.md
@@ -106,223 +106,3 @@
 adduser linux sudo
 reboot
 ```
-
-## Graphical VMs
-
-To run OSes with graphics support, simply
-`packages/modules/Virtualization/tests/ferrochrome/ferrochrome.sh --forever`.
-It prepares and launches the ChromiumOS, which is the only officially supported
-guest payload. We will be adding more OSes in the future.
-
-If you want to do so by yourself, follow the instruction below.
-
-### Prepare a guest image
-
-As of today (April 2024), ChromiumOS is the only officially supported guest
-payload. We will be adding more OSes in the future.
-
-#### Download ChromiumOS from build server
-
-Download
-https://storage.googleapis.com/chromiumos-image-archive/ferrochrome-public/R128-15926.0.0/chromiumos_test_image.tar.xz.
-The above will download ferrochrome test image with version `R128-15926.0.0`.
-
-To download latest version, use following code.
-
-```sh
-URL=https://storage.googleapis.com/chromiumos-image-archive/ferrochrome-public
-LATEST_VERSION=$(curl -s ${URL}/LATEST-main)
-curl -O ${URL}/${LATEST_VERSION}/chromiumos_test_image.tar.xz
-```
-
-To navigate build server artifacts,
-[install gsutil](https://cloud.google.com/storage/docs/gsutil_install).
-`gs://chromiumos-image-archive/ferrochrome-public` is the top level directory for ferrochrome build.
-
-#### Build ChromiumOS for VM
-
-First, check out source code from the ChromiumOS and Chromium projects.
-
-* Checking out Chromium: https://www.chromium.org/developers/how-tos/get-the-code/
-* Checking out ChromiumOS: https://www.chromium.org/chromium-os/developer-library/guides/development/developer-guide/
-
-Important: When you are at the step “Set up gclient args” in the Chromium checkout instruction, configure .gclient as follows.
-
-```
-$ cat ~/chromium/.gclient
-solutions = [
-  {
-    "name": "src",
-    "url": "https://chromium.googlesource.com/chromium/src.git",
-    "managed": False,
-    "custom_deps": {},
-    "custom_vars": {},
-  },
-]
-target_os = ['chromeos']
-```
-
-In this doc, it is assumed that ChromiumOS is checked out at `~/chromiumos` and
-Chromium is at `~/chromium`. If you downloaded to different places, you can
-create symlinks.
-
-Then enter into the cros sdk.
-
-```
-$ cd ~/chromiumos
-$ cros_sdk --chrome-root=$(readlink -f ~/chromium)
-```
-
-Now you are in the cros sdk. `(cr)` below means that the commands should be
-executed inside the sdk.
-
-First, choose the target board. `ferrochrome` is the name of the virtual board
-for AVF-compatible VM.
-
-```
-(cr) setup_board --board=ferrochrome
-```
-
-Then, tell the cros sdk that you want to build chrome (the browser) from the
-local checkout and also with your local modifications instead of prebuilts.
-
-```
-(cr) CHROME_ORIGIN=LOCAL_SOURCE
-(cr) ACCEPT_LICENSES='*'
-(cr) cros workon -b ferrochrome start \
-chromeos-base/chromeos-chrome \
-chromeos-base/chrome-icu
-```
-
-Optionally, if you have touched the kernel source code (which is under
-~/chromiumos/src/third_party/kernel/v5.15), you have to tell the cros sdk that
-you want it also to be built from the modified source code, not from the
-official HEAD.
-
-```
-(cr) cros workon -b ferrochrome start chromeos-kernel-5_15
-```
-
-Finally, build individual packages, and build the disk image out of the packages.
-
-```
-(cr) cros build-packages --board=ferrochrome --chromium --accept-licenses='*'
-(cr) cros build-image --board=ferrochrome --no-enable-rootfs-verification test
-```
-
-This takes some time. When the build is done, exit from the sdk.
-
-Note: If build-packages doesn’t seem to include your local changes, try
-invoking emerge directly:
-
-```
-(cr) emerge-ferrochrome -av chromeos-base/chromeos-chrome
-```
-
-Don’t forget to call `build-image` afterwards.
-
-You need ChromiumOS disk image: ~/chromiumos/src/build/images/ferrochrome/latest/chromiumos_test_image.bin
-
-### Create a guest VM configuration
-
-Push the kernel and the main image to the Android device.
-
-```
-$ adb push  ~/chromiumos/src/build/images/ferrochrome/latest/chromiumos_test_image.bin /data/local/tmp/
-```
-
-Create a VM config file as below.
-
-```
-$ cat > vm_config.json; adb push vm_config.json /data/local/tmp
-{
-    "name": "cros",
-    "disks": [
-        {
-            "image": "/data/local/tmp/chromiumos_test_image.bin",
-            "partitions": [],
-            "writable": true
-        }
-    ],
-    "protected": false,
-    "cpu_topology": "match_host",
-    "platform_version": "~1.0",
-    "memory_mib": 8096,
-    "debuggable": true,
-    "console_out": true,
-    "connect_console": true,
-    "console_input_device": "hvc0",
-    "network": true,
-    "input": {
-        "touchscreen": true,
-        "keyboard": true,
-        "mouse": true,
-        "trackpad": true,
-        "switches": true
-    },
-    "audio": {
-        "speaker": true,
-        "microphone": true
-    },
-    "gpu": {
-        "backend": "virglrenderer",
-        "context_types": ["virgl2"]
-    },
-    "display": {
-        "scale": "0.77",
-        "refresh_rate": "30"
-    }
-}
-```
-
-### Running the VM
-
-1. Grant permission to the `VmLauncherApp` if the virt apex is Google-signed.
-    ```shell
-    $ adb shell su root pm grant com.google.android.virtualization.vmlauncher android.permission.USE_CUSTOM_VIRTUAL_MACHINE
-    ```
-
-2. Ensure your device is connected to the Internet.
-
-3. Launch the app with adb.
-    ```shell
-    $ adb shell su root am start-activity -a android.virtualization.VM_LAUNCHER
-    ```
-
-If it doesn’t work well, try
-
-```
-$ adb shell pm clear com.android.virtualization.vmlauncher
-# or
-$ adb shell pm clear com.google.android.virtualization.vmlauncher
-```
-
-### Debugging
-
-To open the serial console (interactive terminal):
-```shell
-$ adb shell -t /apex/com.android.virt/bin/vm console
-```
-
-To see console logs only, check
-`/data/user/${current_user_id}/com{,.google}.android.virtualization.vmlauncher/files/${vm_name}.log`
-
-You can monitor console out as follows
-
-```shell
-$ adb shell 'su root tail +0 -F /data/user/$(am get-current-user)/com{,.google}.android.virtualization.vmlauncher/files/${vm_name}.log'
-```
-
-For ChromiumOS, you can enter to the console via SSH connection. Check your IP
-address of ChromiumOS VM from the ethernet network setting page and follow
-commands below.
-
-```shell
-$ adb kill-server ; adb start-server
-$ adb shell nc -s localhost -L -p 9222 nc ${CHROMIUMOS_IPV4_ADDR} 22 # This command won't be terminated.
-$ adb forward tcp:9222 tcp:9222
-$ ssh -oProxyCommand=none -o UserKnownHostsFile=/dev/null root@localhost -p 9222
-```
-
-For ChromiumOS, you would need to login after enthering its console.
-The user ID and the password is `root` and `test0000` respectively.
diff --git a/tests/ferrochrome/Android.bp b/tests/ferrochrome/Android.bp
deleted file mode 100644
index f1b7f27..0000000
--- a/tests/ferrochrome/Android.bp
+++ /dev/null
@@ -1,28 +0,0 @@
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-sh_test_host {
-    name: "ferrochrome-tests",
-    src: ":ferrochrome-tests.sh",
-    test_suites: ["general-tests"],
-    test_options: {
-        unit_test: false,
-    },
-    per_testcase_directory: true,
-    data: ["assets/vm_config.json"],
-    data_bins: ["ferrochrome-precondition-checker.sh"],
-}
-
-// Workaround for enabling verbose logging only on CI
-genrule {
-    name: "ferrochrome-tests.sh",
-    srcs: ["ferrochrome.sh"],
-    out: ["ferrochrome-tests"],
-    cmd: "sed '2 i set -x' $(in) > $(out)",
-}
-
-sh_binary_host {
-    name: "ferrochrome-precondition-checker.sh",
-    src: "ferrochrome-precondition-checker.sh",
-}
diff --git a/tests/ferrochrome/AndroidTest.xml b/tests/ferrochrome/AndroidTest.xml
deleted file mode 100644
index 6c975be..0000000
--- a/tests/ferrochrome/AndroidTest.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2024 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<configuration description="Host driven tests for ferrochrome">
-    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-
-    <!-- 'adb root' to enable vmlauncher -->
-    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
-        <option name="force-root" value="true"/>
-    </target_preparer>
-
-    <!-- Check assumptions here, because we can't skip tests in shell test -->
-    <target_preparer class="com.android.tradefed.targetprep.RunHostScriptTargetPreparer">
-        <option name="script-file" value="ferrochrome-precondition-checker.sh" />
-    </target_preparer>
-
-    <!-- Explicitly clean up ferrochrome image when done.
-         It's too large (6.5G+), so this may break further tests. -->
-    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
-        <option name="throw-if-cmd-fail" value="false" />
-        <option name="run-command" value="mkdir /data/local/tmp" />
-        <option name="teardown-command" value="pkill vmlauncher" />
-        <option name="teardown-command" value="rm /data/local/tmp/chromiumos_base_image.bin" />
-        <option name="teardown-command" value="rm -rf /data/local/tmp/ferrochrome_screenshots" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.binary.ExecutableHostTest">
-        <option name="binary" value="ferrochrome-tests" />
-        <option name="relative-path-execution" value="true" />
-        <option name="runtime-hint" value="10m" />
-        <option name="per-binary-timeout" value="20m" />
-    </test>
-
-    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
-        <option name="directory-keys" value="/data/local/tmp/ferrochrome_screenshots" />
-        <option name="collect-on-run-ended-only" value="true" />
-    </metrics_collector>
-</configuration>
-
diff --git a/tests/ferrochrome/assets/vm_config.json b/tests/ferrochrome/assets/vm_config.json
deleted file mode 100644
index 53e3b72..0000000
--- a/tests/ferrochrome/assets/vm_config.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
-    "name": "cros",
-    "disks": [
-        {
-            "image": "/data/local/tmp/chromiumos_base_image.bin",
-            "partitions": [],
-            "writable": true
-        }
-    ],
-    "protected": false,
-    "cpu_topology": "match_host",
-    "platform_version": "~1.0",
-    "memory_mib": 8096,
-    "debuggable": true,
-    "console_out": true,
-    "connect_console": true,
-    "console_input_device": "hvc0",
-    "network": true,
-    "input": {
-        "touchscreen": true,
-        "keyboard": true,
-        "mouse": true,
-        "trackpad": true,
-        "switches": true
-    },
-    "audio": {
-        "speaker": true,
-        "microphone": true
-    },
-    "gpu": {
-        "backend": "virglrenderer",
-        "context_types": ["virgl2"]
-    },
-    "display": {
-        "scale": "0.77",
-        "refresh_rate": "30"
-    }
-}
diff --git a/tests/ferrochrome/ferrochrome-precondition-checker.sh b/tests/ferrochrome/ferrochrome-precondition-checker.sh
deleted file mode 100644
index d3f7f5a..0000000
--- a/tests/ferrochrome/ferrochrome-precondition-checker.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-
-# Copyright 2024 Google Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-## Precondition checks for running ferrochrome
-## Used by CI for skipping tests.
-
-REQUIRED_DISK_SPACE=7340032    # Requires 7G, while image is 6.5G
-
-# `adb root` always returns exit code 0
-if [[ "$(adb root)" == *"cannot"* ]]; then
-  >&2 echo "Failed to run adb root"
-  exit 1
-fi
-
-# `pm resolve-activity` always returns exit code 0
-resolved_activity=$(adb shell pm resolve-activity -a android.virtualization.VM_LAUNCHER)
-if [[ "${resolved_activity}" == "No activity found" ]]; then
-  >&2 echo "Failed to find vmlauncher"
-  exit 1
-fi
-
-free_space=$(adb shell df /data/local | tail -1 | awk '{print $4}')
-if [[ ${free_space} -lt ${REQUIRED_DISK_SPACE} ]]; then
-  >&2 echo "Insufficient space on DUT. Need ${REQUIRED_DISK_SPACE}, but was ${free_space}"
-  exit 1
-fi
-
-free_space=$(df /tmp | tail -1 | awk '{print $4}')
-if [[ ${free_space} -lt ${REQUIRED_DISK_SPACE} ]]; then
-  >&2 echo "Insufficient space on host. Need ${REQUIRED_DISK_SPACE}, but was ${free_space}"
-  exit 1
-fi
-
-cpu_abi=$(adb shell getprop ro.product.cpu.abi)
-if [[ "${cpu_abi}" != "arm64"* ]]; then
-  >&2 echo "Unsupported architecture. Requires arm64, but was ${cpu_abi}"
-  exit 1
-fi
-
-device=$(adb shell getprop ro.product.vendor.device)
-if [[ "${device}" == "vsock_"* ]]; then
-  >&2 echo "Unsupported device. Cuttlefish isn't supported"
-  exit 1
-fi
diff --git a/tests/ferrochrome/ferrochrome.sh b/tests/ferrochrome/ferrochrome.sh
deleted file mode 100755
index 03630dd..0000000
--- a/tests/ferrochrome/ferrochrome.sh
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/bin/bash
-
-# Copyright 2024 Google Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-## Booting tests for ferrochrome
-## Keep this file synced with docs/custom_vm.md
-
-set -e
-
-FECR_GS_URL="https://storage.googleapis.com/chromiumos-image-archive/ferrochrome-public"
-FECR_DEFAULT_VERSION="R128-15958.0.0"
-FECR_DEFAULT_SCREENSHOT_DIR="/data/local/tmp/ferrochrome_screenshots"  # Hardcoded at AndroidTest.xml
-FECR_TEST_IMAGE="chromiumos_test_image"
-FECR_BASE_IMAGE="chromiumos_base_image"
-FECR_DEVICE_DIR="/data/local/tmp"
-FECR_IMAGE_VM_CONFIG_JSON="chromiumos_base_image.bin"  # hardcoded at vm_config.json
-FECR_CONFIG_PATH="/data/local/tmp/vm_config.json"  # hardcoded at VmLauncherApp
-FECR_CONSOLE_LOG_PATH="files/cros.log" # log file name is ${vm_name}.log
-FECR_TEST_IMAGE_BOOT_COMPLETED_LOG="Have fun and send patches!"
-FECR_BASE_IMAGE_BOOT_COMPLETED_LOG="Chrome started, our work is done, exiting"
-FECR_BOOT_TIMEOUT="300" # 5 minutes (300 seconds)
-ACTION_NAME="android.virtualization.VM_LAUNCHER"
-
-# Match this with AndroidTest.xml and assets/vm_config.json
-FECR_DEFAULT_IMAGE="${FECR_BASE_IMAGE}"
-FECR_DEFAULT_BOOT_COMPLETED_LOG="${FECR_BASE_IMAGE_BOOT_COMPLETED_LOG}"
-
-fecr_clean_up() {
-  trap - INT
-
-  # Reset screen always on
-  adb shell svc power stayon false
-
-  if [[ -d ${fecr_dir} && -z ${fecr_keep} ]]; then
-    rm -rf ${fecr_dir}
-  fi
-}
-
-print_usage() {
-  echo "ferochrome: Launches ferrochrome image"
-  echo ""
-  echo "By default, this downloads ${FECR_DEFAULT_VERSION} with version ${FECR_DEFAULT_VERSION},"
-  echo "launches, and waits for boot completed."
-  echo "When done, removes downloaded image on host while keeping pushed image on device."
-  echo ""
-  echo "Usage: ferrochrome [options]"
-  echo ""
-  echo "Options"
-  echo "  --help or -h: This message"
-  echo "  --dir DIR: Use ferrochrome images at the dir instead of downloading"
-  echo "  --verbose: Verbose log message (set -x)"
-  echo "  --skip: Skipping downloading and/or pushing images"
-  echo "  --version \${version}: ferrochrome version to be downloaded"
-  echo "  --keep: Keep downloaded ferrochrome image"
-  echo "  --test: Download test image instead"
-  echo "  --forever: Keep ferrochrome running forever. Used for manual test"
-}
-
-fecr_version="${FECR_DEFAULT_VERSION}"
-fecr_dir=""
-fecr_keep=""
-fecr_skip=""
-fecr_script_path=$(dirname ${0})
-fecr_verbose=""
-fecr_image="${FECR_DEFAULT_IMAGE}"
-fecr_boot_completed_log="${FECR_DEFAULT_BOOT_COMPLETED_LOG}"
-fecr_screenshot_dir="${FECR_DEFAULT_SCREENSHOT_DIR}"
-fecr_forever=""
-
-# Parse parameters
-while (( "${#}" )); do
-  case "${1}" in
-    --verbose)
-      fecr_verbose="true"
-      ;;
-    --version)
-      shift
-      fecr_version="${1}"
-      ;;
-    --dir)
-      shift
-      fecr_dir="${1}"
-      fecr_keep="true"
-      ;;
-    --keep)
-      fecr_keep="true"
-      ;;
-    --skip)
-      fecr_skip="true"
-      ;;
-    --test)
-      fecr_image="${FECR_TEST_IMAGE}"
-      fecr_boot_completed_log="${FECR_TEST_IMAGE_BOOT_COMPLETED_LOG}"
-      ;;
-    --forever)
-      fecr_forever="true"
-      ;;
-    -h|--help)
-      print_usage
-      exit 0
-      ;;
-    *)
-      print_usage
-      exit 1
-      ;;
-  esac
-  shift
-done
-
-trap fecr_clean_up INT
-trap fecr_clean_up EXIT
-
-if [[ -n "${fecr_verbose}" ]]; then
-  set -x
-fi
-
-. "${fecr_script_path}/ferrochrome-precondition-checker.sh"
-
-resolved_activities=$(adb shell pm query-activities --components -a ${ACTION_NAME})
-
-if [[ "$(echo ${resolved_activities} | wc -l)" != "1" ]]; then
-  >&2 echo "Multiple VM launchers exists"
-  exit 1
-fi
-
-pkg_name=$(dirname ${resolved_activities})
-current_user=$(adb shell am get-current-user)
-
-echo "Reset app & granting permission"
-adb shell pm clear --user ${current_user} ${pkg_name} > /dev/null
-adb shell pm grant --user ${current_user} ${pkg_name} android.permission.RECORD_AUDIO
-adb shell pm grant --user ${current_user} ${pkg_name} android.permission.USE_CUSTOM_VIRTUAL_MACHINE > /dev/null
-
-if [[ -z "${fecr_skip}" ]]; then
-  if [[ -z "${fecr_dir}" ]]; then
-    # Download fecr image archive, and extract necessary files
-    # DISCLAIMER: Image is too large (1.5G+ for compressed, 6.5G+ for uncompressed), so can't submit.
-    fecr_dir=$(mktemp -d)
-
-    echo "Downloading & extracting ferrochrome image to ${fecr_dir}"
-    curl ${FECR_GS_URL}/${fecr_version}/${fecr_image}.tar.xz | tar xfJ - -C ${fecr_dir}
-  fi
-
-  echo "Pushing ferrochrome image to ${FECR_DEVICE_DIR}"
-  adb shell mkdir -p ${FECR_DEVICE_DIR} > /dev/null || true
-  adb push ${fecr_dir}/${fecr_image}.bin ${FECR_DEVICE_DIR}/${FECR_IMAGE_VM_CONFIG_JSON}
-  adb push ${fecr_script_path}/assets/vm_config.json ${FECR_CONFIG_PATH}
-fi
-
-echo "Ensure screen unlocked"
-adb shell svc power stayon true
-adb shell wm dismiss-keyguard
-
-echo "Starting ferrochrome"
-adb shell am start-activity -a ${ACTION_NAME} > /dev/null
-
-# HSUM aware log path
-log_path="/data/user/${current_user}/${pkg_name}/${FECR_CONSOLE_LOG_PATH}"
-fecr_start_time=${EPOCHSECONDS}
-
-echo "Check ${log_path} on device for console log"
-
-if [[ "${fecr_forever}" == "true" ]]; then
-  echo "Ctrl+C to stop running"
-  echo "To open interactive serial console, use following command:"
-  echo "adb shell -t /apex/com.android.virt/bin/vm console"
-else
-  adb shell mkdir -p "${fecr_screenshot_dir}"
-  while [[ $((EPOCHSECONDS - fecr_start_time)) -lt ${FECR_BOOT_TIMEOUT} ]]; do
-    adb shell screencap -p "${fecr_screenshot_dir}/screenshot-${EPOCHSECONDS}.png"
-    adb shell grep -soF \""${fecr_boot_completed_log}"\" "${log_path}" && exit 0 || true
-    sleep 10
-  done
-
-  >&2 echo "Ferrochrome failed to boot. Dumping console log"
-  >&2 adb shell cat ${log_path}
-
-  exit 1
-fi
-