Commit Graph

108 Commits

Author SHA1 Message Date
matt335672
43d6db45ed Add module test for scancode index conversions 2024-08-05 10:44:10 +01:00
matt335672
c91ef80ca9 Implement scancode indexing
The mapping from scancodes to the indexes used in xrdp_keymap
is not well designed and contains an implicit dependency on
keycode values.

This mapping is alse slightly different from the index used for
the 'keys' map in the xrdp_wm structure.

This commit introduces support for mapping scancodes directly
to 'scancode indexes' suitable for indexing into both structures.

Some renaming is also done; [MS-RDPBCGR] uses the terms scancode
and keyCode interchangeably. An effort is made to use key_code for a
raw value from a TS_KEYBOARD_EVENT, and scancode for a value which is
produced by the scancode module.
2024-08-05 10:44:10 +01:00
matt335672
4d91771cac Add basic keymap loading test 2024-05-24 16:34:30 +01:00
matt335672
1cb2ce06cd Update xrdp to use new keymap file format 2024-05-24 16:33:08 +01:00
matt335672
b0cfc1a12b Add initial scancode module 2024-05-24 16:33:08 +01:00
matt335672
4e77772ea2 Fix problems detected by -fsanitize=address 2024-05-07 12:51:30 +01:00
firewave
5eed76f32b fixed -Wunused-function compiler warnings 2024-04-23 18:38:20 +02:00
firewave
fb9c175b11 enabled and fixed -Wmissing-prototypes compiler warnings
Co-authored-by: matt335672 <30179339+matt335672@users.noreply.github.com>
2024-04-23 18:38:20 +02:00
matt335672
4f03b02302 Don't generate a corefile when generating SIGSEGV
One of the tests uses a child process which generates SIGSEGV.
On FreeBSD this generates a corefile by default which breaks
the 'make distcheck' process.
2024-03-14 11:14:49 +00:00
matt335672
bc9b35c38c Rename struct exit_status in os_calls
This conflicts with struct exit_status in <utmp.h>
2024-02-21 09:24:48 +00:00
matt335672
db04b4b54c Increase back-stop timeouts for some tests
The Debian build farm has a number of older and slower machines
which need to run the xrdp test suite.

On these platforms, we occasionally get timeouts where machine load is
high. This results in duplicate issues being raised. It is not obvious
that the issues are duplicates, which wastes time all round.

This commit splits up some test cases into multiple cases and
adds larger timeouts for those cases that are CPU-intensive.
2024-01-04 15:16:23 +00:00
matt335672
62a51dead9 Fix g_strtrim() regression
Commit 36ea4a3 failed to take UTF-8 characters into account on
platforms with signed char.
2024-01-02 11:07:28 +00:00
matt335672
0758fe03a6 Add UTF-16 LE I/O routines
These are intended to replace UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +01:00
matt335672
0463e552dc Add UTF-8 / UTF-32 conversion routines
These are intended to replace non-UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +01:00
matt335672
ad5916c5e4 Check waitpid is not interrupted by a signal
Checks that the waitpid() call isn't interrupted by a
signal when the handler for the signal is set to not
interrupt the call
2023-10-09 19:53:16 +01:00
matt335672
d098214531 Add tests for signal functions in os_calls.c 2023-10-09 14:10:38 +01:00
matt335672
d11617adbe Remove dependency on signal() function
Replaces uses of signal() with sigaction() which should be far
more portable.
2023-10-09 14:05:29 +01:00
matt335672
ce42e3e12d Replace g_strsignal() with g_sig2text()
This call provides a textual representation of a signal number, i.e.
SIGHUP is mapped to "SIGHUP"

Unit tests are also added.
2023-06-12 16:19:17 +01:00
CynCeyd
f4210a20ae Switched os_calls.h and test_common.h include order since HAVE_STDINT_H would get undefined by check.h. 2023-06-04 12:05:33 +02:00
matt335672
d5684e0633 Add module tests for new fifo module 2023-05-22 14:43:22 +01:00
Daniel Richard G
1c0c923ad1 Split g_file_open() into _ro() and _rw() variants
Rename g_file_open() to g_file_open_rw(), and add a new g_file_open_ro()
call that wraps the common g_file_open_ex(file, 1, 0, 0, 0) idiom. This
will make the file access mode more explicit in the code.

Change all calls to g_file_open() to the _ro() or _rw() variant as
appropriate, and replace g_file_open_ex(file, 1, 0, 0, 0) with the _ro()
call.

Lastly, add tests for the two new calls to test_os_calls.c (code
courteously provided by matt335672).
2023-05-15 17:38:31 -04:00
matt335672
ff24984cf3 os_calls: Add g_file_is_open() 2023-05-02 11:55:22 +01:00
matt335672
563cfaf009
Merge pull request #2643 from matt335672/close_unwanted_fds
Fix leaking file descriptors
2023-05-02 11:54:05 +01:00
Jat
2a58ba40c9
remove unnecessary include check.h 2023-04-28 10:25:21 +08:00
matt335672
cf9e07d341 Add basic tests for cloexec and get_open_fds functions 2023-04-24 14:20:14 +01:00
matt335672
c3d697de16 Add list_add_strdup() etc 2023-03-06 15:58:13 +00:00
matt335672
a317c3de5d Fix regression in list module 2023-03-06 15:47:49 +00:00
Nexarian
89e178e7c9 Add function to split string into list.
- With working unit tests.
2023-03-03 18:33:33 -05:00
Nexarian
ba0e75f8be Utility functions for xrdp regions and tests
- xrdp_region_get_bounds
- xrdp_region_not_empty
- Incorporate example usage of cmocka
- Cmocka doesn't work with C++
2023-02-13 23:46:39 -05:00
matt335672
994418cd90 Add simple list test cases 2023-02-13 10:37:46 +00:00
Nexarian
259be09334 Add free to egfx unit tests 2023-02-11 00:39:03 -05:00
matt335672
7a190bf709 Add tests for libipm file descriptor calls 2023-01-30 14:31:16 +00:00
matt335672
02a3821f4d Remove libipm_msg_in_start()
The semantics of this call allowed it to be called more than once when
parsing a message to restart a parse. This is not likely to be
useful in practice, and it also makes reading file descriptors
more complicated. Consequently this function has been removed and
replaced with with libipm_msg_in_get_msgno()
2023-01-30 14:31:16 +00:00
matt335672
2c6419475c Add basic tests for os_calls routines 2023-01-30 14:31:16 +00:00
matt335672
57bd1be5b1 Disable stdout buffering for LOG() when running tests
Normally the test runners run in 'forking mode'. When a lot of
messages are logged to stdout, the child process can still be writing
data when the parent writes 'ok' or 'not ok'. This can confuse
the tap-driver.sh process.
2023-01-30 14:31:16 +00:00
Nexarian
db5ea2f214 Initial EGFX tests.
- Rearranging imports.
- Remove unnecessary check to g_is_wait_obj_set.
- Use g_get_term everywhere.
- Misc updates.
2023-01-23 23:05:24 -05:00
matt335672
c3bb7dc294 guid_new() returns GUIDs compatible with RFC4122 2022-11-10 14:19:19 +00:00
Koichiro IWAO
32da5a7ed6 Replace guid_to_str() with ms_guid_to_str() 2022-11-02 00:20:31 +09:00
Koichiro IWAO
791f055e18 common: add function to convert from Microsoft's GUID to string 2022-11-01 19:24:02 +09:00
a1346054
048e3c9e99
add missing final newline 2022-09-03 02:01:49 +00:00
a1346054
7fe18cc1c0
fix typos 2022-09-03 02:01:48 +00:00
Christopher Pitstick
07dbd0e032 Update handling of scale factor
Looking at 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT (https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpedisp/ea2de591-9203-42cd-9908-be7a55237d1c),
the way we were handling it was slightly off. device_scale_factor and
desktop_scale_factor are interdependent. If either one is out of spec,
both are set to default. That wasn't how it was previously being handled.
2022-07-02 18:28:59 -04:00
matt335672
a16695efd4 Added unit tests for bitmask<->charstr calls 2022-05-18 12:35:07 +01:00
matt335672
7868622a79
Merge pull request #2216 from matt335672/fix_stream_overflow_in_sextuple_monitor_happy_path_test
Fixes a stream overflow in the test suite
2022-04-20 12:43:37 +01:00
matt335672
7cfd3bb3d8 Fix off-by-one errors in monitor resize logic 2022-04-08 12:11:14 +01:00
matt335672
94a6f6282f Fixes a stream overflow in the test suite
This is triggered when xrdp is built with --enable-devel-logging

Also, the logging sub-system is initialised for libxrdp tests
2022-04-06 11:59:23 +01:00
Christopher Pitstick
bd9147d18f Updating to refactor xrdp_client_info
- Eliminate duplicaiton for display_size_description
- monitorCount needs to be uint32_t
- width/height -> session_width/session_height
- Update CLIENT_INFO_CURRENT_VERSION
- Also some misc unit test updates.
- Minor log updates.
2022-03-27 16:38:32 -04:00
Christopher Pitstick
4a0db63be7 Unify monitor processing logic.
There are two places where monitor descriptions are passed through the
RDP protocol:

- TS_UD_CS_MONITOR ([MS-RDPBCGR] 2.2.1.3.6 Client Monitor Data)
- DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT ([MS-RDPEDISP] 2.2.2.2)

The processing logic for both of them is similar enough that they should be unified.

Also update to define the constants for the maximum and minimum desktop width/height for monitors and total area.

Also a large number of clarifications for the constants and protocol
requirements.

Note that this is also the first step to making resizing work with the extension GFX channel as well as an important
foundational step to enable HiDPI compatibility.

Also some misc logging updates.
2022-03-26 23:45:16 -04:00
matt335672
3d91ba6a22 libipm: Make sockets always non-blocking 2022-03-15 10:45:00 +00:00
matt335672
6cf053c9df Add libipm test suite 2022-03-15 10:23:27 +00:00