Skip to content

Wine logging affects zig build test when enable_wine = true  #24139

Open
@playday3008

Description

@playday3008

Zig Version

0.14.0

Steps to Reproduce and Observed Behavior

  • zig init
  • zig build test -Dtarget=native-windows -fwine

Test will not succeed as wine uses stderr for logging

Expected Behavior

Test should succeed.

Proposed solution

Set WINEDEBUG as -all while running tests, which disables all wine logging and allows test to succeed.

For example, command below will pass test just fine:

  • WINEDEBUG=-all zig build test -Dtarget=native-windows -fwine

Possible solution

Modify this code:

zig/lib/std/Build/Step/Run.zig

Lines 1060 to 1067 in 4d79806

.wine => |bin_name| {
if (b.enable_wine) {
try interp_argv.append(bin_name);
try interp_argv.appendSlice(argv);
} else {
return failForeign(run, "-fwine", argv[0], exe);
}
},

by adding

        if (run.stdio == .zig_test) {
            try b.graph.env_map.put("WINEDEBUG", "-all");
        }

right after

.wine => |bin_name| {
    if (b.enable_wine) {

and it works, I tested, but I'm not sure whether it's a good solution.

Full snippet

.wine => |bin_name| {
    if (b.enable_wine) {
        if (run.stdio == .zig_test) {
            try b.graph.env_map.put("WINEDEBUG", "-all");
        }
        try interp_argv.append(bin_name);
        try interp_argv.appendSlice(argv);
    } else {
        return failForeign(run, "-fwine", argv[0], exe);
    }
},

Metadata

Metadata

Assignees

Labels

enhancementSolving this issue will likely involve adding new logic or components to the codebase.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions