Group all 69 projects into category subfolders under src/ and tests/ so the Rider Solution Explorer mirrors the module structure. Folders: Core, Server, Drivers (with a nested Driver CLIs subfolder), Client, Tooling. - Move every project folder on disk with git mv (history preserved as renames). - Recompute relative paths in 57 .csproj files: cross-category ProjectReferences, the lib/ HintPath+None refs in Driver.Historian.Wonderware, and the external mxaccessgw refs in Driver.Galaxy and its test project. - Rebuild ZB.MOM.WW.OtOpcUa.slnx with nested solution folders. - Re-prefix project paths in functional scripts (e2e, compliance, smoke SQL, integration, install). Build green (0 errors); unit tests pass. Docs left for a separate pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
100 lines
3.4 KiB
PowerShell
100 lines
3.4 KiB
PowerShell
#Requires -Version 7.0
|
|
<#
|
|
.SYNOPSIS
|
|
End-to-end CLI test for the TwinCAT (Beckhoff ADS) driver.
|
|
|
|
.DESCRIPTION
|
|
Requires a reachable AMS router (local TwinCAT XAR, Beckhoff.TwinCAT.Ads.
|
|
TcpRouter NuGet, or an authorised remote AMS route) + a live TwinCAT
|
|
runtime on -AmsNetId. Without one the driver surfaces a transport error
|
|
on InitializeAsync + the script's probe fails.
|
|
|
|
Set TWINCAT_TRUST_WIRE=1 to promise the endpoint is live. Without it the
|
|
script skips (task #221 tracks the 7-day-trial CI fixture — until that
|
|
lands, TwinCAT testing is a manual operator task).
|
|
|
|
.PARAMETER AmsNetId
|
|
AMS Net ID of the target (e.g. 127.0.0.1.1.1 for local XAR,
|
|
192.168.1.40.1.1 for a remote PLC).
|
|
|
|
.PARAMETER AmsPort
|
|
AMS port. Default 851 (TC3 PLC runtime). TC2 uses 801.
|
|
|
|
.PARAMETER SymbolPath
|
|
TwinCAT symbol to exercise. Default 'MAIN.iCounter' — substitute with
|
|
whatever your project actually declares.
|
|
|
|
.PARAMETER OpcUaUrl
|
|
OtOpcUa server endpoint.
|
|
|
|
.PARAMETER BridgeNodeId
|
|
NodeId at which the server publishes the Symbol.
|
|
#>
|
|
|
|
param(
|
|
[string]$AmsNetId = "127.0.0.1.1.1",
|
|
[int]$AmsPort = 851,
|
|
[string]$SymbolPath = "MAIN.iCounter",
|
|
[string]$OpcUaUrl = "opc.tcp://localhost:4840",
|
|
[Parameter(Mandatory)] [string]$BridgeNodeId
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
. "$PSScriptRoot/_common.ps1"
|
|
|
|
if (-not ($env:TWINCAT_TRUST_WIRE -eq "1" -or $env:TWINCAT_TRUST_WIRE -eq "true")) {
|
|
Write-Skip "TWINCAT_TRUST_WIRE not set — requires reachable AMS router + live TC runtime (task #221 tracks the CI fixture). Set =1 once the router is up."
|
|
exit 0
|
|
}
|
|
|
|
$twinCatCli = Get-CliInvocation `
|
|
-ProjectFolder "src/Drivers/Cli/ZB.MOM.WW.OtOpcUa.Driver.TwinCAT.Cli" `
|
|
-ExeName "otopcua-twincat-cli"
|
|
$opcUaCli = Get-CliInvocation `
|
|
-ProjectFolder "src/Client/ZB.MOM.WW.OtOpcUa.Client.CLI" `
|
|
-ExeName "otopcua-cli"
|
|
|
|
$commonTc = @("-n", $AmsNetId, "-p", $AmsPort)
|
|
$results = @()
|
|
|
|
$results += Test-Probe `
|
|
-Cli $twinCatCli `
|
|
-ProbeArgs (@("probe") + $commonTc + @("-s", $SymbolPath, "--type", "DInt"))
|
|
|
|
$writeValue = Get-Random -Minimum 1 -Maximum 9999
|
|
$results += Test-DriverLoopback `
|
|
-Cli $twinCatCli `
|
|
-WriteArgs (@("write") + $commonTc + @("-s", $SymbolPath, "-t", "DInt", "-v", $writeValue)) `
|
|
-ReadArgs (@("read") + $commonTc + @("-s", $SymbolPath, "-t", "DInt")) `
|
|
-ExpectedValue "$writeValue"
|
|
|
|
$bridgeValue = Get-Random -Minimum 10000 -Maximum 19999
|
|
$results += Test-ServerBridge `
|
|
-DriverCli $twinCatCli `
|
|
-DriverWriteArgs (@("write") + $commonTc + @("-s", $SymbolPath, "-t", "DInt", "-v", $bridgeValue)) `
|
|
-OpcUaCli $opcUaCli `
|
|
-OpcUaUrl $OpcUaUrl `
|
|
-OpcUaNodeId $BridgeNodeId `
|
|
-ExpectedValue "$bridgeValue"
|
|
|
|
$reverseValue = Get-Random -Minimum 20000 -Maximum 29999
|
|
$results += Test-OpcUaWriteBridge `
|
|
-OpcUaCli $opcUaCli `
|
|
-OpcUaUrl $OpcUaUrl `
|
|
-OpcUaNodeId $BridgeNodeId `
|
|
-DriverCli $twinCatCli `
|
|
-DriverReadArgs (@("read") + $commonTc + @("-s", $SymbolPath, "-t", "DInt")) `
|
|
-ExpectedValue "$reverseValue"
|
|
|
|
$subValue = Get-Random -Minimum 30000 -Maximum 39999
|
|
$results += Test-SubscribeSeesChange `
|
|
-OpcUaCli $opcUaCli `
|
|
-OpcUaUrl $OpcUaUrl `
|
|
-OpcUaNodeId $BridgeNodeId `
|
|
-DriverCli $twinCatCli `
|
|
-DriverWriteArgs (@("write") + $commonTc + @("-s", $SymbolPath, "-t", "DInt", "-v", $subValue)) `
|
|
-ExpectedValue "$subValue"
|
|
|
|
Write-Summary -Title "TwinCAT e2e" -Results $results
|
|
if ($results | Where-Object { -not $_.Passed }) { exit 1 }
|