Skip to content

Commit 217da0d

Browse files
authored
Merge pull request #71 from hakril/more_ci_setup
Improve Test & CI
2 parents d63731f + 7c0c130 commit 217da0d

2 files changed

Lines changed: 37 additions & 20 deletions

File tree

.github/workflows/tests.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ jobs:
2020
run: py -c "import windows.generated_def"
2121
tests:
2222
# Not a real dependency : but starting tests when ctypes generation is broken is not useful
23-
needs: generate_ctypes
24-
runs-on: windows-2019
25-
timeout-minutes: 15
2623
strategy:
2724
fail-fast: false
2825
matrix:
26+
runs-on: [windows-2019, windows-latest]
2927
python-version: [2.7, 3.6, 3.11]
3028
python-architecture: [x86, x64]
3129
include:
@@ -35,6 +33,10 @@ jobs:
3533
- python-bitness-to-test: 64
3634
python-architecture: x64
3735

36+
needs: generate_ctypes
37+
timeout-minutes: 15
38+
runs-on: ${{ matrix.runs-on }}
39+
3840
steps:
3941
- uses: actions/checkout@v4
4042
# Pfw testing need both 32b & 64b of tested python version for cross-bitness python injection tests

tests/test_debugger.py

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import ctypes
44
import os
55
import time
6+
import traceback
67

78
import windows
89
import windows.debug
@@ -426,24 +427,34 @@ def on_exception(self, exc):
426427
@pytest.mark.parametrize("bptype", [windows.debug.FunctionParamDumpHXBP, windows.debug.FunctionParamDumpBP])
427428
def test_standard_breakpoint_remove(proc32_64_debug, bptype):
428429
data = set()
429-
430+
thread_exception = []
430431
def do_check():
431432
time.sleep(1)
432-
print("[==================] LOADING PYTHON")
433-
proc32_64_debug.execute_python_unsafe("1").wait()
434-
print("[==================] OPEN FILENAME1")
435-
proc32_64_debug.execute_python_unsafe("open(u'FILENAME1')").wait()
436-
time.sleep(0.1)
437-
print("[==================] OPEN FILENAME2")
438-
proc32_64_debug.execute_python_unsafe("open(u'FILENAME2')").wait()
439-
time.sleep(0.1)
440-
print("[==================] RM BP")
441-
d.del_bp(the_bp)
442-
print("[==================] OPEN FILENAME3")
443-
proc32_64_debug.execute_python_unsafe("open(u'FILENAME3')").wait()
444-
time.sleep(0.1)
445-
print("[==================] KILLING TARGET")
446-
proc32_64_debug.exit()
433+
try:
434+
print("[==================] LOADING PYTHON")
435+
assert list(d.breakpoints.values())[0]
436+
proc32_64_debug.execute_python_unsafe("1").wait()
437+
print("[==================] OPEN FILENAME1")
438+
assert list(d.breakpoints.values())[0]
439+
proc32_64_debug.execute_python_unsafe("open(u'FILENAME1')").wait()
440+
time.sleep(0.1)
441+
print("[==================] OPEN FILENAME2")
442+
assert list(d.breakpoints.values())[0]
443+
proc32_64_debug.execute_python_unsafe("open(u'FILENAME2')").wait()
444+
time.sleep(0.1)
445+
print("[==================] RM BP")
446+
assert list(d.breakpoints.values())[0]
447+
d.del_bp(the_bp)
448+
assert not list(d.breakpoints.values())[0]
449+
print("[==================] OPEN FILENAME3")
450+
proc32_64_debug.execute_python_unsafe("open(u'FILENAME3')").wait()
451+
time.sleep(0.1)
452+
print("[==================] KILLING TARGET")
453+
except Exception as e:
454+
traceback.print_exc()
455+
thread_exception.append(e)
456+
finally:
457+
proc32_64_debug.exit()
447458

448459
class TSTBP(bptype):
449460
TARGET = windows.winproxy.CreateFileW
@@ -460,8 +471,12 @@ def trigger(self, dbg, exc):
460471
# import pdb;pdb.set_trace()
461472
d.add_bp(the_bp)
462473
time.sleep(0.1)
463-
threading.Thread(target=do_check).start()
474+
t = threading.Thread(target=do_check)
475+
t.start()
464476
d.loop()
477+
assert not t.is_alive()
478+
if thread_exception:
479+
raise thread_exception[0]
465480
assert data >= set([u"FILENAME1", u"FILENAME2"])
466481
assert u"FILENAME3" not in data
467482

0 commit comments

Comments
 (0)