Skip to content

Add MSpec support #12

Open
Open

Description

@mikeblakeuk

Don't think this works with Machine Spec tests
machine/machine.specifications.runner.visualstudio#95

Activity

  1. mikeblakeuk commented on Mar 21, 2023

    @mikeblakeuk
    Author

    This is what I have so far

      - bash: |
          ulimit -a
          ulimit -s 65534 #not working to try and fix  "##[error]Argument list too long"
          totalAgents=$SYSTEM_TOTALJOBSINPHASE
          agentNumber=$SYSTEM_JOBPOSITIONINPHASE
    
          echo "Searching ${{ parameters.dll }} for ${{ parameters.testFilters }}"
          echo "Filter not used for dotnet list so some tests will be skipped in the batch"
          dotnet test ${{ parameters.dll }} --list-tests > rawTestList.txt
    
          tail -n +5 "rawTestList.txt" > testList.txt #skip headers
    
          totalTests=$(grep -c ".*" testList.txt)
    
          filterProperty="TestCase.DisplayName" #MSpec
          if [ $totalAgents -eq 0 ]; then totalAgents=1; fi
          if [ -z "$agentNumber" ]; then agentNumber=1; fi
    
          batchSize=$((totalTests/totalAgents))
    
          endAt=$(($agentNumber * $batchSize))
          startAt=$((($endAt - $batchSize) + 1))
          if [ $agentNumber -eq $totalAgents ]; then endAt=100000; fi
    
          echo "Total agents: $totalAgents"
          echo "Agent number: $agentNumber"
          echo "Total Tests: $totalTests"
          echo "Batch Size $batchSize"
          echo "Tests $startAt to $endAt (inc)"
    
          echo "Target tests:"
    
          shopt -s extglob #to trim whitespace
    
          i=$((0))
          while IFS="" read -r p || [ -n "$p" ]
          do
           i=$(($i + 1))
           if [ $i -ge $startAt ] && [ $i -le $endAt ]
           then
             targetTestName=${p##+([[:space:]])}
             echo "$i:$targetTestName"
             filter+="|${filterProperty}=${targetTestName}"
           fi
          done < testList.txt
    
          filter=${filter#"|"}
    
          echo "##vso[task.setvariable variable=targetTestsFilter]$filter"
          echo "Slicing filter condition: $filter"
  2. changed the title [-]MSpec[/-] [+]Add MSpec support[/+] on Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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