From 08f1058b03f083b0b0edc2c21172014ee9e9b18a Mon Sep 17 00:00:00 2001 From: Tommy Bidne Date: Thu, 14 Mar 2024 12:16:51 +1300 Subject: [PATCH] Fix buffering functional test --- .github/workflows/ci.yaml | 49 +++++++++++++------------ test/functional/Functional/Buffering.hs | 22 +++++++---- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7985bb15..ebdc1913 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,6 +4,7 @@ on: push: branches: - main + - fix-tests pull_request: branches: @@ -37,33 +38,33 @@ jobs: - name: Compile run: cabal build lib:shrun - - name: Unit Tests - run: cabal test unit --test-options '--hedgehog-tests 100000' + # - name: Unit Tests + # run: cabal test unit --test-options '--hedgehog-tests 100000' - - name: Integration Tests - run: cabal test integration + # - name: Integration Tests + # run: cabal test integration - name: Functional Tests - run: cabal test functional - - - name: Benchmarks - if: ${{ matrix.os == 'ubuntu-latest' }} - id: bench - run: | - cabal bench --benchmark-options ' - --csv benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv - --svg benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg - --baseline benchmarks/baseline_${{ matrix.os }}_${{ matrix.ghc }}_ci.csv - --fail-if-slower 50 - --fail-if-faster 50' - - - uses: actions/upload-artifact@v3 - if: ${{ failure() && steps.bench.conclusion == 'failure' }} - with: - name: build-artifacts - path: | - benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv - benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg + run: cabal test functional --test-options '-p Buffering' + + # - name: Benchmarks + # if: ${{ matrix.os == 'ubuntu-latest' }} + # id: bench + # run: | + # cabal bench --benchmark-options ' + # --csv benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv + # --svg benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg + # --baseline benchmarks/baseline_${{ matrix.os }}_${{ matrix.ghc }}_ci.csv + # --fail-if-slower 50 + # --fail-if-faster 50' + + # - uses: actions/upload-artifact@v3 + # if: ${{ failure() && steps.bench.conclusion == 'failure' }} + # with: + # name: build-artifacts + # path: | + # benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.csv + # benchmarks/${{ matrix.os }}_${{ matrix.ghc }}_ci.svg nix: strategy: fail-fast: false diff --git a/test/functional/Functional/Buffering.hs b/test/functional/Functional/Buffering.hs index dda5625b..80523c49 100644 --- a/test/functional/Functional/Buffering.hs +++ b/test/functional/Functional/Buffering.hs @@ -21,27 +21,35 @@ logsNoBuffer = assertLogsEq expecteds results where + -- NOTE: [Bash brace loop interpolation] + -- + -- The bash loop brace syntax "for i in {0..3}" does not seem to + -- interpolate correctly with nix or on CI. The brace is interpreted + -- literally i.e. {0..3}. The manual listing of indices appears to work, + -- however args = [ "--cmd-log", "--cmd-log-strip-control=all", - "for i in {0..3}; do echo $i; sleep 1.5; done" + "--cmd-name-trunc=15", + "--no-config", + "for i in 0 1 2 3; do echo \"$i\"; sleep 1.5; done" ] -- To test that the logs are correctly streamed, we check that actual -- order of logs against the timing logs. This is a bit hacky, but the -- sleep of 1.5 makes this fairly reliable. expecteds = - [ withCommandPrefix "for i in {0...." "Starting...", - withCommandPrefix "for i in {0...." "0", + [ withCommandPrefix "for i in 0 1..." "Starting...", + withCommandPrefix "for i in 0 1..." "0", withTimerPrefix "1 second", - withCommandPrefix "for i in {0...." "1", + withCommandPrefix "for i in 0 1..." "1", withTimerPrefix "2 seconds", - withCommandPrefix "for i in {0...." "2", + withCommandPrefix "for i in 0 1..." "2", withTimerPrefix "3 seconds", withTimerPrefix "4 seconds", - withCommandPrefix "for i in {0...." "3", + withCommandPrefix "for i in 0 1..." "3", withTimerPrefix "5 seconds", - withSuccessPrefix "for i in {0...." <> "6 seconds", + withSuccessPrefix "for i in 0 1..." <> "6 seconds", withFinishedPrefix "6 seconds" ]