aboutsummaryrefslogtreecommitdiffstats
path: root/dist/windows/appveyor/test.ps1
diff options
context:
space:
mode:
author1138-4EB <1138-4EB@users.noreply.github.com>2017-02-14 19:13:00 +0100
committertgingold <tgingold@users.noreply.github.com>2017-02-14 19:13:00 +0100
commitde9c5ceb7923a896b888656fdd1f1cd238b830e0 (patch)
tree09b247593cab5d1258b74d3dded8d3feb1e32a21 /dist/windows/appveyor/test.ps1
parentf7e455245d9d12f69e2bb8eb67a84c1961cc20f3 (diff)
downloadghdl-de9c5ceb7923a896b888656fdd1f1cd238b830e0.tar.gz
ghdl-de9c5ceb7923a896b888656fdd1f1cd238b830e0.tar.bz2
ghdl-de9c5ceb7923a896b888656fdd1f1cd238b830e0.zip
Replace travis-ci matrix with docker containers (#272)
* Extract tag declarations from <travis-ci.sh>. Rename it to <buildtest.sh> and allow to pass -b (BLD) and -f (PKG_FILE) as arguments. Save tag declarations in <travis-ci.sh>, with a different meaning now. Modify <.travis.yml> accordingly. * chmod +x ./dist/buildtest.sh. Can be removed bi changing permissions. * Replace travis builds with docker containers. ubu1404+llvm-3.5, ubu1204+llvm-3.8, ubu+mcode, fed+mcode and fed+llvm Add PKG_DTAG and SHORT_COMMIT after PKG_FILE, to avoid collisions. DOCKER_IMG used to set image to be used in docker build. <mv> is enough if the host dir is mounted in the container. Since multiple files are added, content in <dist> split to <dist/lin> and <dist/win>. Git depth set to 10 in <.travis.yml> * Fix paths lin/linux and win/windows. Remove '_compile'. Revome wrong placed old buildtest. Add conditional builds (3). Leave 2 fixed.
Diffstat (limited to 'dist/windows/appveyor/test.ps1')
-rw-r--r--dist/windows/appveyor/test.ps1118
1 files changed, 118 insertions, 0 deletions
diff --git a/dist/windows/appveyor/test.ps1 b/dist/windows/appveyor/test.ps1
new file mode 100644
index 000000000..a28186285
--- /dev/null
+++ b/dist/windows/appveyor/test.ps1
@@ -0,0 +1,118 @@
+function Restore-NativeCommandStream
+{ <#
+ .SYNOPSIS
+ This CmdLet gathers multiple ErrorRecord objects and reconstructs outputs
+ as a single line.
+
+ .DESCRIPTION
+ This CmdLet collects multiple ErrorRecord objects and emits one String
+ object per line.
+ .PARAMETER InputObject
+ A object stream is required as an input.
+ .PARAMETER Indent
+ Indentation string.
+ #>
+ [CmdletBinding()]
+ param(
+ [Parameter(ValueFromPipeline=$true)]
+ $InputObject
+ )
+
+ begin
+ { $LineRemainer = "" }
+
+ process
+ { if ($InputObject -is [System.Management.Automation.ErrorRecord])
+ { if ($InputObject.FullyQualifiedErrorId -eq "NativeCommandError")
+ { Write-Output $InputObject.ToString() }
+ elseif ($InputObject.FullyQualifiedErrorId -eq "NativeCommandErrorMessage")
+ { $NewLine = $LineRemainer + $InputObject.ToString()
+ while (($NewLinePos = $NewLine.IndexOf("`n")) -ne -1)
+ { Write-Output $NewLine.Substring(0, $NewLinePos)
+ $NewLine = $NewLine.Substring($NewLinePos + 1)
+ }
+ $LineRemainer = $NewLine
+ }
+ }
+ elseif ($InputObject -is [String])
+ { Write-Output $InputObject }
+ else
+ { Write-Host "Unsupported object in pipeline stream" }
+ }
+
+ end
+ { if ($LineRemainer -ne "")
+ { Write-Output $LineRemainer }
+ }
+}
+
+Write-Host "Run testsuites..." -Foreground Yellow
+cd "$($env:APPVEYOR_BUILD_FOLDER)\testsuite"
+# Use a MinGW compatible path
+$env:GHDL="$($env:GHDL_PREFIX_DIR)/bin/ghdl.exe"
+
+# ==============================================================================
+$TestFramework = "GNA"
+Write-Host "Running GNA tests..." -Foreground Yellow
+cd gna
+
+$Directories = dir -Directory *
+foreach ($Directory in $Directories)
+{ $TestName = "GNA test: {0}" -f $Directory.Name
+ $FileName = $Directory.Name
+
+ Write-Host $TestName -Foreground Yellow
+ cd $Directory
+ Add-AppveyorTest -Name $TestName -Framework $TestFramework -FileName $FileName -Outcome Running
+ $start = Get-Date
+ c:\msys64\usr\bin\bash.exe -c "./testsuite.sh" 2>&1 | Restore-NativeCommandStream | %{ "$_" }
+ $end = Get-Date
+ $TotalMilliseconds = ($end - $start).TotalMilliseconds
+ if ($LastExitCode -eq 0)
+ { Write-Host "PASSED" -Foreground Green
+ Update-AppveyorTest -Name $TestName -Framework $TestFramework -FileName $FileName -Outcome Passed -Duration $TotalMilliseconds
+ }
+ else
+ { Write-Host "FAILED" -Foreground Red
+ Update-AppveyorTest -Name $TestName -Framework $TestFramework -FileName $FileName -Outcome Failed -Duration $TotalMilliseconds
+ }
+}
+cd ..\..
+
+# ==============================================================================
+$TestFramework = "VESTS"
+Write-Host "Running VESTS tests..." -Foreground Yellow
+
+c:\msys64\mingw64\bin\gnatmake.exe get_entities 2>&1 | Restore-NativeCommandStream | %{ "$_" }
+
+cd vests
+
+$TestName = "VESTS test:" # {0}" -f $Directory
+$FileName = "VESTS" #$Directory
+
+Write-Host $TestName -Foreground Yellow
+# Disable vests. It works but takes ~20 min
+if ($true)
+{ Add-AppveyorTest -Name $TestName -Framework $TestFramework -FileName $FileName -Outcome Skipped
+ $start = Get-Date
+}
+else
+{ Add-AppveyorTest -Name $TestName -Framework $TestFramework -FileName $FileName -Outcome Running
+ $start = Get-Date
+ c:\msys64\usr\bin\bash.exe -c "./testsuite.sh" 2>&1 | Restore-NativeCommandStream | %{ "$_" }
+ $end = Get-Date
+ $TotalMilliseconds = ($end - $start).TotalMilliseconds
+ if ($LastExitCode -eq 0)
+ { Write-Host "PASSED" -Foreground Green
+ Update-AppveyorTest -Name $TestName -Framework $TestFramework -FileName $FileName -Outcome Passed -Duration $TotalMilliseconds
+ }
+ else
+ { Write-Host "FAILED" -Foreground Red
+ Update-AppveyorTest -Name $TestName -Framework $TestFramework -FileName $FileName -Outcome Failed -Duration $TotalMilliseconds
+ }
+ cd ..
+}
+
+# ==============================================================================
+cd $env:APPVEYOR_BUILD_FOLDER
+exit 0