aboutsummaryrefslogtreecommitdiff
path: root/test cases/windows
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2017-05-13 23:39:05 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-08-15 06:17:58 -0700
commit67c8f532c65a2c3439e7965a7c8206c2e16545d5 (patch)
tree4f3d5a50e9fce286659e670ba690c04a594ed326 /test cases/windows
parent94f09a84542862d474a0be9429dc9498cb303e12 (diff)
downloadmeson-67c8f532c65a2c3439e7965a7c8206c2e16545d5.zip
meson-67c8f532c65a2c3439e7965a7c8206c2e16545d5.tar.gz
meson-67c8f532c65a2c3439e7965a7c8206c2e16545d5.tar.bz2
Extend test to check subsystem set by executable(gui_app:)
Diffstat (limited to 'test cases/windows')
-rw-r--r--test cases/windows/17 gui app/gui_app_tester.py26
-rw-r--r--test cases/windows/17 gui app/gui_prog.c6
-rw-r--r--test cases/windows/17 gui app/meson.build13
3 files changed, 45 insertions, 0 deletions
diff --git a/test cases/windows/17 gui app/gui_app_tester.py b/test cases/windows/17 gui app/gui_app_tester.py
new file mode 100644
index 0000000..9cba806
--- /dev/null
+++ b/test cases/windows/17 gui app/gui_app_tester.py
@@ -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)
diff --git a/test cases/windows/17 gui app/gui_prog.c b/test cases/windows/17 gui app/gui_prog.c
new file mode 100644
index 0000000..4bc688a
--- /dev/null
+++ b/test cases/windows/17 gui app/gui_prog.c
@@ -0,0 +1,6 @@
+#include <windows.h>
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine, int nCmdShow) {
+ return 0;
+}
diff --git a/test cases/windows/17 gui app/meson.build b/test cases/windows/17 gui app/meson.build
index d5e6f5b..2435218 100644
--- a/test cases/windows/17 gui app/meson.build
+++ b/test cases/windows/17 gui app/meson.build
@@ -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'])