Files
nt-lite/code/user/tests/input_service_smoke/input_service_smoke.c
T
maksw 73abd6f90d isolate POSIX builds from the host UCRT, wire lwext4 and ntfs-3g as ext4.sys and ntfs.sys, split the FAT driver into directory/file/async/driver/mount units, add posixsrv and dwm plus input/console/desktop syscall clients and a pile of new smoke targets, rename serial.sys to cereal.sys, name HDA/USB/lwIP/AHCI workers, harden ATA probing/reset/removal around actual hardware deadlines, absent-channel detection, diagnostics and explicit worker lifetime, redo ACPI S5 shutdown around GAS/MMIO and HW-reduced firmware, scan SSDTs for _S5 and deal with Intel SMI sleep trapping, make serial and SMP timeouts use real monotonic deadlines, add thread names and fix terminal thread teardown, scheduler and APC prepare/commit races, make advisory file locks queryable and preserve split ranges and add mutable file append state, add shared-memory pipes with kernel-assisted wait/wake, introduce capability-scoped input and display managers, split surface map rights into read/write, add explicit unmap and replace present with commit/generation/damage tracking while keeping physical presentation under the display manager, decouple native exception classes from Win32 exception numbers and translate them in kernel32, add opaque process startup data, bump the resource protocol to v3 with namespace directories, symlinks and enumeration and service control to v2 with generic READY handle exports, add the new POSIX errno/status surface and rebuild fds around posixsrv-owned shared open descriptions, descriptor-local flags, exact inheritance snapshots, dup/fcntl/record locks and shared-ring pipes, add waitpid, POSIX credentials/groups/sessions/passwd/group lookups and move sockets onto stable open descriptions, port the shells and apps to the new console/input services and surface commit API, teach init to load services.ini and start/supervise RSSRV, DWM and generic services under restricted capabilities while publishing their endpoints through RSSRV, split RSSRV into namespace, volume, display, session, input, console and resource components and make /SystemRoot a real symlink to the independently published system volume, shift the syscall table again, expand lock/resource/surface/POSIX/service/thread smoke coverage, make docs scream ASK QUESTIONS and DISCUSS at LLMs, replace MIT No Attribution with WTFPL+.
2026-09-16 10:33:20 +02:00

84 lines
2.7 KiB
C

// Logical input-service smoke test. It verifies RSSRV publication and nonblocking protocol behavior without requiring user input.
#include <stdint.h>
#include <string.h>
#include <ntlite/input_service.h>
#include <ntlite/resource.h>
#include <ntlite/syscall.h>
static int gFailures;
// Writes one diagnostic line fragment.
static void print(const char* text) {
SYS_WRITE_CONSOLE_REQUEST request = { sizeof(request), SysSvFromCstr(text) };
(void)SysWriteConsole(&request);
}
// Records one failed expectation.
static void fail(const char* text) {
print("input_service_smoke: FAIL: ");
print(text);
print("\n");
gFailures++;
}
// Checks one status against an allowed nonblocking result pair.
static void expect_try_status(const char* what, KSTATUS status) {
if (status != NTLSTATUS_SUCCESS && status != NTLSTATUS_WOULD_BLOCK)
fail(what);
}
// Exercises RSSRV's logical-input listener and snapshot contract.
int main(void) {
print("input_service_smoke: start\n");
SYS_HANDLE resource = SYS_HANDLE_INVALID;
KSTATUS status = NtlResourceConnect(&resource);
if (!KSUCCESS(status)) {
fail("resource connect");
return 1;
}
uint32_t kind = NTL_RESOURCE_KIND_INVALID;
status = NtlResourceQuery(resource, SYS_SV_LITERAL(NTL_INPUT_SERVICE_PATH), &kind);
if (!KSUCCESS(status) || kind != NTL_RESOURCE_KIND_CAPABILITY)
fail("/Services/Input publication");
(void)NtlResourceClose(resource);
if (NtlInputConnect((SYS_HANDLE*)0) != NTLSTATUS_INVALID_PARAMETER)
fail("connect null");
SYS_HANDLE input = SYS_HANDLE_INVALID;
status = NtlInputConnect(&input);
if (!KSUCCESS(status) || input == SYS_HANDLE_INVALID) {
fail("input connect");
return 1;
}
NTL_INPUT_STATE state;
memset(&state, 0, sizeof(state));
status = NtlInputQueryState(input, &state);
if (!KSUCCESS(status) || state.Size != sizeof(state) || state.Flags != NTL_INPUT_STATE_FLAG_NONE)
fail("query state");
if (state.MouseX < 0 || state.MouseY < 0)
fail("pointer bounds");
INPUT_KEY_RECORD key;
status = NtlInputPeekEvent(input, 0, &key);
expect_try_status("peek key", status);
INPUT_MOUSE_EVENT mouse;
status = NtlInputPeekMouse(input, 0, &mouse);
expect_try_status("peek mouse", status);
NTL_INPUT_STATE defaultState;
memset(&defaultState, 0, sizeof(defaultState));
status = NtlInputQueryDefaultState(&defaultState);
if (!KSUCCESS(status) || defaultState.Size != sizeof(defaultState))
fail("default query state");
(void)NtlInputClose(input);
if (gFailures) return 1;
print("input_service_smoke: PASS\n");
return 0;
}