Skip to content

Commit

Permalink
Fix hanging test in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
andfoy committed Jan 19, 2022
1 parent e9a0cc6 commit da58d85
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 42 deletions.
82 changes: 41 additions & 41 deletions .github/workflows/windows_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,54 +52,54 @@ jobs:
- name: Install winpty
shell: bash -l {0}
run: conda install -y winpty
# - name: Cargo lint
# if: ${{ matrix.RUST_TOOLCHAIN == 'stable' }}
# shell: bash -l {0}
# run: cargo clippy
- name: Cargo lint
if: ${{ matrix.RUST_TOOLCHAIN == 'stable' }}
shell: bash -l {0}
run: cargo clippy
- name: Cargo build
shell: bash -l {0}
run: cargo build -vv --features conpty --features winpty
- name: Set LLVM_PROFILE_FILE
if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
shell: bash -l {0}
run: echo "LLVM_PROFILE_FILE=winpty_rs-%p-%m.profraw" >> $GITHUB_ENV
# - name: Cargo test
# shell: bash -l {0}
# run: cargo test --features conpty --features winpty
# - name: Gather test coverage
# if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
# shell: bash -l {0}
# run: |
# grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
# ls
# - name: Upload coverage results
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# files: ./lcov.info # optional
# flags: unittests # optional
# verbose: true # optional (default = false)
- name: Cargo test
shell: bash -l {0}
run: cargo test --features conpty --features winpty
- name: Gather test coverage
if: ${{ matrix.RUST_TOOLCHAIN == 'nightly' }}
shell: bash -l {0}
run: |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
ls
- name: Upload coverage results
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./lcov.info # optional
flags: unittests # optional
verbose: true # optional (default = false)
# fail_ci_if_error: true # optional (default = false)
# name: codecov-umbrella # optional
# Enable this to get RDP access to the worker.
- name: Download
# if: ${{ failure() }}
run: Invoke-WebRequest https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip -OutFile ngrok.zip
- name: Extract
# if: ${{ failure() }}
run: Expand-Archive ngrok.zip
- name: Auth
# if: ${{ failure() }}
run: .\ngrok\ngrok.exe authtoken 1raaG4z7gsaCRlLw8cRkUWW6ItF_2LWTUFxXwd6UeeJNAAAci
- name: Enable TS
# if: ${{ failure() }}
run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
- run: Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
# if: ${{ failure() }}
- run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1
# if: ${{ failure() }}
- run: Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "P@ssw0rd!" -Force)
# if: ${{ failure() }}
- name: Create Tunnel
# if: ${{ failure() }}
run: .\ngrok\ngrok.exe tcp 3389
# - name: Download
# if: ${{ failure() }}
# run: Invoke-WebRequest https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-windows-amd64.zip -OutFile ngrok.zip
# - name: Extract
# if: ${{ failure() }}
# run: Expand-Archive ngrok.zip
# - name: Auth
# if: ${{ failure() }}
# run: .\ngrok\ngrok.exe authtoken <ngrok token>
# - name: Enable TS
# if: ${{ failure() }}
# run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0
# - run: Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
# if: ${{ failure() }}
# - run: Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1
# if: ${{ failure() }}
# - run: Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "P@ssw0rd!" -Force)
# if: ${{ failure() }}
# - name: Create Tunnel
# if: ${{ failure() }}
# run: .\ngrok\ngrok.exe tcp 3389
8 changes: 7 additions & 1 deletion tests/conpty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ fn read_write_conpty() {
let mut pty = PTY::new_with_backend(&pty_args, PTYBackend::ConPTY).unwrap();
pty.spawn(appname, None, None, None).unwrap();

let regex = Regex::new(r".*Microsoft Windows.*").unwrap();
let mut re_pattern: &str = r".*Microsoft Windows.*";

if env::var_os("CI").is_some() {
re_pattern = ".*cmd.*"
}

let regex = Regex::new(re_pattern).unwrap();
let mut output_str = "";
let mut out: OsString;

Expand Down

0 comments on commit da58d85

Please sign in to comment.