summaryrefslogtreecommitdiffstats
path: root/test cases/windows/16 gui app
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/windows/16 gui app
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/windows/16 gui app')
-rw-r--r--test cases/windows/16 gui app/console_prog.c3
-rw-r--r--test cases/windows/16 gui app/dummy.c0
-rw-r--r--test cases/windows/16 gui app/gui_app_tester.py19
-rw-r--r--test cases/windows/16 gui app/gui_prog.c11
-rw-r--r--test cases/windows/16 gui app/meson.build26
5 files changed, 59 insertions, 0 deletions
diff --git a/test cases/windows/16 gui app/console_prog.c b/test cases/windows/16 gui app/console_prog.c
new file mode 100644
index 0000000..9b6bdc2
--- /dev/null
+++ b/test cases/windows/16 gui app/console_prog.c
@@ -0,0 +1,3 @@
+int main(void) {
+ return 0;
+}
diff --git a/test cases/windows/16 gui app/dummy.c b/test cases/windows/16 gui app/dummy.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/windows/16 gui app/dummy.c
diff --git a/test cases/windows/16 gui app/gui_app_tester.py b/test cases/windows/16 gui app/gui_app_tester.py
new file mode 100644
index 0000000..53e7649
--- /dev/null
+++ b/test cases/windows/16 gui app/gui_app_tester.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+try:
+ import pefile
+except ImportError:
+ if 'CI' in os.environ:
+ raise
+ # Skip the test if not on CI
+ sys.exit(77)
+
+executable = sys.argv[1]
+expected = int(sys.argv[2])
+
+actual = pefile.PE(executable).dump_dict()['OPTIONAL_HEADER']['Subsystem']['Value']
+
+print('subsystem expected: %d, actual: %d' % (expected, actual))
+sys.exit(0 if (expected == actual) else 1)
diff --git a/test cases/windows/16 gui app/gui_prog.c b/test cases/windows/16 gui app/gui_prog.c
new file mode 100644
index 0000000..9cdf170
--- /dev/null
+++ b/test cases/windows/16 gui app/gui_prog.c
@@ -0,0 +1,11 @@
+#include <windows.h>
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine, int nCmdShow) {
+ // avoid unused argument error while matching template
+ ((void)hInstance);
+ ((void)hPrevInstance);
+ ((void)lpCmdLine);
+ ((void)nCmdShow);
+ return 0;
+}
diff --git a/test cases/windows/16 gui app/meson.build b/test cases/windows/16 gui app/meson.build
new file mode 100644
index 0000000..3021c43
--- /dev/null
+++ b/test cases/windows/16 gui app/meson.build
@@ -0,0 +1,26 @@
+project('gui_app_test', 'c')
+
+#
+# test that linking a Windows console applications with the main function in a
+# library is correctly instructed which entrypoint function to look for
+#
+
+console_lib = static_library('main', 'console_prog.c')
+executable('console', 'dummy.c', link_with: console_lib, win_subsystem: 'console')
+executable('console2', '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', win_subsystem: 'windows,6.0')
+gui_prog2 = executable('gui_prog2', 'gui_prog.c', gui_app: true)
+console_prog = executable('console_prog', 'console_prog.c', win_subsystem: 'console')
+console_prog2 = executable('console_prog2', 'console_prog.c', gui_app: false)
+
+tester = find_program('gui_app_tester.py')
+
+test('is_gui', tester, args: [gui_prog, '2'])
+test('is_gui2', tester, args: [gui_prog2, '2'])
+test('not_gui', tester, args: [console_prog, '3'])
+test('not_gui2', tester, args: [console_prog2, '3'])