add large interleaved stdout/stderr integration tests for win_shell/win_command

This commit is contained in:
Matt Davis 2016-10-25 16:06:57 -07:00
parent f8482e335c
commit c1b7d2e560
2 changed files with 18 additions and 12 deletions

View file

@ -124,11 +124,14 @@
- cmdout|failed
- cmdout.rc == 254
- name: write large buffer to stdout
win_command: powershell /c "$ba = New-Object byte[] 16384; (New-Object System.Random 32).NextBytes($ba); [Convert]::ToBase64String($ba) | Write-Output"
- name: interleave large writes between stdout/stderr (check for buffer consumption deadlock)
win_command: powershell /c "$ba = New-Object byte[] 4096; (New-Object System.Random 32).NextBytes($ba); $text = [Convert]::ToBase64String($ba); Write-Output startout; Write-Error starterror; Write-Error $text; Write-Output $text; Write-Error $text; Write-Output $text; Write-Error $text; Write-Output $text; Write-Output doneout Write-Error doneerror"
register: cmdout
# TODO: fix small buffer deadlock on large write to stderr before stdout has been consumed
#- name: write large buffer to stderr
# win_shell: $ba = New-Object byte[] 16384; (New-Object System.Random 32).NextBytes($ba); [Convert]::ToBase64String($ba) | Write-Error; Write-Output test
# register: cmdout
- name: ensure that the entirety of both streams were read
assert:
that:
- cmdout.stdout is search("startout")
- cmdout.stdout is search("doneout")
- cmdout.stderr is search("starterror")
- cmdout.stderr is search("doneerror")

View file

@ -165,11 +165,14 @@
- shellout.stdout_lines == ["line1 ", "line2"]
- shellout.stderr == ""
- name: write large buffer to stdout
win_shell: $ba = New-Object byte[] 16384; (New-Object System.Random 32).NextBytes($ba); [Convert]::ToBase64String($ba) | Write-Output
- name: interleave large writes between stdout/stderr (check for buffer consumption deadlock)
win_shell: $ba = New-Object byte[] 4096; (New-Object System.Random 32).NextBytes($ba); $text = [Convert]::ToBase64String($ba); Write-Output startout; Write-Error starterror; Write-Error $text; Write-Output $text; Write-Error $text; Write-Output $text; Write-Error $text; Write-Output $text; Write-Output doneout Write-Error doneerror
register: shellout
# TODO: fix small buffer deadlock on large write to stderr before stdout has been consumed
#- name: write large buffer to stderr
# win_shell: $ba = New-Object byte[] 16384; (New-Object System.Random 32).NextBytes($ba); [Convert]::ToBase64String($ba) | Write-Error; Write-Output test
# register: shellout
- name: ensure that the entirety of both streams were read
assert:
that:
- shellout.stdout is search("startout")
- shellout.stdout is search("doneout")
- shellout.stderr is search("starterror")
- shellout.stderr is search("doneerror")