Skip to content

Commit

Permalink
plcsim
Browse files Browse the repository at this point in the history
  • Loading branch information
TomKovac committed Jan 8, 2025
1 parent c1a2355 commit 7f0fe8f
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions scripts/app-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function BuildAndLoadPlc {
param (
[string]$appYamlFile,
[string]$appName,
[bool]$summaryResult
[ref]$summaryResult
)
# Check if the application folder is not empty
if (-Not ($appYamlFile))
Expand Down Expand Up @@ -536,22 +536,28 @@ function BuildAndLoadPlc {
cd $appFolder
# apax install
$result = run-command -command "apax install"
$result.output | foreach-object { write-output $_ }
if ($($result.Success) -match "True")
{
Write-Output "Command 'apax install' finished succesfully in $appFolder"
}
else
{
$result.error| foreach-object { write-output $_ }
}
# apax plcsim
$plcSimProjPath = [System.IO.Path]::GetFullPath((Join-Path -Path $appFolder -ChildPath "..\..\tools\src\PlcSimAdvancedStarter\PlcSimAdvancedStarterTool\PlcSimAdvancedStarterTool.csproj"))
$result = Start-DotNetTool -ProjectName $plcSimProjPath -Arguments "-- startplcsim -x $appName -n $plcName -t $plcIpAddress"
$result.output | foreach-object { write-output $_ }
# apax hwu
$result = Run-Command -Command "apax hwu"
$result.Output | ForEach-Object { Write-Output $_ }
if ($($result.Success) -match "True")
{
$textToWrite = ",OK"
}
else
{
$textToWrite = ",NOK"
$summaryResult = 0
$summaryResult.Value = $false
}
Write-Result -TextToWrite $textToWrite -LogFilePath $logFilePath -AppendToSameLine
# apax swfd
Expand All @@ -564,18 +570,17 @@ function BuildAndLoadPlc {
else
{
$textToWrite = ",NOK"
$summaryResult = 0
$summaryResult.Value = $false
}
Write-Result -TextToWrite $textToWrite -LogFilePath $logFilePath -AppendToSameLine
return $summaryResult
}

# Build and start HMI
function BuildAndStartHmi {
param (
[string]$appYamlFile,
[string]$appName,
[bool]$summaryResult
[ref]$summaryResult
)
# Check if the application folder is not empty
if (-Not ($appYamlFile))
Expand Down Expand Up @@ -619,7 +624,7 @@ function BuildAndStartHmi {
else
{
$textToWrite = ",NOK"
$summaryResult = 0
$summaryResult.Value = $false
}
Write-Result -TextToWrite $textToWrite -LogFilePath $logFilePath -AppendToSameLine
# get blazor projects
Expand All @@ -644,7 +649,7 @@ function BuildAndStartHmi {
else
{
$textToWrite = ",NOK"
$summaryResult = 0
$summaryResult.Value = $false
}
$result.output | foreach-object { write-output $_ }
Write-Result -TextToWrite $textToWrite -LogFilePath $logFilePath -AppendToSameLine
Expand All @@ -657,7 +662,6 @@ function BuildAndStartHmi {
}

cd $startDir
return $summaryResult
}

# Function to create the log file
Expand Down Expand Up @@ -792,7 +796,7 @@ if ($appYamls)
$createResult = CreateFile -DirectoryPath $resultPath -FileNamePrefix "test_result"

if ($createResult.Success) {
$SumaryResult = 1
$SumaryResult = $true
$logFilePath = $createResult.FilePath
Write-Result -TextToWrite "AppName,PlcHw,PlcSw,DotnetBuild,DotnetRun" -LogFilePath $logFilePath
Write-Output "Files with 'type: app':"
Expand All @@ -811,9 +815,9 @@ if ($appYamls)
###### Overrite security files
OverwriteSecurityFiles -appYamlFile $($appYaml.FilePath) -plcName $plcName
###### Build and load PLC
$SumaryResult = BuildAndLoadPlc -appYamlFile $($appYaml.FilePath) -appName $($appYaml.AppName) -logFilePath $logFilePath -summaryResult $SumaryResult
BuildAndLoadPlc -appYamlFile $($appYaml.FilePath) -appName $($appYaml.AppName) -logFilePath $logFilePath -summaryResult ([ref]$SumaryResult)
###### Build and start HMI
$SumaryResult = BuildAndStartHmi -appYamlFile $($appYaml.FilePath) -appName $($appYaml.AppName) -logFilePath $logFilePath -summaryResult $SumaryResult
BuildAndStartHmi -appYamlFile $($appYaml.FilePath) -appName $($appYaml.AppName) -logFilePath $logFilePath -summaryResult ([ref]$SumaryResult)
}
}

Expand Down

0 comments on commit 7f0fe8f

Please sign in to comment.