Skip to content

Commit 287552b

Browse files
committed
Exception test fix, exit code tests for Windows
1 parent 7b5e46f commit 287552b

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

test.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,18 @@ def thread_task():
389389

390390
fpath = testbin_to_fpath()
391391

392-
for (arg, expected) in [('-11',245), ('-1',255), ('-3',253), ('0',0), ('3',3), ('7',7), ('123',123)]:
392+
# some systems return byte, or low byte of 32-bit code and otheres return 32-bit code
393+
testvals = [('-11',[245,4294967285]), ('-1',[4294967295,255]), ('-3',[4294967293,253]), ('0',[0]), ('3',[3]), ('7',[7]), ('123',[123])]
394+
for (arg, expected) in testvals:
393395
adapter = DebugAdapter.get_adapter_for_current_system()
396+
adapter.setup()
397+
394398
utils.green('testing %s %s' % (tb, arg))
395399
adapter.exec(fpath, [arg])
396400
(reason, extra) = go_initial(adapter)
397401
assert_equality(reason, DebugAdapter.STOP_REASON.PROCESS_EXITED)
398-
assert_equality(extra, expected)
402+
if not extra in expected:
403+
raise Exception('expected return code %d to be in %s' % (extra, expected))
399404

400405
# exception test
401406
for tb in testbins:

testbins/Makefile-win32

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# nmake -f Makefile-win32 from within "x86 Native Tools Command Prompt"
22

3-
TARGETS_ALL = helloworld_x86-windows.exe helloworld_loop_x86-windows.exe helloworld_thread_x86-windows.exe helloworld_func_x86-windows.exe helloworld_pie_x86-windows.exe helloworld_loop_pie_x86-windows.exe helloworld_thread_pie_x86-windows.exe helloworld_func_pie_x86-windows.exe asmtest_x86-windows.exe do_exception_pie_x86-windows.exe
3+
TARGETS_ALL = helloworld_x86-windows.exe exitcode_x86-windows.exe helloworld_loop_x86-windows.exe helloworld_thread_x86-windows.exe helloworld_func_x86-windows.exe helloworld_pie_x86-windows.exe helloworld_loop_pie_x86-windows.exe helloworld_thread_pie_x86-windows.exe helloworld_func_pie_x86-windows.exe asmtest_x86-windows.exe do_exception_pie_x86-windows.exe
44

55
all: $(TARGETS_ALL)
66

@@ -10,6 +10,9 @@ clean:
1010
helloworld_x86-windows.exe: helloworld.c
1111
cl helloworld.c /Fe:helloworld_x86-windows.exe /link /DYNAMICBASE:NO
1212

13+
exitcode_x86-windows.exe: exitcode.c
14+
cl exitcode.c /Fe:exitcode_x86-windows.exe /link /DYNAMICBASE:NO
15+
1316
helloworld_thread_x86-windows.exe: helloworld_thread.c
1417
cl helloworld_thread.c /Fe:helloworld_thread_x86-windows.exe /link /DYNAMICBASE:NO
1518

testbins/Makefile-win64

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# nmake -f Makefile-win64 from within "x64 Native Tools Command Prompt"
22

3-
TARGETS_ALL = helloworld_x64-windows.exe helloworld_loop_x64-windows.exe helloworld_thread_x64-windows.exe helloworld_func_x64-windows.exe helloworld_pie_x64-windows.exe helloworld_loop_pie_x64-windows.exe helloworld_thread_pie_x64-windows.exe helloworld_func_pie_x64-windows.exe asmtest_x64-windows.exe do_exception_pie_x64-windows.exe
3+
TARGETS_ALL = helloworld_x64-windows.exe exitcode_x64-windows.exe helloworld_loop_x64-windows.exe helloworld_thread_x64-windows.exe helloworld_func_x64-windows.exe helloworld_pie_x64-windows.exe helloworld_loop_pie_x64-windows.exe helloworld_thread_pie_x64-windows.exe helloworld_func_pie_x64-windows.exe asmtest_x64-windows.exe do_exception_pie_x64-windows.exe
44

55
all: $(TARGETS_ALL)
66

@@ -10,6 +10,9 @@ clean:
1010
helloworld_x64-windows.exe: helloworld.c
1111
cl helloworld.c /Fe:helloworld_x64-windows.exe /link /DYNAMICBASE:NO
1212

13+
exitcode_x64-windows.exe: exitcode.c
14+
cl exitcode.c /Fe:exitcode_x64-windows.exe /link /DYNAMICBASE:NO
15+
1316
helloworld_thread_x64-windows.exe: helloworld_thread.c
1417
cl helloworld_thread.c /Fe:helloworld_thread_x64-windows.exe /link /DYNAMICBASE:NO
1518

@@ -32,7 +35,7 @@ helloworld_func_pie_x64-windows.exe: helloworld_func.c
3235
cl helloworld_func.c /Fe:helloworld_func_pie_x64-windows.exe /link
3336

3437
do_exception_pie_x64-windows.exe: do_exception.c
35-
cl do_exception.c /Fe:do_exception_pie_x64-windows.exe /link
38+
cl do_exception.c -DARCH_IS_X64 /Fe:do_exception_pie_x64-windows.exe /link
3639

3740
asmtest_x64-windows.exe: asmtest_x64-windows.obj
3841
link asmtest_x64-windows.obj /ENTRY:WinMain /SUBSYSTEM:CONSOLE /LARGEADDRESSAWARE:NO /DYNAMICBASE:NO /OUT:asmtest_x64-windows.exe kernel32.lib

0 commit comments

Comments
 (0)