<commit_before>trap {
  write-error $_
  exit 1
}

$env:GOPATH = Join-Path -Path $PWD "gopath"
$env:PATH = $env:GOPATH + "/bin;C:/go/bin;" + $env:PATH

cd $env:GOPATH/src/github.com/cloudfoundry/bosh-agent

if ((Get-Command "go.exe" -ErrorAction SilentlyContinue) -eq $null)
{
  Write-Host "Installing Go 1.6.3!"
  Invoke-WebRequest https://storage.googleapis.com/golang/go1.6.3.windows-amd64.msi -OutFile go.msi

  $p = Start-Process -FilePath "msiexec" -ArgumentList "/passive /norestart /i go.msi" -Wait -PassThru

  if($p.ExitCode -ne 0)
  {
    throw "Golang MSI installation process returned error code: $($p.ExitCode)"
  }
  Write-Host "Go is installed!"
}

# Change constant for unit test process labels to prevent collisions with
# bosh deployed Job Supervisor
$file = Join-Path -Path $PWD jobsupervisor/windows_job_supervisor.go
(Get-Content $file).replace('serviceDescription = "vcap"', 'serviceDescription = "vcap_test"') | Set-Content $file

go.exe install github.com/cloudfoundry/bosh-agent/vendor/github.com/onsi/ginkgo/ginkgo
ginkgo.exe -r -keepGoing -skipPackage="integration,vendor"
<commit_msg>Handle errors for windows unit test<commit_after>trap {
  write-error $_
  exit 1
}

$env:GOPATH = Join-Path -Path $PWD "gopath"
$env:PATH = $env:GOPATH + "/bin;C:/go/bin;" + $env:PATH

cd $env:GOPATH/src/github.com/cloudfoundry/bosh-agent

if ((Get-Command "go.exe" -ErrorAction SilentlyContinue) -eq $null)
{
  Write-Host "Installing Go 1.6.3!"
  Invoke-WebRequest https://storage.googleapis.com/golang/go1.6.3.windows-amd64.msi -OutFile go.msi

  $p = Start-Process -FilePath "msiexec" -ArgumentList "/passive /norestart /i go.msi" -Wait -PassThru

  if($p.ExitCode -ne 0)
  {
    throw "Golang MSI installation process returned error code: $($p.ExitCode)"
  }
  Write-Host "Go is installed!"
}

# Change constant for unit test process labels to prevent collisions with
# bosh deployed Job Supervisor
$file = Join-Path -Path $PWD jobsupervisor/windows_job_supervisor.go
(Get-Content $file).replace('serviceDescription = "vcap"', 'serviceDescription = "vcap_test"') | Set-Content $file

go.exe install github.com/cloudfoundry/bosh-agent/vendor/github.com/onsi/ginkgo/ginkgo
ginkgo.exe -r -keepGoing -skipPackage="integration,vendor"
if ($LastExitCode -ne 0)
{
    Write-Error $_
    exit 1
}

{'fraction_non_alphanumeric': 0.13957520589510186, 'fraction_numerical': 0.00953619419159081, 'mean_word_length': 4.269406392694064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '475679', 'n_tokens_mistral': 870, 'n_tokens_neox': 827, 'n_words': 194}