Skip to content

make check-windows fails and no test file under windows/ or ui/ can be compiled #59

Open

Description

@metif12

make check-windows fails its second line on master, and no test file under
windows/ or ui/ can be compiled at all. This is independent of the
chart.v type-inference breakage; I will report that separately.

What happens

$ make check-windows
$ v -enable-globals -os windows -check windows/ui_windows_test.v
windows/ui_windows_test.v:23:36: error: unknown type `ui2.KeyCode`
  23 |     assert windows_virtual_key(.left) == .left
windows/ui_windows_test.v:30:30: error: unknown type `ui2.Kind`
  30 |     assert windows_widget_kind(.screen) == .screen
...
windows/ui_windows_test.v:344:3: error: unknown function: menu_update_window
windows/ui_windows_test.v:356:10: error: unknown function: native_window_handle

Both lines fail, the first because of chart.v (reported separately) and the
second as described here. Reproduced on a clean ce4af81 with the official
0.5.2 release binaries that ci.yml pins.

Cause

V resolves a module's root directory from the directory of the input file, not
from v.mod. ui2's v.mod declares:

Module {
	name: 'ui2'
	subdirs: ['ui', 'appkit', 'uikit', 'windows', 'linux']
}

but that does not bring the sibling directories into the compilation when the
input file is inside one of them. So:

  • a test under ui/ compiles ui/*.v and cannot see windows/*.v — hence
    unknown function: menu_win32_set_menu_bar in ui/menu_windows.c.v, which
    calls into windows/menu_windows.v;
  • a test under windows/ compiles windows/*.v and cannot see ui/*.v —
    hence every unknown type ui2.KeyCode / ui2.Kind / ui2.Element above.

Pointing at the module root instead does work:

$ v -enable-globals -shared -os windows -check .   # whole module, all directories

and a test file placed at the repository root sees both sides at once. That is
why the tests in #54–#57 live in embed_test.v and menu_tray_test.v at the
root rather than beside the code.

Affected files

Every *_test.v under a subdirectory:

  • ui/menu_test.v — compiles on -os linux/-os android, fails on
    -os windows because ui/menu_windows.c.v calls into windows/
  • windows/ui_windows_test.v — fails on every host
  • ui/ui_custom_test.v — fails on every host, and separately does not parse on
    0.5.2 at all: map[string]bool{ 'field': true } (line 44 on master) is
    rejected with explicit map initialization does not support parameters

Note that ci.yml only runs ui/vml_menu_test.v, ui/ui_scroll_immediate_test.v
and examples/build_examples.vsh, which is why this has gone unnoticed: CI
never compiles windows/ui_windows_test.v or ui/menu_test.v, and make test
(v test .) sweeps all 138 test files including the macOS-only ones, so it is
not usable as a single green/red signal on Windows either.

Options

I don't have a strong opinion on which is right, and this is the maintainer's
call. Some possibilities:

  1. Move the affected test files to the module root, where they compile. This is
    what Add native_window_handle for embedders, publish real NSWindow on macOS #54–Cover vails menu and tray scenarios on the Windows backend #57 do for their own tests.
  2. Add the subdirectories to the module's compilation another way, if V has a
    mechanism I have not found.
  3. Accept it and only run these through -check from the root, as
    make check-windows already tries to do for its first line.

Whichever way it goes, make check-windows should be green before it can be
used as a gate. I can help with any of these — just say which.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions