Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: linting
on: [push, pull_request]
jobs:
eslint:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 18
node-version: 22
cache: npm
- run: npm install
- run: npm run lint
- run: node --check index.js lib/*.js
- run: npx --no-install tsc --noEmit --lib es2022 index.d.ts
72 changes: 59 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
name: tests
on: [push, pull_request]
jobs:
tests:
android:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
api: [26, 27, 28, 29, 30, 31]
api: [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36]
arch: [x86_64]
exclude:
- api: 30
arch: x86
- api: 31
arch: x86
env:
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 200 # Default is 20
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 200
steps:
- name: Check out repo
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Cache test dependencies
uses: actions/cache@v6
with:
path: |
~/.npm
test/build/junit.jar
test/build/hamcrest.jar
test/build/obj/local/${{ matrix.arch }}/frida-gumjs.h
test/build/obj/local/${{ matrix.arch }}/libfrida-gumjs.a
key: android-deps-${{ matrix.arch }}-${{ hashFiles('test/Makefile', 'package-lock.json', 'test/package-lock.json') }}
restore-keys: |
android-deps-${{ matrix.arch }}-
- name: Enable KVM
run: |
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 --name-match=kvm
- name: AVD cache
uses: actions/cache@v4
uses: actions/cache@v6
id: avd-cache
with:
path: |
Expand All @@ -39,7 +48,9 @@ jobs:
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
script: >-
trap 'pkill -INT -f "[c]rashpad_handler" || true' EXIT;
echo "Generated AVD snapshot for caching."
- name: Run tests in emulator
uses: reactivecircus/android-emulator-runner@v2
with:
Expand All @@ -49,10 +60,45 @@ jobs:
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: >-
trap 'pkill -INT -f "[c]rashpad_handler" || true' EXIT;
sdkmanager "platforms;android-${{ matrix.api }}"
&& PATH="$ANDROID_SDK_ROOT/build-tools/34.0.0:$PATH"
&& BUILD_TOOLS_DIR="$(ls -d "$ANDROID_SDK_ROOT/build-tools/"* | sort -V | tail -n 1)"
&& PATH="$BUILD_TOOLS_DIR:$PATH"
ANDROID_ARCH=${{ matrix.arch }}
ANDROID_ABI=${{ matrix.arch }}
ANDROID_API_LEVEL=${{ matrix.api }}
ANDROID_LIBDIR=/system/${{ contains(matrix.arch, '64') && 'lib64' || 'lib' }}
make check
make check-android

jvm:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
java: ['8', '11', '17']
steps:
- name: Check out repo
uses: actions/checkout@v7
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- name: Cache test dependencies
uses: actions/cache@v6
with:
path: |
test/build/junit.jar
test/build/hamcrest.jar
test/build/jvm/frida-gumjs
key: jvm-deps-${{ hashFiles('test/Makefile') }}
restore-keys: |
jvm-deps-
- name: Run JVM tests
run: make check-jvm
48 changes: 32 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
all:
@echo "Nothing to build. To run the test-suite: make check"
@echo "Nothing to build. To run the test-suite: make check-android or make check-jvm"

check: node_modules
check-android: node_modules
$(MAKE) -C test deploy-android
@echo ""
@echo "[*] Running the test suite with optimizations disabled (interpreter mode)."
@echo "[*] Running the Android test suite with optimizations disabled (interpreter mode)."
@echo ""
@$(MAKE) check-run
@$(MAKE) -C test run-android
@echo ""
@echo "[*] Running the test suite with optimizations enabled."
@echo "[*] Running the Android test suite with optimizations enabled."
@echo ""
@$(MAKE) RUNNER_ARGS="--enable-optimizations" check-run
@$(MAKE) -C test RUNNER_ARGS="--enable-optimizations" run-android

check-run: node_modules
$(MAKE) -C test deploy
$(MAKE) -C test run
check-android-gdb: node_modules
$(MAKE) -C test deploy-android
$(MAKE) -C test debug-android

check-gdb: node_modules
$(MAKE) -C test deploy
$(MAKE) -C test debug
develop-android: node_modules
$(MAKE) -C test deploy-android
$(MAKE) -C test watch-android

develop: node_modules
$(MAKE) -C test deploy
$(MAKE) -C test watch
check-jvm: node_modules
$(MAKE) -C test build-jvm
@echo ""
@echo "[*] Running the JVM test suite with optimizations disabled (interpreter mode)."
@echo ""
@$(MAKE) -C test run-jvm
@echo ""
@echo "[*] Running the JVM test suite with optimizations enabled."
@echo ""
@$(MAKE) -C test RUNNER_ARGS="--enable-optimizations" run-jvm

check-jvm-gdb: node_modules
$(MAKE) -C test build-jvm
$(MAKE) -C test debug-jvm

develop-jvm: node_modules
$(MAKE) -C test build-jvm
$(MAKE) -C test watch-jvm

node_modules: package.json
npm install
Expand All @@ -30,4 +46,4 @@ clean:
rm -rf node_modules
$(MAKE) -C test clean

.PHONY: all check check-gdb develop clean
.PHONY: all check-android check-android-gdb develop-android check-jvm check-jvm-gdb develop-jvm clean
46 changes: 35 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,60 @@ through the global named `Java`.

## Running the test-suite

### Dependencies
### Android

- Android SDK Platform-Tools >= 27.0.1
- Android NDK r21
#### Dependencies

- Android SDK Platform-Tools >= 29.0.6
- Android NDK r21+

With environment configured accordingly:

```sh
$ export ANDROID_SDK_ROOT=~/Library/Android/Sdk
$ export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk-r21
$ export ANDROID_NDK_ROOT=/usr/local/opt/android-ndk-r25b
```

### Configuration
#### Configuration

- Go to `/test/config.mk` for editing the device configuration settings.

### Run
#### Run

```sh
$ make check-android
```

#### Debug

```sh
$ make check-android-gdb
```

#### Auto-run tests on JavaScript change

```sh
$ make develop-android
```

### HotSpot JVM

With `JAVA_HOME` pointing to a HotSpot JDK (JDK 8–17 on Linux x86_64):

#### Run

```sh
$ make check
$ make check-jvm
```

### Debug
#### Debug

```sh
$ make check-gdb
$ make check-jvm-gdb
```

### Auto-run tests on JavaScript change
#### Auto-run tests on JavaScript change

```sh
$ make develop
$ make develop-jvm
```
Loading