Skip to content

Commit ebf0a32

Browse files
Multiple MSVC related fixes (#3623)
* skip test * fix test * update tests to accept both old and new values * include vc redist in MSI
1 parent 2cf8fa1 commit ebf0a32

File tree

4 files changed

+103
-41
lines changed

4 files changed

+103
-41
lines changed

installer/Product.wxs

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ SPDX-License-Identifier: MIT
2020
<RegistrySearch Id="FindInstallLocation" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[WIX_UPGRADE_DETECTED]" Name="InstallLocation" Type="raw" Win64="yes" />
2121
</Property>
2222

23-
<!-- Install preconditions -->
24-
<Property Id="VC_REDIST_INSTALLED" Secure="yes">
25-
<RegistrySearch Id="VC_REDIST_RegKey" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\X64" Name="Version"/>
26-
</Property>
27-
<Condition Message="This setup requires the 'VC++ Redistributable' v14.x to be installed. Please install it the from: https://aka.ms/vs/17/release/vc_redist.x64.exe">
28-
Installed OR VC_REDIST_INSTALLED
29-
</Condition>
30-
3123
<!-- Define the Product features and installation steps -->
3224
<Feature Id="ProductFeature" Title="eBPF for Windows Installer" ConfigurableDirectory="INSTALLFOLDER" Display="expand" Level="1" Absent="disallow" AllowAdvertise="no" InstallDefault="local" TypicalDefault="install" >
3325
<Feature Id="eBPF_Runtime_Components" Level="1" Title="Runtime Components" Absent="disallow" Display="expand" AllowAdvertise="no" >
@@ -46,6 +38,11 @@ SPDX-License-Identifier: MIT
4638
</Feature>
4739
<?endif?>
4840
<?endif?>
41+
<?if $(var.IncludeVCRedist) = True ?>
42+
<Feature Id="VCRedist" Title="VC++ Redistributable" Level="11" Absent="disallow" AllowAdvertise="no" >
43+
<ComponentGroupRef Id="VCRedist" />
44+
</Feature>
45+
<?endif?>
4946
</Feature>
5047
</Feature>
5148

@@ -114,51 +111,83 @@ SPDX-License-Identifier: MIT
114111

115112
<!-- Define the product's <Runtime> components -->
116113
<Fragment>
114+
<?if $(var.IncludeVCRedist) = True ?>
115+
<ComponentGroup Id="VCRedist" Directory="INSTALLFOLDER">
116+
<Component Id="concrt140" Guid="{BA96F793-1D16-4277-B12B-7588BC2E647A}">
117+
<File Id="concrt140.dll" Name="concrt140.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\concrt140.dll" />
118+
</Component>
119+
<Component Id="msvcp140" Guid="{225C690D-C9B9-4F6C-B422-6579380E3A41}">
120+
<File Id="msvcp140.dll" Name="msvcp140.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\msvcp140.dll" />
121+
</Component>
122+
<Component Id="msvcp140_1" Guid="{32C5D7C0-43CA-469E-A712-5A7ED0C18F68}">
123+
<File Id="msvcp140_1.dll" Name="msvcp140_1.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\msvcp140_1.dll" />
124+
</Component>
125+
<Component Id="msvcp140_2" Guid="{CD0CB411-69A8-427F-B775-B1C0BB269D2A}">
126+
<File Id="msvcp140_2.dll" Name="msvcp140_2.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\msvcp140_2.dll" />
127+
</Component>
128+
<Component Id="msvcp140_atomic_wait" Guid="{EDD2FCE1-0A0C-4DF0-A935-6A917BEC8FD2}">
129+
<File Id="msvcp140_atomic_wait.dll" Name="msvcp140_atomic_wait.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\msvcp140_atomic_wait.dll" />
130+
</Component>
131+
<Component Id="msvcp140_codecvt_ids" Guid="{ED0E8435-4D52-4801-81A5-E4EF0DFA9CA7}">
132+
<File Id="msvcp140_codecvt_ids.dll" Name="msvcp140_codecvt_ids.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\msvcp140_codecvt_ids.dll" />
133+
</Component>
134+
<Component Id="vccorlib140" Guid="{D1B5ADB1-10BB-491C-B10E-8B5445D71484}">
135+
<File Id="vccorlib140.dll" Name="vccorlib140.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\vccorlib140.dll" />
136+
</Component>
137+
<Component Id="vcruntime140" Guid="{96C01CAE-A895-463D-B090-7E15DD03724E}">
138+
<File Id="vcruntime140.dll" Name="vcruntime140.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\vcruntime140.dll" />
139+
</Component>
140+
<Component Id="vcruntime140_1" Guid="{2EC40012-1B68-4DAB-91B9-6B4190B4EB6D}">
141+
<File Id="vcruntime140_1.dll" Name="vcruntime140_1.dll" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)x64\$(var.Configuration)\vcruntime140_1.dll" />
142+
</Component>
143+
</ComponentGroup>
144+
<?endif?>
145+
117146
<ComponentGroup Id="eBPF_Runtime_Components" Directory="INSTALLFOLDER">
118147
<Component Id ="eBpfPATH" Guid="{C062B980-4B93-4FC7-A4F9-A751C2B419FD}" KeyPath="yes">
119148
<Environment Id="eBpfPATH" Name="PATH" Value="[INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="yes" Separator=";" />
120149
</Component>
121150
<Component Id="LICENSE" Guid="{AF22EAE5-7D8D-4F22-BB64-6B6A079A2947}">
122-
<File Id="LICENSE.txt" Name="LICENSE.txt" DiskId="1" Source="$(var.SolutionDir)LICENSE.txt" />
151+
<File Id="LICENSE.txt" Name="LICENSE.txt" DiskId="1" KeyPath="yes" Source="$(var.SolutionDir)LICENSE.txt" />
123152
</Component>
124153
<Component Id="BPF2C.EXE" DiskId="1" Guid="{BD23322B-91C3-4848-96E0-04E3745411E1}">
125-
<File Id="BPF2C.EXE" Name="bpf2c.exe" Source="$(var.bpf2c.TargetDir)bpf2c.exe" />
154+
<File Id="BPF2C.EXE" Name="bpf2c.exe" KeyPath="yes" Source="$(var.bpf2c.TargetDir)bpf2c.exe" />
126155
</Component>
127156
<Component Id="BPF2C.PDB" DiskId="1" Guid="{6DEC471C-F27D-431C-A0E0-6F46CA472BAC}">
128-
<File Id="BPF2C.PDB" Name="bpf2c.pdb" Source="$(var.bpf2c.TargetDir)bpf2c.pdb" />
157+
<File Id="BPF2C.PDB" Name="bpf2c.pdb" KeyPath="yes" Source="$(var.bpf2c.TargetDir)bpf2c.pdb" />
129158
</Component>
130159
<Component Id="EBPF_ALL.GUID" DiskId="1" Guid="{F3C808AC-A63B-4A29-B110-00B5A903F3C9}">
131-
<File Id="EBPF_ALL.GUID" Name="ebpf-all.guid" Source="$(var.SolutionDir)\scripts\ebpf-all.guid" />
160+
<File Id="EBPF_ALL.GUID" Name="ebpf-all.guid" KeyPath="yes" Source="$(var.SolutionDir)\scripts\ebpf-all.guid" />
132161
</Component>
133162
<Component Id="BPFTOOL.EXE" DiskId="1" Guid="{E168EB1A-35F6-47E3-B977-B16DF7DFBDB0}">
134-
<File Id="BPFTOOL.EXE" Name="bpftool.exe" Source="$(var.bpftool.TargetDir)bpftool.exe" />
163+
<File Id="BPFTOOL.EXE" Name="bpftool.exe" KeyPath="yes" Source="$(var.bpftool.TargetDir)bpftool.exe" />
135164
</Component>
136165
<Component Id="BPFTOOL.PDB" DiskId="1" Guid="{D2A6D747-A52C-43B9-A684-FF05A0DCE166}">
137-
<File Id="BPFTOOL.PDB" Name="bpftool.pdb" Source="$(var.bpftool.TargetDir)bpftool.pdb" />
166+
<File Id="BPFTOOL.PDB" Name="bpftool.pdb" KeyPath="yes" Source="$(var.bpftool.TargetDir)bpftool.pdb" />
138167
</Component>
139168
<Component Id="EBPFAPI.DLL" DiskId="1" Guid="{C44E4B08-901E-4B71-8FD1-F0B3D11D063F}">
140-
<File Id="EBPFAPI.DLL" Name="EbpfApi.dll" Source="$(var.EbpfApi.TargetDir)EbpfApi.dll" />
169+
<File Id="EBPFAPI.DLL" Name="EbpfApi.dll" KeyPath="yes" Source="$(var.EbpfApi.TargetDir)EbpfApi.dll" />
141170
</Component>
142171
<Component Id="EBPFAPI.PDB" DiskId="1" Guid="{6912E957-E682-41CB-9C53-1D0B886528F7}">
143-
<File Id="EBPFAPI.PDB" Name="EbpfApi.pdb" Source="$(var.EbpfApi.TargetDir)EbpfApi.pdb" />
172+
<File Id="EBPFAPI.PDB" Name="EbpfApi.pdb" KeyPath="yes" Source="$(var.EbpfApi.TargetDir)EbpfApi.pdb" />
144173
</Component>
145174
<Component Id="EBPF_PRINTK.GUID" DiskId="1" Guid="{77EB156D-046E-4BD6-8F57-CCA1DB031B0B}">
146-
<File Id="EBPF_PRINTK.GUID" Name="ebpf-printk.guid" Source="$(var.SolutionDir)\scripts\ebpf-printk.guid" />
175+
<File Id="EBPF_PRINTK.GUID" Name="ebpf-printk.guid" KeyPath="yes" Source="$(var.SolutionDir)\scripts\ebpf-printk.guid" />
147176
</Component>
148177
<Component Id="EBPFFORWINDOWS.WPRP" DiskId="1" Guid="{4E4838D3-0C49-4FA2-B8EE-E484CC0E7FA9}">
149-
<File Id="EBPFFORWINDOWS.WPRP" Name="ebpfforwindows.wprp" Source="$(var.SolutionDir)\scripts\ebpfforwindows.wprp" />
178+
<File Id="EBPFFORWINDOWS.WPRP" Name="ebpfforwindows.wprp" KeyPath="yes" Source="$(var.SolutionDir)\scripts\ebpfforwindows.wprp" />
150179
</Component>
151180
<Component Id="EBPFNETSH.DLL" DiskId="1" Guid="{95928460-8560-448F-83C3-E9040BECCF5D}">
152-
<File Id="EBPFNETSH.DLL" Name="ebpfnetsh.dll" Source="$(var.ebpfnetsh.TargetDir)ebpfnetsh.dll" />
181+
<File Id="EBPFNETSH.DLL" Name="ebpfnetsh.dll" KeyPath="yes" Source="$(var.ebpfnetsh.TargetDir)ebpfnetsh.dll" />
153182
</Component>
154183
<Component Id="EBPFNETSH.PDB" DiskId="1" Guid="{D0FB50BF-8822-4197-B3CF-0476C357DBDD}">
155-
<File Id="EBPFNETSH.PDB" Name="ebpfnetsh.pdb" Source="$(var.ebpfnetsh.TargetDir)ebpfnetsh.pdb" />
184+
<File Id="EBPFNETSH.PDB" Name="ebpfnetsh.pdb" KeyPath="yes" Source="$(var.ebpfnetsh.TargetDir)ebpfnetsh.pdb" />
156185
</Component>
157186
<Component Id="EXPORT_PROGRAM_INFO.EXE" DiskId="1" Guid="{7AF9A30B-D7BF-4FD2-88C0-C2947ED55DCD}">
158-
<File Id="EXPORT_PROGRAM_INFO.EXE" Name="export_program_info.exe" Source="$(var.export_program_info.TargetDir)export_program_info.exe" />
187+
<File Id="EXPORT_PROGRAM_INFO.EXE" Name="export_program_info.exe" KeyPath="yes" Source="$(var.export_program_info.TargetDir)export_program_info.exe" />
159188
</Component>
160189
<Component Id="EXPORT_PROGRAM_INFO.PDB" DiskId="1" Guid="{88356FE4-6247-4876-BA14-42EDA88CC5C7}">
161-
<File Id="EXPORT_PROGRAM_INFO.PDB" Name="export_program_info.pdb" Source="$(var.export_program_info.TargetDir)export_program_info.pdb" />
190+
<File Id="EXPORT_PROGRAM_INFO.PDB" Name="export_program_info.pdb" KeyPath="yes" Source="$(var.export_program_info.TargetDir)export_program_info.pdb" />
162191
</Component>
163192
</ComponentGroup>
164193

installer/ebpf-for-windows.wixproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ SPDX-License-Identifier: MIT
2020
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
2121
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\</OutputPath>
2222
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
23-
<DefineConstants>Debug;IncludeJIT=True</DefineConstants>
23+
<DefineConstants>Debug;IncludeJIT=True;IncludeVCRedist=False</DefineConstants>
2424
<SuppressValidation>True</SuppressValidation>
2525
</PropertyGroup>
2626
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'NativeOnlyDebug|x64' ">
2727
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\</OutputPath>
2828
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
29-
<DefineConstants>Debug;IncludeJIT=False</DefineConstants>
29+
<DefineConstants>Debug;IncludeJIT=False;IncludeVCRedist=False</DefineConstants>
3030
<SuppressValidation>True</SuppressValidation>
3131
</PropertyGroup>
3232
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
@@ -35,13 +35,15 @@ SPDX-License-Identifier: MIT
3535
<DefineConstants Condition=" '$(ReleaseJIT)' == 'True' ">IncludeJIT=True</DefineConstants>
3636
<DefineConstants Condition=" '$(ReleaseJIT)' == 'False' OR '$(ReleaseJIT)' == '' ">IncludeJIT=False</DefineConstants>
3737
<SuppressValidation>True</SuppressValidation>
38+
<DefineConstants>$(DefineConstants);IncludeVCRedist=True</DefineConstants>
3839
</PropertyGroup>
3940
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'NativeOnlyRelease|x64' ">
4041
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\</OutputPath>
4142
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
4243
<DefineConstants Condition=" '$(ReleaseJIT)' == 'True' ">IncludeJIT=True</DefineConstants>
4344
<DefineConstants Condition=" '$(ReleaseJIT)' == 'False' OR '$(ReleaseJIT)' == '' ">IncludeJIT=False</DefineConstants>
4445
<SuppressValidation>True</SuppressValidation>
46+
<DefineConstants>$(DefineConstants);IncludeVCRedist=True</DefineConstants>
4547
</PropertyGroup>
4648
<!-- In accordance to what defined in sample.vcxproj, the MSI build is disabled for the 'Analysis' CI/CD build, as it does not generate the *.o artifacts. -->
4749
<ItemGroup Condition="'$(Analysis)'==''">

scripts/check_msi_installation_files_nativeonly_release.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,13 @@ C:\Program Files\ebpf-for-windows\drivers\eBPFCore.pdb
1717
C:\Program Files\ebpf-for-windows\drivers\eBPFCore.sys
1818
C:\Program Files\ebpf-for-windows\drivers\NetEbpfExt.inf
1919
C:\Program Files\ebpf-for-windows\drivers\NetEbpfExt.pdb
20-
C:\Program Files\ebpf-for-windows\drivers\NetEbpfExt.sys
20+
C:\Program Files\ebpf-for-windows\drivers\NetEbpfExt.sys
21+
C:\Program Files\ebpf-for-windows\concrt140.dll
22+
C:\Program Files\ebpf-for-windows\msvcp140.dll
23+
C:\Program Files\ebpf-for-windows\msvcp140_1.dll
24+
C:\Program Files\ebpf-for-windows\msvcp140_2.dll
25+
C:\Program Files\ebpf-for-windows\msvcp140_atomic_wait.dll
26+
C:\Program Files\ebpf-for-windows\msvcp140_codecvt_ids.dll
27+
C:\Program Files\ebpf-for-windows\vccorlib140.dll
28+
C:\Program Files\ebpf-for-windows\vcruntime140.dll
29+
C:\Program Files\ebpf-for-windows\vcruntime140_1.dll

tests/end_to_end/netsh_test.cpp

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -280,26 +280,48 @@ TEST_CASE("show sections tail_call_multiple_um.dll", "[netsh][sections]")
280280
std::string output =
281281
_run_netsh_command(handle_ebpf_show_sections, L"tail_call_multiple_um.dll", nullptr, nullptr, &result);
282282
REQUIRE(result == NO_ERROR);
283-
const std::string expected_output = "\n"
284-
" Size\n"
285-
" Section Program Type (bytes)\n"
286-
"==================== ====================== ========= =======\n"
283+
284+
// Issue #3610: Different MSVC versions expect different numbers of bytes for the same program.
285+
// As a workaround, check for both the expected outputs.
286+
const std::string expected_output_old = "\n"
287+
" Size\n"
288+
" Section Program Type (bytes)\n"
289+
"==================== ====================== ========= =======\n"
287290
#if defined(NDEBUG)
288-
" sample_ext/0 callee0 sample 73\n"
289-
" sample_ext/1 callee1 sample 6\n"
290-
" sample_ext caller sample 73\n"
291+
" sample_ext/0 callee0 sample 73\n"
292+
" sample_ext/1 callee1 sample 6\n"
293+
" sample_ext caller sample 73\n"
291294
#else
292-
" sample_ext/0 callee0 sample 413\n"
293-
" sample_ext/1 callee1 sample 190\n"
294-
" sample_ext caller sample 413\n"
295+
" sample_ext/0 callee0 sample 413\n"
296+
" sample_ext/1 callee1 sample 190\n"
297+
" sample_ext caller sample 413\n"
295298
#endif
296-
"\n"
297-
" Key Value Max\n"
298-
" Map Type Size Size Entries Name\n"
299-
"================== ==== ===== ======= ========\n"
300-
" prog_array 4 4 10 map\n";
299+
"\n"
300+
" Key Value Max\n"
301+
" Map Type Size Size Entries Name\n"
302+
"================== ==== ===== ======= ========\n"
303+
" prog_array 4 4 10 map\n";
304+
305+
const std::string expected_output_new = "\n"
306+
" Size\n"
307+
" Section Program Type (bytes)\n"
308+
"==================== ====================== ========= =======\n"
309+
#if defined(NDEBUG)
310+
" sample_ext/0 callee0 sample 75\n"
311+
" sample_ext/1 callee1 sample 6\n"
312+
" sample_ext caller sample 73\n"
313+
#else
314+
" sample_ext/0 callee0 sample 413\n"
315+
" sample_ext/1 callee1 sample 190\n"
316+
" sample_ext caller sample 413\n"
317+
#endif
318+
"\n"
319+
" Key Value Max\n"
320+
" Map Type Size Size Entries Name\n"
321+
"================== ==== ===== ======= ========\n"
322+
" prog_array 4 4 10 map\n";
301323

302-
REQUIRE(output == expected_output);
324+
REQUIRE((output == expected_output_old || output == expected_output_new));
303325
}
304326

305327
// Test a .sys file with multiple programs, including ones with long names.

0 commit comments

Comments
 (0)