Extend test to check subsystem set by executable(gui_app:)

pull/3885/head
Jon Turney 8 years ago committed by Nirbheek Chauhan
parent 94f09a8454
commit 67c8f532c6
  1. 26
      test cases/windows/17 gui app/gui_app_tester.py
  2. 6
      test cases/windows/17 gui app/gui_prog.c
  3. 13
      test cases/windows/17 gui app/meson.build

@ -0,0 +1,26 @@
#!/usr/bin/env python3
import re
import subprocess
import sys
tool = sys.argv[1]
executable = sys.argv[2]
expected = int(sys.argv[3])
actual = -1
if 'objdump' in tool:
result = subprocess.check_output([tool, '-p', executable]).decode()
match = re.search(r'^Subsystem\s+(\d+)', result, re.MULTILINE)
elif 'dumpbin' in tool:
result = subprocess.check_output([tool, '/headers', executable]).decode()
match = re.search(r'^\s*(\d+) subsystem(?! version)', result, re.MULTILINE)
else:
print('unknown tool')
sys.exit(1)
if match:
actual = int(match.group(1))
print('subsystem expected: %d, actual: %d' % (expected, actual))
sys.exit(0 if (expected == actual) else 1)

@ -0,0 +1,6 @@
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow) {
return 0;
}

@ -7,3 +7,16 @@ project('gui_app_test', 'c')
console_lib = static_library('main', 'console_prog.c')
executable('console', 'dummy.c', link_with: console_lib, gui_app: false)
#
# also verify that the correct subsystem is set by executable(gui_app:)
#
gui_prog = executable('gui_prog', 'gui_prog.c', gui_app: true)
console_prog = executable('console_prog', 'console_prog.c', gui_app: false)
tester = find_program('gui_app_tester.py')
tool = find_program('objdump', 'dumpbin')
test('is_gui', tester, args: [tool.path(), gui_prog, '2'])
test('not_gui', tester, args: [tool.path(), console_prog, '3'])

Loading…
Cancel
Save