From da58d850e2cb30c8a9cd25a933e946105ad1693a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Wed, 19 Jan 2022 16:53:19 -0500 Subject: [PATCH] Fix hanging test in CI --- .github/workflows/windows_stable.yml | 82 ++++++++++++++-------------- tests/conpty.rs | 8 ++- 2 files changed, 48 insertions(+), 42 deletions(-) diff --git a/.github/workflows/windows_stable.yml b/.github/workflows/windows_stable.yml index 4771a08..06edeff 100644 --- a/.github/workflows/windows_stable.yml +++ b/.github/workflows/windows_stable.yml @@ -52,10 +52,10 @@ 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 @@ -63,43 +63,43 @@ jobs: 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 + # - 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 diff --git a/tests/conpty.rs b/tests/conpty.rs index e088f00..8066186 100644 --- a/tests/conpty.rs +++ b/tests/conpty.rs @@ -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;