Skip to content

Commit

Permalink
test.ps1: check filesystem before and after restore
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Feb 7, 2025
1 parent 69abf72 commit e8f657d
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions tests/Imageflow.TestWebAOT/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ $scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
Set-Location $scriptPath

# Get the first argument, which is the target architecture.

$targetArchitecture = $args[0]
if ($null -eq $targetArchitecture) {
Write-Error "Target architecture not provided. Exiting."
exit 1
}


## Make a function for listing native runtime files
function List-NativeRuntimeFiles {
try{
$nativeRuntimeFiles = Get-ChildItem -Path ~/.nuget/packages/imageflow.nativeruntime.* -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Extension -in '.dll', '.so', '.dylib', '.a', '.lib' }
$nativeRuntimeFiles = $nativeRuntimeFiles | ForEach-Object { $_.FullName }

Write-Output "Native runtime files in .nuget/packages/imageflow.nativeruntime.*:"
Write-Output $nativeRuntimeFiles
} catch {
Write-Error "Failed to list native runtime files. Skipping."
}
}

# Delete/clear the publish folder, ignore errors
Remove-Item -Recurse -Force ./test-publish -ErrorAction SilentlyContinue
# bin/obj too, since issues?
Expand All @@ -22,28 +36,18 @@ Remove-Item -Recurse -Force ./obj -ErrorAction SilentlyContinue
# First, change to the ../../src directory
Set-Location ../../src/

# First, let's restore the solution
dotnet restore -v d ../tests/Imageflow.TestWebAOT/Imageflow.TestWebAOT.csproj -r $targetArchitecture

try{
# List, recursively, all files in the .nuget/packages/imageflow.nativeruntime.* directories, flattened to just files ending in .dll, .so, .dylib, .a, .lib
$nativeRuntimeFiles = Get-ChildItem -Path ~/.nuget/packages/imageflow.nativeruntime.* -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Extension -in '.dll', '.so', '.dylib', '.a', '.lib' }

# Map them to simple full paths
$nativeRuntimeFiles = $nativeRuntimeFiles | ForEach-Object { $_.FullName }

# print the files
Write-Output "Native runtime files in .nuget/packages/imageflow.nativeruntime.*:"
Write-Output $nativeRuntimeFiles
} catch {
Write-Error "Failed to list native runtime files. Skipping."
}
List-NativeRuntimeFiles

# First, let's restore the solution
dotnet restore -v normal ../tests/Imageflow.TestWebAOT/Imageflow.TestWebAOT.csproj -r $targetArchitecture

# List the native runtime files
List-NativeRuntimeFiles


# Then publish the project
dotnet publish --force -v d -c Release ../tests/Imageflow.TestWebAOT/Imageflow.TestWebAOT.csproj -o $scriptPath/test-publish -r $targetArchitecture

dotnet publish --force -v normal -c Release ../tests/Imageflow.TestWebAOT/Imageflow.TestWebAOT.csproj -o $scriptPath/test-publish -r $targetArchitecture
# if the above fails, exit with a non-zero exit code.


Expand Down

0 comments on commit e8f657d

Please sign in to comment.