mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-21 23:47:39 +00:00
Update test scripts
This commit is contained in:
parent
b26db8cee6
commit
6e22476acc
50
.github/workflows/build.yml
vendored
50
.github/workflows/build.yml
vendored
@ -81,7 +81,7 @@ jobs:
|
||||
run: ./gradlew --stop
|
||||
|
||||
avd-test:
|
||||
name: Test x86_64 on API ${{ matrix.version }}
|
||||
name: Test API ${{ matrix.version }} (x86_64)
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
strategy:
|
||||
@ -99,11 +99,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python 3
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
@ -116,14 +111,14 @@ jobs:
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- name: AVD test
|
||||
- name: Run AVD test
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
AVD_TEST_VERBOSE: 1
|
||||
run: scripts/avd_test.sh ${{ matrix.version }} ${{ matrix.type }}
|
||||
|
||||
avd-test-32:
|
||||
name: Test x86 on API ${{ matrix.version }}
|
||||
name: Test API ${{ matrix.version }} (x86)
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
strategy:
|
||||
@ -137,11 +132,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python 3
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
@ -154,7 +144,7 @@ jobs:
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --name-match=kvm
|
||||
|
||||
- name: AVD test
|
||||
- name: Run AVD test
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
FORCE_32_BIT: 1
|
||||
@ -162,12 +152,17 @@ jobs:
|
||||
run: scripts/avd_test.sh ${{ matrix.version }}
|
||||
|
||||
cf_test:
|
||||
name: Test Cuttlefish on main
|
||||
name: Test ${{ matrix.branch }} (${{ matrix.target }})
|
||||
runs-on: ubuntu-24.04
|
||||
needs: build
|
||||
env:
|
||||
CF_HOME: /home/runner/aosp_cf_x86_64_phone
|
||||
CF_HOME: /home/runner/aosp_cf_phone
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- branch: "aosp-main"
|
||||
target: "aosp_cf_x86_64_phone-trunk_staging-userdebug"
|
||||
|
||||
steps:
|
||||
- name: Check out
|
||||
@ -175,26 +170,19 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Cuttlefish environment
|
||||
run: |
|
||||
scripts/cuttlefish.sh setup
|
||||
scripts/cuttlefish.sh download
|
||||
|
||||
- name: Wait for build artifacts
|
||||
uses: lewagon/wait-on-check-action@v1.3.4
|
||||
timeout-minutes: 45
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
check-name: "Build Magisk artifacts"
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ github.sha }}
|
||||
path: out
|
||||
|
||||
- name: Setup Cuttlefish environment
|
||||
run: |
|
||||
scripts/cuttlefish.sh setup
|
||||
scripts/cuttlefish.sh download ${{ matrix.branch }} ${{ matrix.target }}
|
||||
|
||||
- name: Run Cuttlefish test
|
||||
timeout-minutes: 10
|
||||
run: su $USER -c 'scripts/cuttlefish.sh test'
|
||||
|
||||
- name: Upload logs on error
|
||||
@ -203,5 +191,5 @@ jobs:
|
||||
with:
|
||||
name: "cvd-logs"
|
||||
path: |
|
||||
/home/runner/aosp_cf_x86_64_phone/cuttlefish/instances/cvd-1/logs
|
||||
/home/runner/aosp_cf_x86_64_phone/cuttlefish/instances/cvd-1/cuttlefish_config.json
|
||||
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/logs
|
||||
/home/runner/aosp_cf_phone/cuttlefish/instances/cvd-1/cuttlefish_config.json
|
||||
|
@ -3,7 +3,7 @@
|
||||
set -xe
|
||||
. scripts/test_common.sh
|
||||
|
||||
emu_args_base='-no-window -no-audio -no-boot-anim -gpu swiftshader_indirect -read-only -no-snapshot'
|
||||
emu_args_base="-no-window -no-audio -no-boot-anim -gpu swiftshader_indirect -read-only -no-snapshot -cores $core_count"
|
||||
lsposed_url='https://github.com/LSPosed/LSPosed/releases/download/v1.9.2/LSPosed-v1.9.2-7024-zygisk-release.zip'
|
||||
emu_pid=
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
set -xe
|
||||
. scripts/test_common.sh
|
||||
|
||||
cvd_args='-daemon -enable_sandbox=false -memory_mb=8192 -report_anonymous_usage_stats=n'
|
||||
cvd_args="-daemon -enable_sandbox=false -memory_mb=8192 -report_anonymous_usage_stats=n -cpus=$core_count"
|
||||
magisk_args='-init_boot_image=magisk_patched.img'
|
||||
|
||||
cleanup() {
|
||||
@ -18,26 +18,10 @@ run_cvd_bin() {
|
||||
HOME=$CF_HOME $CF_HOME/bin/$exe "$@"
|
||||
}
|
||||
|
||||
install_bazel() {
|
||||
sudo apt-get install -y apt-transport-https curl gnupg
|
||||
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg
|
||||
sudo mv bazel-archive-keyring.gpg /usr/share/keyrings
|
||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
|
||||
sudo apt-get update && sudo apt-get install bazel zip unzip
|
||||
}
|
||||
|
||||
build_cf() {
|
||||
git clone https://github.com/google/android-cuttlefish
|
||||
cd android-cuttlefish
|
||||
# We only want to build the base package
|
||||
sed -i '$ d' tools/buildutils/build_packages.sh
|
||||
tools/buildutils/build_packages.sh
|
||||
sudo dpkg -i ./cuttlefish-base_*_*64.deb || sudo apt-get install -f
|
||||
cd ../
|
||||
rm -rf android-cuttlefish
|
||||
}
|
||||
|
||||
setup_env() {
|
||||
curl -LO https://github.com/topjohnwu/magisk-files/releases/download/files/cuttlefish-base_0.9.29_amd64.deb
|
||||
sudo dpkg -i ./cuttlefish-base_*_*64.deb || sudo apt-get install -f
|
||||
rm cuttlefish-base_*_*64.deb
|
||||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger
|
||||
@ -47,19 +31,30 @@ setup_env() {
|
||||
}
|
||||
|
||||
download_cf() {
|
||||
local build_id=$(curl -sL https://ci.android.com/builds/branches/aosp-main/status.json | \
|
||||
jq -r '.targets[] | select(.name == "aosp_cf_x86_64_phone-trunk_staging-userdebug") | .last_known_good_build')
|
||||
local sys_img_url="https://ci.android.com/builds/submitted/${build_id}/aosp_cf_x86_64_phone-trunk_staging-userdebug/latest/raw/aosp_cf_x86_64_phone-img-${build_id}.zip"
|
||||
local host_pkg_url="https://ci.android.com/builds/submitted/${build_id}/aosp_cf_x86_64_phone-trunk_staging-userdebug/latest/raw/cvd-host_package.tar.gz"
|
||||
local branch=$1
|
||||
local target=$2
|
||||
|
||||
print_title "* Download aosp-main ($build_id) system images"
|
||||
curl -L $sys_img_url -o aosp_cf_x86_64_phone-img.zip
|
||||
if [ -z $branch ]; then
|
||||
branch='aosp-main'
|
||||
fi
|
||||
if [ -z $target ]; then
|
||||
target='aosp_cf_x86_64_phone-trunk_staging-userdebug'
|
||||
fi
|
||||
local device=$(echo $target | cut -d '-' -f 1)
|
||||
|
||||
local build_id=$(curl -sL https://ci.android.com/builds/branches/${branch}/status.json | \
|
||||
jq -r ".targets[] | select(.name == \"$target\") | .last_known_good_build")
|
||||
local sys_img_url="https://ci.android.com/builds/submitted/${build_id}/${target}/latest/raw/${device}-img-${build_id}.zip"
|
||||
local host_pkg_url="https://ci.android.com/builds/submitted/${build_id}/${target}/latest/raw/cvd-host_package.tar.gz"
|
||||
|
||||
print_title "* Download $branch ($build_id) $target images"
|
||||
curl -L $sys_img_url -o aosp_cf_phone-img.zip
|
||||
curl -LO $host_pkg_url
|
||||
rm -rf $CF_HOME
|
||||
mkdir -p $CF_HOME
|
||||
tar xvf cvd-host_package.tar.gz -C $CF_HOME
|
||||
unzip aosp_cf_x86_64_phone-img.zip -d $CF_HOME
|
||||
rm -f cvd-host_package.tar.gz aosp_cf_x86_64_phone-img.zip
|
||||
unzip aosp_cf_phone-img.zip -d $CF_HOME
|
||||
rm -f cvd-host_package.tar.gz aosp_cf_phone-img.zip
|
||||
}
|
||||
|
||||
test_cf() {
|
||||
@ -106,12 +101,10 @@ fi
|
||||
|
||||
case "$1" in
|
||||
setup )
|
||||
install_bazel
|
||||
build_cf
|
||||
setup_env
|
||||
;;
|
||||
download )
|
||||
download_cf
|
||||
download_cf $2 $3
|
||||
;;
|
||||
test )
|
||||
trap cleanup EXIT
|
||||
|
@ -4,12 +4,17 @@ fi
|
||||
|
||||
export PATH="$PATH:$ANDROID_HOME/platform-tools"
|
||||
|
||||
sdk="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
||||
emu="$ANDROID_HOME/emulator/emulator"
|
||||
sdk="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
||||
avd="$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager"
|
||||
|
||||
boot_timeout=600
|
||||
|
||||
core_count=$(nproc)
|
||||
if [ $core_count -gt 8 ]; then
|
||||
core_count=8
|
||||
fi
|
||||
|
||||
print_title() {
|
||||
echo -e "\n\033[44;39m${1}\033[0m\n"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user