Skip to content

Commit 1929b26

Browse files
committed
Bump GitHub Actions to latest versions
1 parent 4658ab1 commit 1929b26

5 files changed

Lines changed: 60 additions & 14 deletions

File tree

.github/workflows/code-style.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ jobs:
44
black:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
7+
- uses: actions/checkout@v7
88
- uses: psf/black@stable
99
isort:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-python@v4
14-
with:
15-
python-version: 3.8
16-
- uses: jamescurtin/isort-action@master
12+
- uses: actions/checkout@v7
13+
- uses: actions/setup-python@v6
14+
- run: pip install isort
15+
- run: isort --check-only --diff .

.github/workflows/linting.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ jobs:
44
pyflakes:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/checkout@v3
7+
- uses: actions/checkout@v7
88
- run: pip install pyflakes
99
- run: pyflakes $(git ls-files '*.py' | grep -v '^frida/frida_bindgen/assets/')
1010
mypy:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v7
1414
- uses: jpetrucciani/mypy-check@master
1515
with:
1616
mypy_flags: '--exclude examples --exclude setup --exclude frida/frida_bindgen/assets'

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on: [push, pull_request]
33
jobs:
44
test:
55
runs-on: ubuntu-latest
6+
timeout-minutes: 20
67
steps:
78
- uses: actions/checkout@v7
89
with:
@@ -15,4 +16,4 @@ jobs:
1516
- name: Build the extension
1617
run: make
1718
- name: Run the test suite
18-
run: python3 -m unittest tests.test_bindgen -v
19+
run: python3 tests/run_isolated.py

tests/run_isolated.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import subprocess
2+
import sys
3+
import unittest
4+
5+
6+
def test_ids(suite):
7+
for item in suite:
8+
if isinstance(item, unittest.TestSuite):
9+
yield from test_ids(item)
10+
else:
11+
yield item.id()
12+
13+
14+
def main():
15+
suite = unittest.TestLoader().discover("tests", "test_bindgen.py")
16+
hung = []
17+
failed = []
18+
for test_id in test_ids(suite):
19+
try:
20+
proc = subprocess.run(
21+
[sys.executable, "-m", "unittest", test_id],
22+
capture_output=True,
23+
text=True,
24+
timeout=45,
25+
)
26+
except subprocess.TimeoutExpired:
27+
hung.append(test_id)
28+
print(f"HANG {test_id}", flush=True)
29+
continue
30+
if proc.returncode == 0:
31+
print(f"pass {test_id}", flush=True)
32+
else:
33+
failed.append(test_id)
34+
print(f"FAIL {test_id}\n{proc.stderr[-3000:]}", flush=True)
35+
36+
print("\n===== SUMMARY =====", flush=True)
37+
print("HUNG:", hung, flush=True)
38+
print("FAILED:", failed, flush=True)
39+
sys.exit(1 if (hung or failed) else 0)
40+
41+
42+
if __name__ == "__main__":
43+
main()

tests/test_bindgen.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,15 @@ def test_device_get_process_by_name(self):
608608
with self.assertRaises(self.frida.ProcessNotFoundError):
609609
device.get_process("frida-nonexistent-process-zzz")
610610

611-
def test_attach_accepts_pid_and_name(self):
612-
import os
613-
611+
@unittest.skipIf(sys.platform == "win32", "requires a POSIX shell")
612+
def test_attach_accepts_pid(self):
614613
device = self.frida.get_local_device()
615-
session = device.attach(os.getpid())
616-
session.detach()
614+
pid = device.spawn(["/bin/sh", "-c", "sleep 30"])
615+
try:
616+
session = device.attach(pid)
617+
session.detach()
618+
finally:
619+
device.kill(pid)
617620

618621
def test_facade_repr(self):
619622
device = self.frida.get_local_device()

0 commit comments

Comments
 (0)