Skip to content

RFC: api changes to extend windows support. #27

@YO4

Description

@YO4

In the PR #25 Windows CI support is in progress.
I describe here some changes needed for windows support.

CLI options

Windows has expanded console support in recent years, with multiple implementations coexisting.
To make these choices, I decided to use the CLI option.
As an example, the following is a way to specify that conhost is used, the window under test is displayed, and the failed test is not closed but left in place.
rake TESTOPTS="--windows=conhost --show-console --close-console=pass"
Additional options are follows.

yamatanooroti options
        --wait=0.01                  Specify yamatanooroti wait time in seconds.
        --timeout=2.0                Specify yamatanooroti timeout in seconds.
windows specific yamatanooroti options
        --windows=TYPE               Specify console type
                                     (ca[nary], co[nhost], l[egacy-conhost], p[review], s[table])
                                     (1.17, 1.18, 1.19, 1.20, 1.21, 1.21preview, 1.22preview)
        --wt-dir=DIR                 Specify Windows Terminal working dir.
                                     Automatically determined if not specified and treated temporary.
                                     DIR is treaded permanent if specified and download files are remains.
        --[no-]show-console          Show test ongoing console.
        --[no-]close-console[=COND]  Close test target console when COND met
                                     (a[lways], n[ever], p[ass])

Yamatanooroti API changes

The behavior of Windows conhost (aka. Command Prompt Window) changes depending on the code page settings.
Needed to support code page changes to correctly display DBCS in a CI environment.
To change the codepage before launch of the target process, the codepage must be specified in start_terminal().
Currently, it is treated as windows specific and the new settings are used only in a windows environment.
‘‘‘
def setup
if Yamatanooroti.win?
start_terminal(5, 30, ['ruby', 'bin/simple_repl'], startup_message: 'prompt>', codepage: 932)
else
start_terminal(5, 30, ['ruby', 'bin/simple_repl'], startup_message: 'prompt>')
end
end
‘‘‘
Since Yamatanooroti.win is included in the existing yamatanooroti, the changes will not affect non-Windows environments.
However, since the test code appears to be redundant, it is also a consideration to modify the vterm side to accept it as **kwargs and ignore it.

Another changes

A test-unit specific api is used to reduce signal handler invalidation by the WIN32API used and to determine window close by test results. For example, Test::Unit.at_exit testdown do; end
Since yamatanooroti is not executed in the ruby test, I have determined that this does not affect it, but I have not confirmed this.

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