Repository navigation
Add a system for testing correlation E2E - #2071
Conversation
check-spelling-bot ReportUnrecognized words, please review:
Previously acknowledged words that are now absentactivatable amd Archs dsc Globals hackathon mytool Packagedx parametermap UWP whatifTo accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands... in a clone of the git@github.com:JohnMcPMS/winget-cli.git repository |
Flor Chacón (florelis)
left a comment
There was a problem hiding this comment.
Can you add a README or something like that for how to use the scripts?
| Remove-Item -Recurse $ResultsPath -Force | ||
| } | ||
|
|
||
| New-Item -ItemType Directory $ResultsPath > $nul |
There was a problem hiding this comment.
Nit 1: Did you mean $null?
Nit 2: You are using both > $nul and | Out-Null. Should it be consistent?
| $devVCLibsPathInSandbox = Join-Path -Path $desktopInSandbox -ChildPath (Join-Path -Path $tempFolderName -ChildPath $devVCLibsFileName) | ||
| } | ||
| else | ||
| { |
There was a problem hiding this comment.
Is something missing here?
There was a problem hiding this comment.
No, I just didn't indent the entire existing block at the time.
| --> Starting Windows Sandbox, and: | ||
| - Mounting the following directories: | ||
| - $tempFolder as read-only | ||
| - $outPath as read-write |
There was a problem hiding this comment.
Nit: Missing Dev Package and Reg File folders
| /// Checks if this package version has at least one applicable installer. | ||
| Boolean HasApplicableInstaller { get; }; | ||
|
|
||
| String Publisher { get; }; |
There was a problem hiding this comment.
Do we need to do any review for these API changes?
There was a problem hiding this comment.
Not for these simple ones, no.
| RelativePath, | ||
| // Returned in hexadecimal format | ||
| ManifestSHA256Hash, | ||
| Publisher, |
There was a problem hiding this comment.
Looks like something I'll need to use in my change for matching heuristics. 🤔
There was a problem hiding this comment.
Yes, although it just makes getting the value easier since you don't have to get all of the metadata, so it isn't really critical to move to it.
|
Why did all my comments show up twice... |
|
|
||
| $outputFileBlockerPath = Join-Path $outPath "done.txt" | ||
|
|
||
| while (-not (Test-Path $outputFileBlockerPath)) |
There was a problem hiding this comment.
I would add a timeout here. When I tried doing something similar, I saw many cases where the app would still require interaction and it would block the script until I went to click something.
I think that shouldn't happen, but it seems the msstore source doesn't always gives us the right arguments for the installers :(
| <ReadOnly>true</ReadOnly> | ||
| </MappedFolder> | ||
| <MappedFolder> | ||
| <HostFolder>$ExePath</HostFolder> |
There was a problem hiding this comment.
Seems like these need to be expanded to absolute paths for it to work.
|
|
||
| $arpCompared | Select-Object -Property * -ExcludeProperty SideIndicator | Format-Table | Out-File (Join-Path $OutputPath "ARPCompare.txt") | ||
|
|
||
| "Done" | Out-File (Join-Path $OutputPath "done.txt") |
There was a problem hiding this comment.
This won't happen if there is any error during the script, so the main one will just hang waiting for this. I don't know if that is good or bad
| Remove-Variable sandbox | ||
| } | ||
|
|
||
| Close-WindowsSandbox |
There was a problem hiding this comment.
Can you do this before line 85 where you remove the results folder?
If the script fails and the sandbox stays open, it will hold on to the results files and block removing the folder so we have to manually close the sandbox before running again.
| <Dependencies> | ||
| <!-- Minimum supported version is 1809 (October 2018 Update, aka RS5) --> | ||
| <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19033.0" /> | ||
| <PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop" MinVersion="14.0.25426.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" /> |
There was a problem hiding this comment.
Yes, it is being injected by VS anyway. This one was leading to debug needing the release package (as VS left this and injected the debug on as well).
| // Values coming from the index will always be localized/independent. | ||
| return LocIndString{ GetReferenceSource()->GetIndex().GetPropertyByManifestId(m_manifestId, property).value() }; | ||
| std::optional<std::string> optValue = GetReferenceSource()->GetIndex().GetPropertyByManifestId(m_manifestId, property); | ||
| return LocIndString{ optValue ? optValue.value() :std::string{} }; |
This change adds a few scripts, a test project, and one small product change, all around enabling end-to-end validation of our correlation between system artifacts and packages in external sources.
Change
The product change is to expose publisher on the
PackageVersionCOM object. This enables the test system to collect that data for further use, as well as allowing human verification of the correlation (if one is made).The test project uses the COM API to first install a package, then attempts to check for correlation in two ways (directions):
The primary script,
Test-CorrelationInSandbox.ps1, is based off of the sandbox test script in winget-pkgs (thanks to many people). It sets up the sandbox and initial script to run there for each package to test, then waits for a sentinel file to be created in the output location. The results of all of running the test project exe, as well as the ARP differences and winget logs are put in that output location, then the sandbox is destroyed for the next package to run.Once testing is done,
Process-CorrelationResults.ps1will take all of the results JSON files and put them intoresults.csvin the directory. If any tests failed to run, they will be infailed.csv. There are correlation columns in the CSV that can be averaged in Excel to get the correlation percentage.Microsoft Reviewers: Open in CodeFlow