mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 22:10:44 +00:00
Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a585a79c6 | ||
|
|
b95b2c92a8 | ||
|
|
d38c5253c6 | ||
|
|
6fb171b247 | ||
|
|
482293fd35 | ||
|
|
993cd222a4 | ||
|
|
54b295434e | ||
|
|
8141b8e282 | ||
|
|
ba9a053b5c | ||
|
|
f34b70dd45 | ||
|
|
e71fca720a | ||
|
|
83391f57be | ||
|
|
8877bff9f2 | ||
|
|
68d4b449f2 | ||
|
|
daeeaeae34 | ||
|
|
3b3e9f1c05 | ||
|
|
cd72ef8ec3 | ||
|
|
01a7435d35 | ||
|
|
2cc44b8318 | ||
|
|
e75b4131a3 |
No files matched your search
@@ -31,7 +31,7 @@ jobs:
|
||||
test "$(sysctl -n sysctl.proc_translated)" = 0
|
||||
- name: Install Rust toolchain
|
||||
run: |
|
||||
rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --component rustfmt --component clippy
|
||||
rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --component rustfmt --component clippy --target x86_64-pc-windows-gnu
|
||||
rustc -vV
|
||||
- name: Check ARM64 Rust workspace (launcher + shader-transpiler)
|
||||
run: |
|
||||
|
||||
@@ -10,6 +10,10 @@ Guest execution uses original, purpose-built test programs. Commercial Xbox game
|
||||
remains unsupported.
|
||||
|
||||
### Added
|
||||
- `scripts/build-shims.sh` now builds and verifies `bx_shader_bridge.dll` with the shims (#484). It builds the Windows version of `shader-transpiler/crates/dxbc-accc` (#445), linked with the new frozen export list `abi/defs/bx_shader_bridge.def`, so its export directory name is `bx_shader_bridge.dll`. It places the DLL in `build-shims/bin` and checks it with the same exact-export, ordinal, forwarder and MinGW-import rules as the other shims. The script now reports 17 DLLs and 111 exports.
|
||||
- **Toolchain:** `cargo` and `rustc` come from rustup when available. The build always uses `<repo>/target`, and a missing `x86_64-pc-windows-gnu` target stops the script with `rustup target add x86_64-pc-windows-gnu` (it is never skipped). The CI job installs that target with its pinned toolchain.
|
||||
- **Effect:** `d3d12_xs`'s shader gate (#466) finds the bridge in `build-shims/bin` without a manual copy.
|
||||
- Implemented the `IGameInput` v0 device-callback lifecycle (`RegisterDeviceCallback`, `StopCallback`, `UnregisterCallback`) and `SetFocusPolicy` in `shims/gameinput/gameinput.cpp` (#481). `RegisterDeviceCallback` validates `callbackFunc`, `inputKind`, `statusFilter`, and `enumerationKind` (`0..=2`), allocates unique monotonic `GameInputCallbackToken` handles under `SRWLOCK`, and supports optional null `callbackToken` output pointers; `StopCallback` marks active registrations stopped while keeping them unregisterable once via `UnregisterCallback`; `SetFocusPolicy` records focus-policy flags without stub noise. Expanded `test_audio_input.exe` to cover validation, token uniqueness, stop/unregister idempotence, and focus-policy calls.
|
||||
- `dxbc-accc` now reaches Windows guests as `bx_shader_bridge.dll`, the x86-64 Windows build of the same crate (#445). It exports exactly the three `bx_shader_bridge.h` entry points and needs no MinGW runtime DLL. `shader-transpiler/crates/dxbc-accc/guest/build.sh` builds the DLL and checks its exports and imports. It also builds `check_bridge.exe`, a C guest program compiled against the frozen header, which sends a real DXC SM 6.6 blob and eight synthetic containers (DXIL with and without trailing bytes, `ACCC`/`FSPX` v1 and v0, dual, legacy `SHEX`, malformed) through the DLL loaded by full path. It checks classification (exact chunk sizes, root signature flag, header digest, declared size), prepare (only the declared container is copied), free, and prints a DXIL vs. `ACCC` count. The build script always uses `<repo>/target` and rustup's toolchain, and checks the whole Export Address Table and an import allowlist. On one Apple M5 Pro with CrossOver 26.3, in a prefix and a D3DMetal bottle, it reported `dxil=3 accc_only=2 dual=1 legacy=1 invalid=2` and passed. Synthetic containers only. Staging the DLL in `build-shims`, an `abi/defs` export list, and the `d3d12_xs` PSO hook (#466) are separate changes.
|
||||
- `xgameruntime.dll!QueryApiImpl` now serves offline `XGameSave` and `XPackage` as COM `IUnknown` objects under BetterXen synthetic keys (#468, not yet closed). A title linked against Microsoft's `xgameruntime.lib` does not request these keys. Every synthetic key and COM slot order now lives in `shims/xgameruntime/synthetic_keys.h`, the single place to find or replace them. Signatures, structure layouts, `E_GS_*` values and container-name rules follow the public Microsoft Learn reference.
|
||||
- **XGameSave:** provider init, containers, updates, blob writes, submit and read (both asynchronous), enumeration and the close calls. Saves are separated by SCID: each container is one file under `C:\bx_pls\<hash>\saves\<SCID hash>\`, replaced atomically on submit. A named mutex per SCID directory serializes access across threads and processes. Damaged files (truncated, trailing bytes, duplicate or NUL-bearing names) read as `ERROR_FILE_CORRUPT`, and enumeration skips them and unreadable files with a log line. Offline choices where the reference is silent (16 MiB including blob names, 256-byte blob names, no sync, retry after a failed submit) are listed in `game_save.cpp`.
|
||||
@@ -123,6 +127,8 @@ remains unsupported.
|
||||
- An instruction longer than 15 bytes now stops both engines with a general-protection fault instead of an illegal-instruction exit (#384; Intel SDM Vol. 3A, 7.15). The decoder still stops before fetching a 16th byte, and the DBT translates the faulting instruction on its own so the instructions before it in a block complete first. The `defect_overlong_instruction` known answer from #155 is now verified, with three more cases.
|
||||
- Made the native semantic-review timeout in `scripts/test-gpu.sh` configurable with `XENORA_SEMANTIC_TIMEOUT` and raised its default from 120 to 300 seconds, so cold Apple Silicon runs do not fail while the expanded Metal known-answer suite is still progressing.
|
||||
- Added a Python 3 fallback for `timeout` in `scripts/test-gpu.sh`, so the native Metal suite runs on stock macOS without GNU coreutils while preserving bounded execution and the usual timeout exit status.
|
||||
- `bx-cli run` signal handling (#461). The environment's `wineserver` is now stopped before anything is reported on the stop path, and those reports and the trace summary no longer use panicking print macros, so Ctrl-C through `| tee` or a closed terminal can no longer skip cleanup. A signal inherited as ignored (`nohup`, a background job of a non-interactive shell) stays ignored. SIGQUIT (Ctrl-\\) stops the guest group and the environment like SIGINT. SIGTSTP (Ctrl-Z) is passed to the guest group, which is continued when `bx-cli` is, and suspended time does not count against `--timeout`. The cleanup `wineserver -k`/`-w` run in their own process group so a second Ctrl-C cannot kill them. The trace summary covers only what this run appended to the log; a log replaced or rewritten during the run (recognized by file identity and by the bytes before the old end, not by size) is summarized in full. A pause during prefix initialization is not charged to the guest's share of `--timeout` either. `THIRD_PARTY_NOTICES.md` no longer claims zero crates.io dependencies and now includes the `libc` MIT text. The stop messages changed from "stopping the environment" to "stopped the environment" because they are printed afterwards. Covered by 10 new unit tests with stub launchers and servers; each fix was removed in turn and its test failed. A reviewer confirmed Ctrl-C through `| tee` on a real terminal under CrossOver 26.3. The author then ran seven scenarios under CrossOver Preview build 20261006 (Ctrl-C through `tee`, an inherited-ignored SIGHUP, Ctrl-\\, Ctrl-Z and continue, repeated Ctrl-C during cleanup, a pause during prefix setup, a log replaced mid-run) with signals sent to the process group rather than typed, using a build that differs only in where it looks for CrossOver; each showed the old behaviour before the change and the fixed behaviour after. Not confirmed with real key presses, and not on CrossOver 26.3 for anything but the first. The same pattern in the unmerged #425 is not touched.
|
||||
- `d3dmetal-harness` runner tests no longer give a freshly written script only 300–500 ms to start (#479); both use a 2 s deadline. The kill test now also checks that the probe ran until the deadline and that its process is gone, which catches a timeout path that neither kills nor waits for the probe. It passes the PID-file path as a script argument so temporary directory names containing apostrophes work. Test-only change. Slow script start-up as the cause of the earlier failures is inferred, not measured. `output_complete` is not asserted for the killed probe, because a child spawned by a parallel test may inherit its pipe.
|
||||
|
||||
### Added
|
||||
- Added opt-in `betterxen run --startup-report <path>` JSON diagnostics with the last observed startup stage, fixture verification outcome and preserved failure or termination detail (#255).
|
||||
|
||||
+32
-2
@@ -1,8 +1,8 @@
|
||||
# Third-party notices
|
||||
|
||||
The active BetterXen Rust workspace (`Cargo.toml` / `Cargo.lock`) currently has **zero external crates.io dependencies** and is original `GPL-3.0-or-later` source.
|
||||
The active BetterXen Rust workspace (`Cargo.toml` / `Cargo.lock`) is original `GPL-3.0-or-later` source with **one external crates.io dependency**: `libc`, used only by `bx-cli`.
|
||||
|
||||
`bx-cli` links the unmodified `libc` 0.2.191 crate (`ccc2ff4aaab962f7fde7b8edda7379c045b1ca12`) for POSIX process groups and signals, under its MIT option. Preserve the Rust Project Developers notice and permission text.
|
||||
`bx-cli` links the unmodified `libc` 0.2.191 crate (`ccc2ff4aaab962f7fde7b8edda7379c045b1ca12`) for POSIX process groups and signals, under its MIT option. The crate is licensed `MIT OR Apache-2.0`; its notice and permission text (`LICENSE-MIT` in the 0.2.191 crate) are reproduced under [libc MIT license text](#libc-mit-license-text) below.
|
||||
|
||||
## External Host Tools & Runtime Dependencies (Never Bundled)
|
||||
|
||||
@@ -13,3 +13,33 @@ The active BetterXen Rust workspace (`Cargo.toml` / `Cargo.lock`) currently has
|
||||
| `mingw-w64` & CMake | Developer cross-compilation toolchain for x86-64 PE32+ shims | Installed externally via Homebrew (`brew install mingw-w64 cmake`) for building `shims/` and `tests/conformance/`. |
|
||||
|
||||
Historical third-party notices for the retired native-first workspace (including AMD RDNA 2 ISA metadata, `bitflags`, and `objc2-*`) remain preserved at Git tag `native-first-final` and are summarized in [docs/licenses.md](docs/licenses.md).
|
||||
|
||||
## libc MIT license text
|
||||
|
||||
```text
|
||||
Copyright (c) The Rust Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
```
|
||||
+1
-1
@@ -7,4 +7,4 @@ This directory holds the **only shared interface boundary** across BetterXen's s
|
||||
1. **ABI-First Changes:** If one track needs a new cross-DLL helper, config flag, or export symbol, open a small, focused `[ABI]` pull request touching only `abi/`.
|
||||
2. **Zero File Collisions:** Never edit another track's implementation directory in an `[ABI]` PR. Once the `[ABI]` PR merges to `main`, both provider and consumer tracks implement in parallel.
|
||||
3. **Versioned Contracts:** Increment `BX_ABI_VERSION` in `abi/include/bx_config.h` on any breaking struct or signature change.
|
||||
4. **Canonical `.def` Exports:** Every DLL under `shims/` links directly against its corresponding `abi/defs/<name>.def`. CI verifies the built PE32+ export table matches these `.def` files.
|
||||
4. **Canonical `.def` Exports:** Every DLL under `shims/` links directly against its corresponding `abi/defs/<name>.def`. CI verifies the built PE32+ export table matches these `.def` files. One entry is not under `shims/`: `bx_shader_bridge.def` is the export list of `bx_shader_bridge.dll`, the x86-64 Windows build of `shader-transpiler/crates/dxbc-accc` (#445). `scripts/build-shims.sh` links it into that build and verifies it with the shims (#484).
|
||||
@@ -0,0 +1,5 @@
|
||||
LIBRARY bx_shader_bridge.dll
|
||||
EXPORTS
|
||||
bx_shader_inspect
|
||||
bx_shader_prepare_for_d3dmetal
|
||||
bx_shader_free_buffer
|
||||
@@ -7,6 +7,7 @@ use std::collections::BTreeMap;
|
||||
use std::env;
|
||||
use std::fmt::Write as _;
|
||||
use std::fs;
|
||||
use std::io::Write as _;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, ExitCode};
|
||||
use std::time::{Duration, Instant};
|
||||
@@ -499,7 +500,37 @@ fn apply_prefix_env(command: &mut Command, cx_root: &Path, prefix: &Path, winelo
|
||||
);
|
||||
}
|
||||
|
||||
/// Reports a timeout or signal and stops the environment's `wineserver`. True if cleanup failed.
|
||||
/// Writes one diagnostic line to stderr. A closed pipe or hung-up terminal is ignored: unlike
|
||||
/// `eprintln!`, this cannot panic and so cannot cut a run's cleanup short (#461).
|
||||
fn diag(message: impl std::fmt::Display) {
|
||||
let _ = writeln!(std::io::stderr(), "{message}");
|
||||
}
|
||||
|
||||
/// Runs `cleanup` and only then reports the stop and any cleanup failures to `out`, ignoring
|
||||
/// write errors. True if cleanup reported a failure.
|
||||
///
|
||||
/// Cleanup comes first so that nothing about the diagnostic stream (Ctrl-C through `| tee`, a
|
||||
/// closed terminal) can prevent the environment from being stopped (#461).
|
||||
fn report_stop(
|
||||
stop: Stop,
|
||||
cleanup: impl FnOnce() -> Vec<String>,
|
||||
out: &mut dyn std::io::Write,
|
||||
) -> bool {
|
||||
let failures = cleanup();
|
||||
let _ = match stop {
|
||||
Stop::TimedOut => writeln!(out, "timed out; stopped the environment"),
|
||||
Stop::Signalled(signal) => {
|
||||
writeln!(out, "received signal {signal}; stopped the environment")
|
||||
}
|
||||
};
|
||||
for failure in &failures {
|
||||
let _ = writeln!(out, "{failure}");
|
||||
}
|
||||
!failures.is_empty()
|
||||
}
|
||||
|
||||
/// Stops the environment's `wineserver` after a timeout or signal, then reports it. True if
|
||||
/// cleanup failed.
|
||||
fn stop_environment(
|
||||
stop: Stop,
|
||||
cx_root: &Path,
|
||||
@@ -507,34 +538,96 @@ fn stop_environment(
|
||||
bottle: Option<&str>,
|
||||
inherit_env: bool,
|
||||
) -> bool {
|
||||
match stop {
|
||||
Stop::TimedOut => eprintln!("timed out; stopping the environment"),
|
||||
Stop::Signalled(signal) => {
|
||||
eprintln!("received signal {signal}; stopping the environment");
|
||||
}
|
||||
}
|
||||
let server_env: Vec<(String, String)> = collect_isolated_host_env(|k| env::var(k).ok())
|
||||
.into_iter()
|
||||
.collect();
|
||||
let mut cleanup_failed = false;
|
||||
let prefixes_to_stop = match cleanup_prefixes_for_stop(environment_dir, bottle, |name| {
|
||||
resolve_bottle_prefix_with_host_env(cx_root, name, inherit_env)
|
||||
}) {
|
||||
Ok(prefixes) => prefixes,
|
||||
Err(e) => {
|
||||
eprintln!("cleanup failed to re-resolve bottle prefix: {e}");
|
||||
cleanup_failed = true;
|
||||
vec![environment_dir.to_path_buf()]
|
||||
let cleanup = || {
|
||||
let server_env: Vec<(String, String)> = collect_isolated_host_env(|k| env::var(k).ok())
|
||||
.into_iter()
|
||||
.collect();
|
||||
let mut failures = Vec::new();
|
||||
let prefixes_to_stop = match cleanup_prefixes_for_stop(environment_dir, bottle, |name| {
|
||||
resolve_bottle_prefix_with_host_env(cx_root, name, inherit_env)
|
||||
}) {
|
||||
Ok(prefixes) => prefixes,
|
||||
Err(e) => {
|
||||
failures.push(format!("cleanup failed to re-resolve bottle prefix: {e}"));
|
||||
vec![environment_dir.to_path_buf()]
|
||||
}
|
||||
};
|
||||
for prefix in &prefixes_to_stop {
|
||||
if let Err(e) =
|
||||
supervise::stop_server(&cx_root.join("bin/wineserver"), prefix, &server_env)
|
||||
{
|
||||
failures.push(format!(
|
||||
"cleanup failed, programs may still be running: {e}"
|
||||
));
|
||||
}
|
||||
}
|
||||
failures
|
||||
};
|
||||
for prefix in &prefixes_to_stop {
|
||||
if let Err(e) = supervise::stop_server(&cx_root.join("bin/wineserver"), prefix, &server_env)
|
||||
{
|
||||
eprintln!("cleanup failed, programs may still be running: {e}");
|
||||
cleanup_failed = true;
|
||||
}
|
||||
}
|
||||
cleanup_failed
|
||||
report_stop(stop, cleanup, &mut std::io::stderr())
|
||||
}
|
||||
|
||||
/// How many trailing bytes of a log are remembered to recognize it again after the run.
|
||||
const LOG_MARK_TAIL: u64 = 256;
|
||||
|
||||
/// What a trace log was before the run: which file, how long, and how it ended.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
struct LogMark {
|
||||
/// Device and inode of the file.
|
||||
identity: (u64, u64),
|
||||
len: u64,
|
||||
/// The last bytes before `len` (up to [`LOG_MARK_TAIL`]).
|
||||
tail: Vec<u8>,
|
||||
}
|
||||
|
||||
/// The mark of the log at `path`, or `None` if there is no readable log yet.
|
||||
fn log_mark(path: &Path) -> Option<LogMark> {
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
let mut file = fs::File::open(path).ok()?;
|
||||
let meta = file.metadata().ok()?;
|
||||
let len = meta.len();
|
||||
let tail_len = len.min(LOG_MARK_TAIL);
|
||||
file.seek(SeekFrom::Start(len - tail_len)).ok()?;
|
||||
let mut tail = Vec::new();
|
||||
file.take(tail_len).read_to_end(&mut tail).ok()?;
|
||||
Some(LogMark {
|
||||
identity: (meta.dev(), meta.ino()),
|
||||
len,
|
||||
tail,
|
||||
})
|
||||
}
|
||||
|
||||
/// A log's identity and contents, read through one open file so the two cannot disagree.
|
||||
fn read_log(path: &Path) -> Option<((u64, u64), Vec<u8>)> {
|
||||
use std::io::Read;
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
let mut file = fs::File::open(path).ok()?;
|
||||
let meta = file.metadata().ok()?;
|
||||
let mut bytes = Vec::new();
|
||||
file.read_to_end(&mut bytes).ok()?;
|
||||
Some(((meta.dev(), meta.ino()), bytes))
|
||||
}
|
||||
|
||||
/// The part of a trace log that this run added, given the log's mark from before the run.
|
||||
///
|
||||
/// The old length is used as an offset only when the log is still the same file and still holds
|
||||
/// the same bytes just before that offset. A log that was replaced or rewritten during the run,
|
||||
/// whatever its new size, is new in full, as is a log that did not exist before.
|
||||
fn appended_since<'a>(bytes: &'a [u8], identity: (u64, u64), before: Option<&LogMark>) -> &'a [u8] {
|
||||
let Some(mark) = before else {
|
||||
return bytes;
|
||||
};
|
||||
let appended = usize::try_from(mark.len).ok().and_then(|start| {
|
||||
let old_end = bytes.get(..start)?;
|
||||
(mark.identity == identity && old_end.ends_with(&mark.tail)).then(|| &bytes[start..])
|
||||
});
|
||||
appended.unwrap_or(bytes)
|
||||
}
|
||||
|
||||
/// The part of `elapsed` wall-clock time that counts against `--timeout`: everything except the
|
||||
/// `suspended` time spent stopped by Ctrl-Z, whichever phase of the run that fell in.
|
||||
fn active_time(elapsed: Duration, suspended: Duration) -> Duration {
|
||||
elapsed.saturating_sub(suspended)
|
||||
}
|
||||
|
||||
fn cmd_run(args: &[String]) -> ExitCode {
|
||||
@@ -601,10 +694,10 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
match supervise::supervise(boot, timeout, supervise::received_signal) {
|
||||
Ok(Outcome::Exited(st)) if st.success() => {}
|
||||
Ok(Outcome::Exited(st)) => {
|
||||
eprintln!(
|
||||
diag(format_args!(
|
||||
"error: wineboot --init failed for {}: {st}",
|
||||
resolved_prefix.display()
|
||||
);
|
||||
));
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
Ok(outcome @ Outcome::Stopped(stop)) => {
|
||||
@@ -613,10 +706,10 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
return ExitCode::from(if failed { code.max(1) } else { code });
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
diag(format_args!(
|
||||
"error: cannot run wineboot for {}: {e}",
|
||||
resolved_prefix.display()
|
||||
);
|
||||
));
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
}
|
||||
@@ -633,7 +726,7 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
{
|
||||
staged_names.push(name.to_string_lossy().into_owned());
|
||||
}
|
||||
eprintln!("bx-cli: {}", item.describe());
|
||||
diag(format_args!("bx-cli: {}", item.describe()));
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
@@ -642,7 +735,9 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
} else {
|
||||
""
|
||||
};
|
||||
eprintln!("error: cannot stage system32 shims: {e}{hint}");
|
||||
diag(format_args!(
|
||||
"error: cannot stage system32 shims: {e}{hint}"
|
||||
));
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
}
|
||||
@@ -682,14 +777,15 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
if let Some(log) = &abs_log {
|
||||
cmd.env("BX_LOG_FILE", unix_to_wine_z_path(log));
|
||||
}
|
||||
let log_size = |log: &PathBuf| fs::metadata(log).map_or(0, |m| m.len());
|
||||
let log_size_before = abs_log.as_ref().map_or(0, log_size);
|
||||
let log_before = abs_log.as_deref().and_then(log_mark);
|
||||
|
||||
// `--timeout` bounds the whole run, including any prefix initialization above.
|
||||
let remaining = match guest_time_left(timeout, started.elapsed()) {
|
||||
// `--timeout` bounds the whole run, including any prefix initialization above, but not
|
||||
// time the run spent suspended in either phase.
|
||||
let active = active_time(started.elapsed(), supervise::suspended_time());
|
||||
let remaining = match guest_time_left(timeout, active) {
|
||||
Ok(remaining) => remaining,
|
||||
Err(e) => {
|
||||
eprintln!("timed out during initialization: {e}");
|
||||
diag(format_args!("timed out during initialization: {e}"));
|
||||
return ExitCode::from(124);
|
||||
}
|
||||
};
|
||||
@@ -697,14 +793,14 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
let code = match &outcome {
|
||||
Ok(outcome) => outcome.exit_code(),
|
||||
Err(e) => {
|
||||
eprintln!("failed to run CrossOver wine: {e}");
|
||||
diag(format_args!("failed to run CrossOver wine: {e}"));
|
||||
1
|
||||
}
|
||||
};
|
||||
let mut cleanup_failed = false;
|
||||
match &outcome {
|
||||
Ok(Outcome::Exited(status)) if !status.success() => {
|
||||
eprintln!("guest exited with status: {status}");
|
||||
diag(format_args!("guest exited with status: {status}"));
|
||||
}
|
||||
Ok(Outcome::Stopped(stop)) => {
|
||||
cleanup_failed = stop_environment(
|
||||
@@ -718,17 +814,22 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Printed for failed and stopped runs too, which is when it matters most.
|
||||
// Printed for failed and stopped runs too, which is when it matters most. The log is
|
||||
// appended to across runs, so only what this run added is summarized.
|
||||
if let Some(log) = &abs_log
|
||||
&& log_size(log) > log_size_before
|
||||
&& let Ok(bytes) = fs::read(log)
|
||||
&& let Some((identity, bytes)) = read_log(log)
|
||||
{
|
||||
// Guest text may not be valid UTF-8; a summary is still worth printing.
|
||||
print!(
|
||||
"\nTrace summary of {}:\n{}",
|
||||
log.display(),
|
||||
render_trace(&String::from_utf8_lossy(&bytes))
|
||||
);
|
||||
let fresh = appended_since(&bytes, identity, log_before.as_ref());
|
||||
if !fresh.is_empty() {
|
||||
// Guest text may not be valid UTF-8; a summary is still worth printing. A closed
|
||||
// stdout must not turn into a panic after the run.
|
||||
let _ = write!(
|
||||
std::io::stdout(),
|
||||
"\nTrace summary of this run in {}:\n{}",
|
||||
log.display(),
|
||||
render_trace(&String::from_utf8_lossy(fresh))
|
||||
);
|
||||
}
|
||||
}
|
||||
// #474: the shims were staged into the prefix resolved before launch. If CrossOver launched
|
||||
// the bottle from a different prefix that does not expose them, the guest never saw them,
|
||||
@@ -747,14 +848,14 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
&staged_names,
|
||||
);
|
||||
if missing.is_empty() {
|
||||
eprintln!(
|
||||
diag(format_args!(
|
||||
"bx-cli: bottle launched in {}; the shims staged in {} are visible there",
|
||||
launched.display(),
|
||||
environment_dir.display()
|
||||
);
|
||||
));
|
||||
} else {
|
||||
staged_elsewhere = true;
|
||||
eprintln!(
|
||||
diag(format_args!(
|
||||
"error: system32 shims were staged in {} but CrossOver launched the \
|
||||
bottle in {}, where {} cannot be found as staged; the guest did not \
|
||||
see them. Run again: staging will now use the prefix the bottle \
|
||||
@@ -762,13 +863,13 @@ fn cmd_run(args: &[String]) -> ExitCode {
|
||||
environment_dir.display(),
|
||||
launched.display(),
|
||||
missing.join(", ")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
Err(e) => eprintln!(
|
||||
Err(e) => diag(format_args!(
|
||||
"warning: cannot confirm which prefix the bottle launched in, so the staged \
|
||||
system32 shims may not have been used: {e}"
|
||||
),
|
||||
)),
|
||||
}
|
||||
}
|
||||
// The reason for the stop is kept; a failed cleanup or misplaced staging only turns success
|
||||
@@ -834,6 +935,175 @@ fn main() -> ExitCode {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// A stream whose reader is gone: every write fails, as with EPIPE or EIO.
|
||||
struct ClosedStream<'a> {
|
||||
cleanup_done: &'a std::cell::Cell<bool>,
|
||||
writes_before_cleanup: usize,
|
||||
writes: usize,
|
||||
}
|
||||
|
||||
impl std::io::Write for ClosedStream<'_> {
|
||||
fn write(&mut self, _buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.writes += 1;
|
||||
if !self.cleanup_done.get() {
|
||||
self.writes_before_cleanup += 1;
|
||||
}
|
||||
Err(std::io::Error::from(std::io::ErrorKind::BrokenPipe))
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
Err(std::io::Error::from(std::io::ErrorKind::BrokenPipe))
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_closed_diagnostic_stream_cannot_skip_cleanup() {
|
||||
for stop in [Stop::Signalled(libc::SIGINT), Stop::TimedOut] {
|
||||
let cleanup_done = std::cell::Cell::new(false);
|
||||
let mut closed = ClosedStream {
|
||||
cleanup_done: &cleanup_done,
|
||||
writes_before_cleanup: 0,
|
||||
writes: 0,
|
||||
};
|
||||
let failed = report_stop(
|
||||
stop,
|
||||
|| {
|
||||
cleanup_done.set(true);
|
||||
vec!["cleanup failed, programs may still be running: stub".to_string()]
|
||||
},
|
||||
&mut closed,
|
||||
);
|
||||
assert!(cleanup_done.get(), "cleanup did not run for {stop:?}");
|
||||
assert!(failed, "the cleanup failure was lost for {stop:?}");
|
||||
assert!(closed.writes > 0, "nothing was reported for {stop:?}");
|
||||
assert_eq!(
|
||||
closed.writes_before_cleanup, 0,
|
||||
"output came before cleanup"
|
||||
);
|
||||
}
|
||||
let mut text = Vec::new();
|
||||
assert!(!report_stop(Stop::Signalled(2), Vec::new, &mut text));
|
||||
assert_eq!(
|
||||
String::from_utf8(text).unwrap(),
|
||||
"received signal 2; stopped the environment\n"
|
||||
);
|
||||
}
|
||||
|
||||
fn mark(identity: (u64, u64), contents: &str) -> LogMark {
|
||||
let bytes = contents.as_bytes();
|
||||
let tail_start = bytes.len().saturating_sub(LOG_MARK_TAIL as usize);
|
||||
LogMark {
|
||||
identity,
|
||||
len: bytes.len() as u64,
|
||||
tail: bytes[tail_start..].to_vec(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_trace_summary_covers_only_what_this_run_appended() {
|
||||
let file = (1, 100);
|
||||
let earlier = "{\"event\":\"unimpl_api\",\"detail\":\"old.dll!Earlier\"}\n";
|
||||
let this_run = "{\"event\":\"unimpl_api\",\"detail\":\"new.dll!ThisRun\"}\n";
|
||||
let log = format!("{earlier}{this_run}");
|
||||
let before = mark(file, earlier);
|
||||
let fresh = appended_since(log.as_bytes(), file, Some(&before));
|
||||
assert_eq!(fresh, this_run.as_bytes());
|
||||
let rendered = render_trace(&String::from_utf8_lossy(fresh));
|
||||
assert!(rendered.contains("new.dll!ThisRun"), "{rendered}");
|
||||
assert!(!rendered.contains("old.dll!Earlier"), "{rendered}");
|
||||
// Nothing appended: nothing to summarize.
|
||||
assert!(appended_since(earlier.as_bytes(), file, Some(&before)).is_empty());
|
||||
// No log before the run: everything in it is from this run.
|
||||
assert_eq!(
|
||||
appended_since(this_run.as_bytes(), file, None),
|
||||
this_run.as_bytes()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_replaced_log_is_summarized_in_full_whatever_its_size() {
|
||||
let old_file = (1, 100);
|
||||
let new_file = (1, 200);
|
||||
let old = "{\"event\":\"unimpl_api\",\"detail\":\"old.dll!Earlier\"}\n";
|
||||
let before = mark(old_file, old);
|
||||
let record = "{\"event\":\"unimpl_api\",\"detail\":\"new.dll!A\"}\n";
|
||||
// Shorter, exactly as long, and longer than the old log: the old length must never be
|
||||
// used as an offset into a different file.
|
||||
let shorter = &record[..record.len() - 1];
|
||||
let same_size = format!("{:<width$}\n", record.trim_end(), width = old.len() - 1);
|
||||
let longer = format!("{record}{record}{record}");
|
||||
assert!(shorter.len() < old.len() && same_size.len() == old.len());
|
||||
assert!(longer.len() > old.len());
|
||||
for replacement in [shorter, same_size.as_str(), longer.as_str()] {
|
||||
let fresh = appended_since(replacement.as_bytes(), new_file, Some(&before));
|
||||
assert_eq!(fresh, replacement.as_bytes(), "{} bytes", replacement.len());
|
||||
}
|
||||
// Rewritten in place (same file, different contents before the old end).
|
||||
let fresh = appended_since(longer.as_bytes(), old_file, Some(&before));
|
||||
assert_eq!(fresh, longer.as_bytes());
|
||||
assert_eq!(
|
||||
summarize_jsonl(&String::from_utf8_lossy(fresh)).total_lines,
|
||||
3
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn log_marks_follow_the_file_on_disk() {
|
||||
let dir = env::temp_dir().join(format!("bx-cli-logmark-{}", std::process::id()));
|
||||
let _ = fs::remove_dir_all(&dir);
|
||||
fs::create_dir_all(&dir).unwrap();
|
||||
let log = dir.join("trace.jsonl");
|
||||
assert_eq!(log_mark(&log), None);
|
||||
let old = "{\"event\":\"unimpl_api\",\"detail\":\"old.dll!Earlier\"}\n";
|
||||
fs::write(&log, old).unwrap();
|
||||
let before = log_mark(&log).unwrap();
|
||||
assert_eq!(before.len, old.len() as u64);
|
||||
assert_eq!(before.tail, old.as_bytes());
|
||||
|
||||
// Appended to, as bx_runtime_veh does: only the new record is this run's.
|
||||
let added = "{\"event\":\"unimpl_api\",\"detail\":\"new.dll!ThisRun\"}\n";
|
||||
fs::write(&log, format!("{old}{added}")).unwrap();
|
||||
let (identity, bytes) = read_log(&log).unwrap();
|
||||
assert_eq!(
|
||||
appended_since(&bytes, identity, Some(&before)),
|
||||
added.as_bytes()
|
||||
);
|
||||
|
||||
// Replaced by a new, longer file during the run: all of it is this run's.
|
||||
let replacement = dir.join("replacement");
|
||||
let longer = format!("{added}{added}{added}");
|
||||
fs::write(&replacement, &longer).unwrap();
|
||||
fs::rename(&replacement, &log).unwrap();
|
||||
let (identity, bytes) = read_log(&log).unwrap();
|
||||
assert_ne!(identity, before.identity);
|
||||
let fresh = appended_since(&bytes, identity, Some(&before));
|
||||
assert_eq!(
|
||||
summarize_jsonl(&String::from_utf8_lossy(fresh)).total_lines,
|
||||
3
|
||||
);
|
||||
fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_pause_in_an_earlier_phase_is_not_charged_to_the_guest() {
|
||||
let limit = Some(Duration::from_secs(2));
|
||||
let ms = Duration::from_millis;
|
||||
// As reviewed: paused 2.5 s during wineboot with --timeout 2, 0.3 s actually running.
|
||||
assert_eq!(
|
||||
guest_time_left(limit, active_time(ms(2800), ms(2500))),
|
||||
Ok(Some(ms(1700)))
|
||||
);
|
||||
// Without a pause the wall clock counts in full.
|
||||
assert_eq!(
|
||||
guest_time_left(limit, active_time(ms(500), Duration::ZERO)),
|
||||
Ok(Some(ms(1500)))
|
||||
);
|
||||
// Initialization that really ran for the whole timeout still stops the launch.
|
||||
assert!(guest_time_left(limit, active_time(ms(5000), ms(2500))).is_err());
|
||||
// More suspension than elapsed time cannot go negative.
|
||||
assert_eq!(active_time(ms(100), ms(900)), Duration::ZERO);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn staging_into_a_prefix_the_bottle_did_not_launch_in_is_reported() {
|
||||
let resolved_before = Path::new("/bottles/managed/corp");
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::io::IsTerminal;
|
||||
use std::os::unix::process::CommandExt;
|
||||
use std::path::Path;
|
||||
use std::process::{Child, Command, ExitStatus, Stdio};
|
||||
use std::sync::atomic::{AtomicI32, Ordering};
|
||||
use std::sync::atomic::{AtomicBool, AtomicI32, AtomicU64, Ordering};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
const POLL: Duration = Duration::from_millis(50);
|
||||
@@ -16,29 +16,77 @@ const POLL: Duration = Duration::from_millis(50);
|
||||
const GRACE: Duration = Duration::from_secs(5);
|
||||
const SERVER_WAIT: Duration = Duration::from_secs(15);
|
||||
|
||||
/// Signals that stop the run: the guest group is terminated and the environment cleaned up.
|
||||
/// SIGQUIT (Ctrl-\) is included so it cannot kill `bx-cli` and leave the guest running (#461).
|
||||
const STOP_SIGNALS: [libc::c_int; 4] = [libc::SIGINT, libc::SIGTERM, libc::SIGHUP, libc::SIGQUIT];
|
||||
|
||||
static SIGNAL: AtomicI32 = AtomicI32::new(0);
|
||||
static SUSPEND: AtomicBool = AtomicBool::new(false);
|
||||
/// Total time this process has spent suspended inside [`supervise`], in nanoseconds.
|
||||
static SUSPENDED_NANOS: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
extern "C" fn note_signal(signal: libc::c_int) {
|
||||
SIGNAL.store(signal, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// Records SIGINT, SIGTERM and SIGHUP instead of dying, so the run can be cleaned up.
|
||||
pub fn install_signal_handlers() {
|
||||
for signal in [libc::SIGINT, libc::SIGTERM, libc::SIGHUP] {
|
||||
// SAFETY: the handler only stores to an atomic, which is async-signal-safe.
|
||||
unsafe {
|
||||
libc::signal(
|
||||
signal,
|
||||
note_signal as extern "C" fn(libc::c_int) as libc::sighandler_t,
|
||||
);
|
||||
extern "C" fn note_suspend(_signal: libc::c_int) {
|
||||
SUSPEND.store(true, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// Installs `handler` for `signal` unless the disposition this process inherited is `SIG_IGN`.
|
||||
/// Returns whether the handler was installed.
|
||||
///
|
||||
/// A signal the caller chose to ignore (`nohup`, or a `&` job of a non-interactive shell) stays
|
||||
/// ignored, so it cannot stop the run or the bottle (#461).
|
||||
fn install_unless_ignored(signal: libc::c_int, handler: extern "C" fn(libc::c_int)) -> bool {
|
||||
// SAFETY: `current` is a valid, writable sigaction; a null new action only queries. The
|
||||
// handlers passed here only store to an atomic, which is async-signal-safe.
|
||||
unsafe {
|
||||
let mut current: libc::sigaction = std::mem::zeroed();
|
||||
if libc::sigaction(signal, std::ptr::null(), &mut current) == 0
|
||||
&& current.sa_sigaction == libc::SIG_IGN
|
||||
{
|
||||
return false;
|
||||
}
|
||||
libc::signal(signal, handler as libc::sighandler_t) != libc::SIG_ERR
|
||||
}
|
||||
}
|
||||
|
||||
/// Records SIGINT, SIGTERM, SIGHUP and SIGQUIT instead of dying, so the run can be cleaned up,
|
||||
/// and records SIGTSTP (Ctrl-Z) so the guest group can be suspended together with `bx-cli`.
|
||||
/// Signals that were inherited as ignored are left ignored.
|
||||
pub fn install_signal_handlers() {
|
||||
for signal in STOP_SIGNALS {
|
||||
install_unless_ignored(signal, note_signal);
|
||||
}
|
||||
install_unless_ignored(libc::SIGTSTP, note_suspend);
|
||||
}
|
||||
|
||||
pub fn received_signal() -> i32 {
|
||||
SIGNAL.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
/// Total time spent suspended (Ctrl-Z until continued) across every [`supervise`] call so far.
|
||||
///
|
||||
/// A caller that budgets one `--timeout` over several supervised phases subtracts this from its
|
||||
/// own wall-clock measurement, so a pause during an earlier phase is not charged to a later one.
|
||||
pub fn suspended_time() -> Duration {
|
||||
Duration::from_nanos(SUSPENDED_NANOS.load(Ordering::SeqCst))
|
||||
}
|
||||
|
||||
/// True once per SIGTSTP received since the last call.
|
||||
fn take_suspend_request() -> bool {
|
||||
SUSPEND.swap(false, Ordering::SeqCst)
|
||||
}
|
||||
|
||||
/// Stops this process the way the terminal's Ctrl-Z would; returns when it is continued.
|
||||
fn suspend_self(_guest: libc::pid_t) {
|
||||
// SAFETY: raise takes no pointers. SIGSTOP cannot be caught, so this stops the process.
|
||||
unsafe {
|
||||
libc::raise(libc::SIGSTOP);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum Stop {
|
||||
TimedOut,
|
||||
@@ -85,10 +133,27 @@ fn wait_until(child: &mut Child, deadline: Instant) -> std::io::Result<Option<Ex
|
||||
|
||||
/// Runs `command` in a new process group until it exits, `timeout` passes, or `signal`
|
||||
/// returns non-zero. On a stop the whole group is terminated before this returns.
|
||||
///
|
||||
/// The guest is not in the terminal's foreground group, so Ctrl-Z reaches only `bx-cli`. It is
|
||||
/// passed on: the guest group gets SIGTSTP, `bx-cli` stops itself, and when `bx-cli` is continued
|
||||
/// the guest group gets SIGCONT. Time spent suspended does not count against `timeout`.
|
||||
pub fn supervise(
|
||||
command: Command,
|
||||
timeout: Option<Duration>,
|
||||
signal: impl Fn() -> i32,
|
||||
) -> std::io::Result<Outcome> {
|
||||
supervise_with(command, timeout, signal, take_suspend_request, suspend_self)
|
||||
}
|
||||
|
||||
/// [`supervise`] with the suspend request and the self-stop injected, so tests can exercise the
|
||||
/// job-control path without stopping the test process. `suspend` is called with the guest
|
||||
/// group's id after that group was sent SIGTSTP and returns when the launcher may continue.
|
||||
fn supervise_with(
|
||||
mut command: Command,
|
||||
timeout: Option<Duration>,
|
||||
signal: impl Fn() -> i32,
|
||||
suspend_requested: impl Fn() -> bool,
|
||||
mut suspend: impl FnMut(libc::pid_t),
|
||||
) -> std::io::Result<Outcome> {
|
||||
// A background process group is stopped by SIGTTIN if it reads the terminal, so a terminal
|
||||
// is replaced by end-of-file. Piped and redirected input is passed through.
|
||||
@@ -97,6 +162,7 @@ pub fn supervise(
|
||||
}
|
||||
let mut child = command.process_group(0).spawn()?;
|
||||
let started = Instant::now();
|
||||
let mut suspended = Duration::ZERO;
|
||||
let stop = loop {
|
||||
if let Some(status) = child.try_wait()? {
|
||||
return Ok(Outcome::Exited(status));
|
||||
@@ -105,7 +171,20 @@ pub fn supervise(
|
||||
if received != 0 {
|
||||
break Stop::Signalled(received);
|
||||
}
|
||||
if timeout.is_some_and(|limit| started.elapsed() >= limit) {
|
||||
if suspend_requested() {
|
||||
let paused = Instant::now();
|
||||
signal_group(&child, libc::SIGTSTP);
|
||||
suspend(child.id() as libc::pid_t);
|
||||
signal_group(&child, libc::SIGCONT);
|
||||
let pause = paused.elapsed();
|
||||
suspended += pause;
|
||||
SUSPENDED_NANOS.fetch_add(
|
||||
u64::try_from(pause.as_nanos()).unwrap_or(u64::MAX),
|
||||
Ordering::SeqCst,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if timeout.is_some_and(|limit| started.elapsed().saturating_sub(suspended) >= limit) {
|
||||
break Stop::TimedOut;
|
||||
}
|
||||
std::thread::sleep(POLL);
|
||||
@@ -141,6 +220,10 @@ fn group_leader_running(child: &Child) -> bool {
|
||||
///
|
||||
/// `-k` exits 1 when no server is running (observed on CrossOver 26.3), so 1 is accepted
|
||||
/// there; `-w` must still succeed, which a surviving server prevents.
|
||||
///
|
||||
/// Each `wineserver` runs in its own process group with no terminal input, so a second Ctrl-C
|
||||
/// typed while cleanup is running reaches only `bx-cli` (which records it) and cannot kill the
|
||||
/// cleanup itself (#461).
|
||||
pub fn stop_server(
|
||||
wineserver: &Path,
|
||||
prefix: &Path,
|
||||
@@ -152,8 +235,10 @@ pub fn stop_server(
|
||||
.env_clear()
|
||||
.envs(environment.iter().map(|(k, v)| (k, v)))
|
||||
.env("WINEPREFIX", prefix)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.process_group(0)
|
||||
.spawn()
|
||||
.map_err(|e| format!("cannot start wineserver {flag}: {e}"))?;
|
||||
match wait_until(&mut child, Instant::now() + SERVER_WAIT) {
|
||||
@@ -222,6 +307,157 @@ mod tests {
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
/// Signal dispositions and the recorded signal are process-wide: tests that touch them run
|
||||
/// one at a time and use signals no other test raises.
|
||||
static SIGNAL_TESTS: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
|
||||
fn set_disposition(signal: libc::c_int, action: libc::sighandler_t) {
|
||||
// SAFETY: SIG_DFL and SIG_IGN are valid dispositions for these signals.
|
||||
unsafe {
|
||||
libc::signal(signal, action);
|
||||
}
|
||||
}
|
||||
|
||||
fn disposition(signal: libc::c_int) -> libc::sighandler_t {
|
||||
// SAFETY: a null new action only queries; `current` is valid and writable.
|
||||
unsafe {
|
||||
let mut current: libc::sigaction = std::mem::zeroed();
|
||||
assert_eq!(libc::sigaction(signal, std::ptr::null(), &mut current), 0);
|
||||
current.sa_sigaction
|
||||
}
|
||||
}
|
||||
|
||||
fn raise(signal: libc::c_int) {
|
||||
// SAFETY: raise takes no pointers.
|
||||
unsafe {
|
||||
libc::raise(signal);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_inherited_ignored_signal_stays_ignored() {
|
||||
let _guard = SIGNAL_TESTS.lock().unwrap_or_else(|e| e.into_inner());
|
||||
// As under nohup: the signal arrives already ignored.
|
||||
set_disposition(libc::SIGUSR2, libc::SIG_IGN);
|
||||
SIGNAL.store(0, Ordering::SeqCst);
|
||||
assert!(!install_unless_ignored(libc::SIGUSR2, note_signal));
|
||||
assert_eq!(disposition(libc::SIGUSR2), libc::SIG_IGN);
|
||||
raise(libc::SIGUSR2);
|
||||
assert_eq!(
|
||||
received_signal(),
|
||||
0,
|
||||
"an ignored signal must not stop the run"
|
||||
);
|
||||
|
||||
// Control: the same signal with the default disposition is recorded.
|
||||
set_disposition(libc::SIGUSR2, libc::SIG_DFL);
|
||||
assert!(install_unless_ignored(libc::SIGUSR2, note_signal));
|
||||
raise(libc::SIGUSR2);
|
||||
assert_eq!(received_signal(), libc::SIGUSR2);
|
||||
set_disposition(libc::SIGUSR2, libc::SIG_DFL);
|
||||
SIGNAL.store(0, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sigquit_is_recorded_and_stops_the_guest_group() {
|
||||
let _guard = SIGNAL_TESTS.lock().unwrap_or_else(|e| e.into_inner());
|
||||
assert!(STOP_SIGNALS.contains(&libc::SIGQUIT));
|
||||
let before = disposition(libc::SIGQUIT);
|
||||
set_disposition(libc::SIGQUIT, libc::SIG_DFL);
|
||||
SIGNAL.store(0, Ordering::SeqCst);
|
||||
assert!(install_unless_ignored(libc::SIGQUIT, note_signal));
|
||||
// Without the handler this would kill the test process, as it killed bx-cli.
|
||||
raise(libc::SIGQUIT);
|
||||
assert_eq!(received_signal(), libc::SIGQUIT);
|
||||
set_disposition(libc::SIGQUIT, before);
|
||||
SIGNAL.store(0, Ordering::SeqCst);
|
||||
|
||||
let stopped = supervise(shell("sleep 30"), None, || libc::SIGQUIT).unwrap();
|
||||
assert!(matches!(
|
||||
stopped,
|
||||
Outcome::Stopped(Stop::Signalled(libc::SIGQUIT))
|
||||
));
|
||||
assert_eq!(stopped.exit_code(), 128 + libc::SIGQUIT as u8);
|
||||
}
|
||||
|
||||
/// True once `pid` is reported stopped; leaves the status in place.
|
||||
fn is_stopped(pid: libc::pid_t) -> bool {
|
||||
(0..100).any(|_| {
|
||||
// SAFETY: `info` is valid and writable; WNOWAIT leaves the child's state in place.
|
||||
let stopped = unsafe {
|
||||
let mut info: libc::siginfo_t = std::mem::zeroed();
|
||||
libc::waitid(
|
||||
libc::P_PID,
|
||||
pid as libc::id_t,
|
||||
&mut info,
|
||||
libc::WSTOPPED | libc::WNOHANG | libc::WNOWAIT,
|
||||
) == 0
|
||||
&& info.si_pid() == pid
|
||||
};
|
||||
if !stopped {
|
||||
std::thread::sleep(POLL);
|
||||
}
|
||||
stopped
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_suspend_request_stops_and_resumes_the_guest_without_using_up_the_timeout() {
|
||||
let requested = std::cell::Cell::new(false);
|
||||
let guest_was_stopped = std::cell::Cell::new(false);
|
||||
let suspended_before = suspended_time();
|
||||
let outcome = supervise_with(
|
||||
shell("sleep 0.4; exit 0"),
|
||||
// Shorter than the suspension below: only running time may count.
|
||||
Some(Duration::from_millis(1500)),
|
||||
|| 0,
|
||||
|| !requested.replace(true),
|
||||
|guest| {
|
||||
guest_was_stopped.set(is_stopped(guest));
|
||||
std::thread::sleep(Duration::from_millis(2000));
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
assert!(guest_was_stopped.get(), "the guest group was not stopped");
|
||||
// The pause is also reported to callers that budget a timeout across several phases.
|
||||
let reported = suspended_time() - suspended_before;
|
||||
assert!(reported >= Duration::from_millis(2000), "{reported:?}");
|
||||
match outcome {
|
||||
Outcome::Exited(status) => assert!(status.success(), "{status}"),
|
||||
other => panic!("the resumed guest should have finished on its own: {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cleanup_runs_outside_the_callers_process_group() {
|
||||
let dir = scratch("cleanup-group");
|
||||
let server = dir.join("wineserver");
|
||||
let seen = dir.join("pgid");
|
||||
std::fs::write(
|
||||
&server,
|
||||
format!(
|
||||
"#!/bin/sh\n/bin/ps -o pgid= -p $$ >> '{}'\n",
|
||||
seen.display()
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::set_permissions(&server, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
stop_server(&server, &dir, &[]).unwrap();
|
||||
// SAFETY: getpgrp takes no arguments and cannot fail.
|
||||
let ours = unsafe { libc::getpgrp() };
|
||||
let groups: Vec<libc::pid_t> = std::fs::read_to_string(&seen)
|
||||
.unwrap()
|
||||
.lines()
|
||||
.map(|line| line.trim().parse().unwrap())
|
||||
.collect();
|
||||
assert_eq!(groups.len(), 2, "-k and -w should both have run");
|
||||
for group in groups {
|
||||
// A terminal signal goes to the foreground group, which these are not part of.
|
||||
assert_ne!(group, ours, "cleanup shares the caller's process group");
|
||||
}
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_idle_server_is_accepted_only_when_the_wait_succeeds() {
|
||||
let dir = scratch("server");
|
||||
|
||||
@@ -18,6 +18,37 @@ cmake -S "$ROOT_DIR/shims" -B "$BUILD_DIR" \
|
||||
|
||||
cmake --build "$BUILD_DIR" --parallel "$JOBS"
|
||||
|
||||
# bx_shader_bridge.dll (#445, #484): shader-transpiler/crates/dxbc-accc built for x86-64
|
||||
# Windows guests, linked with abi/defs/bx_shader_bridge.def so its export list and internal
|
||||
# name are the frozen ones. The verifier below then checks it like every other shim.
|
||||
# Cargo and rustc are resolved through rustup when present (a cargo earlier on PATH may have
|
||||
# no Windows std), and the build always goes to <repo>/target so no stale DLL is staged.
|
||||
BRIDGE_TARGET=x86_64-pc-windows-gnu
|
||||
if command -v rustup >/dev/null 2>&1; then
|
||||
BRIDGE_CARGO="$(cd "$ROOT_DIR" && rustup which cargo)"
|
||||
BRIDGE_RUSTC="$(cd "$ROOT_DIR" && rustup which rustc)"
|
||||
else
|
||||
BRIDGE_CARGO="$(command -v cargo || true)"
|
||||
BRIDGE_RUSTC="$(command -v rustc || true)"
|
||||
fi
|
||||
if [ -z "$BRIDGE_CARGO" ] || [ -z "$BRIDGE_RUSTC" ]; then
|
||||
echo "error: cargo/rustc not found; bx_shader_bridge.dll needs the Rust toolchain" >&2
|
||||
exit 1
|
||||
fi
|
||||
BRIDGE_LIBDIR="$("$BRIDGE_RUSTC" --print target-libdir --target "$BRIDGE_TARGET" 2>/dev/null || true)"
|
||||
if [ -z "$BRIDGE_LIBDIR" ] || ! ls "$BRIDGE_LIBDIR"/libstd-*.rlib >/dev/null 2>&1; then
|
||||
echo "error: $("$BRIDGE_RUSTC" --version) has no std for $BRIDGE_TARGET, needed for bx_shader_bridge.dll" >&2
|
||||
echo "error: install it with: rustup target add $BRIDGE_TARGET" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "=== Building bx_shader_bridge.dll with $("$BRIDGE_RUSTC" --version) ==="
|
||||
RUSTC="$BRIDGE_RUSTC" CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc \
|
||||
"$BRIDGE_CARGO" rustc --locked --release -j "$JOBS" --manifest-path "$ROOT_DIR/Cargo.toml" \
|
||||
-p dxbc-accc --lib --crate-type cdylib --target "$BRIDGE_TARGET" --target-dir "$ROOT_DIR/target" \
|
||||
-- -C link-arg="$ROOT_DIR/abi/defs/bx_shader_bridge.def"
|
||||
mkdir -p "$BUILD_DIR/bin"
|
||||
cp "$ROOT_DIR/target/$BRIDGE_TARGET/release/dxbc_accc.dll" "$BUILD_DIR/bin/bx_shader_bridge.dll"
|
||||
|
||||
echo "=== Verifying built PE32+ DLL Export Directories against abi/defs/*.def ==="
|
||||
python3 - "$ROOT_DIR/abi/defs" "$BUILD_DIR/bin" <<'PY'
|
||||
import os
|
||||
|
||||
@@ -186,22 +186,70 @@ mod tests {
|
||||
assert!(run.output_complete);
|
||||
}
|
||||
|
||||
/// Timeout for the tests below whose stand-in probe has to start and print before the
|
||||
/// deadline. Starting a freshly written script costs tens of milliseconds here and
|
||||
/// occasionally far more, so a few hundred milliseconds made these tests fail now and then
|
||||
/// (#479). They check what happens at the deadline, not how fast a script starts.
|
||||
const START_MARGIN: Duration = Duration::from_secs(2);
|
||||
|
||||
/// Removes the pid file, and kills the recorded process if a failing test left it running.
|
||||
struct PidFile(PathBuf);
|
||||
|
||||
impl Drop for PidFile {
|
||||
fn drop(&mut self) {
|
||||
if std::thread::panicking()
|
||||
&& let Ok(pid) = std::fs::read_to_string(&self.0)
|
||||
{
|
||||
let _ = Command::new("/bin/kill").arg(pid.trim()).status();
|
||||
}
|
||||
let _ = std::fs::remove_file(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn kills_a_probe_that_exceeds_the_timeout() {
|
||||
let script = Script::new("hang", "echo started; exec sleep 30");
|
||||
let pid_file = PidFile(
|
||||
std::env::temp_dir().join(format!("bx-harness-probe's-{}.pid", std::process::id())),
|
||||
);
|
||||
let _ = std::fs::remove_file(&pid_file.0);
|
||||
// Pass the path as the value of --framework. The apostrophe tests literal path handling.
|
||||
// `exec` keeps the pid, so the recorded pid is the process that has to be killed.
|
||||
let script = Script::new(
|
||||
"hang",
|
||||
"echo $$ > \"$2\" || exit 1; echo started; exec sleep 30",
|
||||
);
|
||||
let started = Instant::now();
|
||||
let run = run_probe(&script.0, Path::new("/fw"), Duration::from_millis(300)).unwrap();
|
||||
let run = run_probe(&script.0, &pid_file.0, START_MARGIN).unwrap();
|
||||
let elapsed = started.elapsed();
|
||||
assert!(run.status.is_none());
|
||||
// Output written before the kill is kept.
|
||||
assert_eq!(run.stdout, "started\n");
|
||||
assert!(started.elapsed() < Duration::from_secs(10));
|
||||
// The probe ran until the deadline and no longer: it was killed, not waited for.
|
||||
assert!(elapsed >= START_MARGIN, "returned early after {elapsed:?}");
|
||||
assert!(
|
||||
elapsed < START_MARGIN + DRAIN_GRACE + Duration::from_secs(5),
|
||||
"returned after {elapsed:?}"
|
||||
);
|
||||
// The process is gone. `output_complete` is deliberately not asserted: tests run in
|
||||
// parallel, and a child spawned by another test at the wrong moment can inherit this
|
||||
// probe's pipe and hold it open (seen in 2 of 200 runs).
|
||||
let pid = std::fs::read_to_string(&pid_file.0).unwrap();
|
||||
let alive = Command::new("/bin/kill")
|
||||
.args(["-0", pid.trim()])
|
||||
.stderr(Stdio::null())
|
||||
.status()
|
||||
.unwrap()
|
||||
.success();
|
||||
assert!(!alive, "probe {} survived the timeout", pid.trim());
|
||||
}
|
||||
|
||||
/// The probe exits at once, but a background descendant inherits stdout and
|
||||
/// keeps it open well past the timeout.
|
||||
#[test]
|
||||
fn a_descendant_holding_the_pipes_cannot_outlast_the_deadline() {
|
||||
let script = Script::new("orphan", "sleep 5 & echo started");
|
||||
let timeout = Duration::from_millis(500);
|
||||
// The descendant has to outlive the bound asserted below by a wide margin.
|
||||
let script = Script::new("orphan", "sleep 6 & echo started");
|
||||
let timeout = START_MARGIN;
|
||||
let started = Instant::now();
|
||||
let run = run_probe(&script.0, Path::new("/fw"), timeout).unwrap();
|
||||
let elapsed = started.elapsed();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <windows.h>
|
||||
#include <unknwn.h>
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "bx_log.h"
|
||||
|
||||
@@ -10,6 +12,30 @@ constexpr GUID game_input_v0 = {0x11be2a7e, 0x4254, 0x445a,
|
||||
{0x9c, 0x09, 0xff, 0xc4, 0x0f, 0x00, 0x69, 0x18}};
|
||||
using Callback = void (WINAPI*)();
|
||||
|
||||
// GameInputEnumerationKind values from Microsoft's public GDK GameInput (v0) reference:
|
||||
// 0 = GameInputNoEnumeration, 1 = GameInputAsyncEnumeration, 2 = GameInputBlockingEnumeration.
|
||||
constexpr uint32_t kMaxEnumerationKind = 2;
|
||||
|
||||
struct SrwExclusiveLock {
|
||||
explicit SrwExclusiveLock(SRWLOCK& lock) : lock_(lock) { AcquireSRWLockExclusive(&lock_); }
|
||||
~SrwExclusiveLock() { ReleaseSRWLockExclusive(&lock_); }
|
||||
SrwExclusiveLock(const SrwExclusiveLock&) = delete;
|
||||
SrwExclusiveLock& operator=(const SrwExclusiveLock&) = delete;
|
||||
|
||||
private:
|
||||
SRWLOCK& lock_;
|
||||
};
|
||||
|
||||
struct RegisteredDeviceCallback {
|
||||
void* device = nullptr;
|
||||
uint32_t input_kind = 0;
|
||||
uint32_t status_filter = 0;
|
||||
uint32_t enumeration_kind = 0;
|
||||
void* context = nullptr;
|
||||
Callback callback = nullptr;
|
||||
bool stopped = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
HRESULT unavailable(T* out) {
|
||||
if (!out) return E_POINTER;
|
||||
@@ -19,6 +45,11 @@ HRESULT unavailable(T* out) {
|
||||
|
||||
class GameInput final : public IUnknown {
|
||||
LONG refs = 0;
|
||||
SRWLOCK callback_lock_ = SRWLOCK_INIT;
|
||||
uint64_t next_token_ = 1;
|
||||
std::unordered_map<uint64_t, RegisteredDeviceCallback> callbacks_;
|
||||
std::atomic<uint32_t> focus_policy_{0};
|
||||
|
||||
public:
|
||||
HRESULT WINAPI QueryInterface(REFIID iid, void** out) override {
|
||||
if (!out) return E_POINTER;
|
||||
@@ -54,9 +85,32 @@ public:
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 8, "RegisterReadingCallback");
|
||||
return unavailable(out);
|
||||
}
|
||||
virtual HRESULT WINAPI RegisterDeviceCallback(void*, uint32_t, uint32_t, uint32_t, void*, Callback, uint64_t* out) {
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 9, "RegisterDeviceCallback");
|
||||
return unavailable(out);
|
||||
virtual HRESULT WINAPI RegisterDeviceCallback(
|
||||
void* device,
|
||||
uint32_t input_kind,
|
||||
uint32_t status_filter,
|
||||
uint32_t enumeration_kind,
|
||||
void* context,
|
||||
Callback callback,
|
||||
uint64_t* out_token
|
||||
) {
|
||||
if (out_token) *out_token = 0;
|
||||
if (!callback || input_kind == 0 || status_filter == 0 || enumeration_kind > kMaxEnumerationKind) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
SrwExclusiveLock guard(callback_lock_);
|
||||
const uint64_t token = next_token_++;
|
||||
callbacks_.emplace(token, RegisteredDeviceCallback{
|
||||
device,
|
||||
input_kind,
|
||||
status_filter,
|
||||
enumeration_kind,
|
||||
context,
|
||||
callback,
|
||||
false,
|
||||
});
|
||||
if (out_token) *out_token = token;
|
||||
return S_OK;
|
||||
}
|
||||
virtual HRESULT WINAPI RegisterSystemButtonCallback(void*, uint32_t, void*, Callback, uint64_t* out) {
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 10, "RegisterSystemButtonCallback");
|
||||
@@ -66,12 +120,18 @@ public:
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 11, "RegisterKeyboardLayoutCallback");
|
||||
return unavailable(out);
|
||||
}
|
||||
virtual void WINAPI StopCallback(uint64_t) {
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 12, "StopCallback");
|
||||
virtual void WINAPI StopCallback(uint64_t token) {
|
||||
if (token == 0) return;
|
||||
SrwExclusiveLock guard(callback_lock_);
|
||||
auto it = callbacks_.find(token);
|
||||
if (it != callbacks_.end()) {
|
||||
it->second.stopped = true;
|
||||
}
|
||||
}
|
||||
virtual bool WINAPI UnregisterCallback(uint64_t, uint64_t) {
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 13, "UnregisterCallback");
|
||||
return false;
|
||||
virtual bool WINAPI UnregisterCallback(uint64_t token, uint64_t /*timeout_us*/) {
|
||||
if (token == 0) return false;
|
||||
SrwExclusiveLock guard(callback_lock_);
|
||||
return callbacks_.erase(token) > 0;
|
||||
}
|
||||
virtual HRESULT WINAPI CreateDispatcher(void** out) {
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 14, "CreateDispatcher");
|
||||
@@ -101,8 +161,8 @@ public:
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 20, "EnableOemDeviceSupport");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
virtual void WINAPI SetFocusPolicy(uint32_t) {
|
||||
BX_VTABLE_STUB_LOG("IGameInput", 21, "SetFocusPolicy");
|
||||
virtual void WINAPI SetFocusPolicy(uint32_t policy) {
|
||||
focus_policy_.store(policy, std::memory_order_relaxed);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ HRESULT WINAPI XDspDisconnect(void*);
|
||||
|
||||
#define CHECK(expr) do { if (!(expr)) { std::fprintf(stderr, "line %d: %s\n", __LINE__, #expr); return 1; } } while (0)
|
||||
|
||||
namespace {
|
||||
void WINAPI dummy_device_callback(uint64_t, void*, void*, uint64_t, uint32_t, uint32_t) {}
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
void* object = nullptr;
|
||||
CHECK(AcpHalCreate(&object) == S_OK && object);
|
||||
@@ -148,8 +152,42 @@ int main() {
|
||||
using Reading = HRESULT (WINAPI*)(IUnknown*, uint32_t, void*, void**);
|
||||
void* reading = reinterpret_cast<void*>(uintptr_t{1});
|
||||
CHECK(reinterpret_cast<Reading>(table[4])(v0, 0, nullptr, &reading) == E_NOTIMPL && !reading);
|
||||
|
||||
using RegisterDeviceCb = HRESULT (WINAPI*)(
|
||||
IUnknown*, void*, uint32_t, uint32_t, uint32_t, void*, void*, uint64_t*);
|
||||
using StopCb = void (WINAPI*)(IUnknown*, uint64_t);
|
||||
using UnregisterCb = bool (WINAPI*)(IUnknown*, uint64_t, uint64_t);
|
||||
using SetFocusPolicyFn = void (WINAPI*)(IUnknown*, uint32_t);
|
||||
auto reg_dev = reinterpret_cast<RegisterDeviceCb>(table[9]);
|
||||
auto stop_cb = reinterpret_cast<StopCb>(table[12]);
|
||||
auto unreg_cb = reinterpret_cast<UnregisterCb>(table[13]);
|
||||
auto set_focus = reinterpret_cast<SetFocusPolicyFn>(table[21]);
|
||||
void* cb_fn = reinterpret_cast<void*>(&dummy_device_callback);
|
||||
|
||||
uint64_t tok1 = 99, tok2 = 0;
|
||||
CHECK(reg_dev(v0, nullptr, 1, 1, 0, nullptr, nullptr, &tok1) == E_INVALIDARG && tok1 == 0);
|
||||
tok1 = 99;
|
||||
CHECK(reg_dev(v0, nullptr, 0, 1, 0, nullptr, cb_fn, &tok1) == E_INVALIDARG && tok1 == 0);
|
||||
tok1 = 99;
|
||||
CHECK(reg_dev(v0, nullptr, 1, 0, 0, nullptr, cb_fn, &tok1) == E_INVALIDARG && tok1 == 0);
|
||||
tok1 = 99;
|
||||
CHECK(reg_dev(v0, nullptr, 1, 1, 3, nullptr, cb_fn, &tok1) == E_INVALIDARG && tok1 == 0);
|
||||
|
||||
CHECK(reg_dev(v0, nullptr, 0x10000, 0x1, 2, &tok1, cb_fn, &tok1) == S_OK && tok1 != 0);
|
||||
CHECK(reg_dev(v0, nullptr, 0x10000, 0x1, 1, nullptr, cb_fn, &tok2) == S_OK && tok2 > tok1);
|
||||
CHECK(reg_dev(v0, nullptr, 0x10000, 0x1, 0, nullptr, cb_fn, nullptr) == S_OK);
|
||||
|
||||
CHECK(!unreg_cb(v0, 0, 5000));
|
||||
CHECK(!unreg_cb(v0, 0xdeadbeefULL, 5000));
|
||||
stop_cb(v0, tok1);
|
||||
CHECK(unreg_cb(v0, tok1, 5000));
|
||||
CHECK(!unreg_cb(v0, tok1, 5000));
|
||||
CHECK(unreg_cb(v0, tok2, 0));
|
||||
CHECK(!unreg_cb(v0, tok2, 0));
|
||||
set_focus(v0, 0x2);
|
||||
|
||||
CHECK(v0->Release() == 1);
|
||||
CHECK(input->Release() == 0);
|
||||
FreeLibrary(dll);
|
||||
std::puts("PASS: audio mappings, APU and DSP queues, GameInput ordinal 1");
|
||||
std::puts("PASS: audio mappings, APU and DSP queues, GameInput ordinal 1 and device callbacks");
|
||||
}
|
||||
Reference in new issue
Block a user