Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zoneinfo data for System.Runtime.TimeZoneInfoTests #38219

Merged
merged 13 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
<Uri>https://github.com/dotnet/runtime-assets</Uri>
<Sha>629993236116221fba87fe1de6d7893dd02c3722</Sha>
</Dependency>
<Dependency Name="System.Runtime.TestData" Version="5.0.0-beta.20319.2">
<Uri>https://github.com/dotnet/runtime-assets</Uri>
<Sha>629993236116221fba87fe1de6d7893dd02c3722</Sha>
</Dependency>
<Dependency Name="System.Private.Runtime.UnicodeData" Version="5.0.0-beta.20319.2">
<Uri>https://github.com/dotnet/runtime-assets</Uri>
<Sha>629993236116221fba87fe1de6d7893dd02c3722</Sha>
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<SystemPrivateRuntimeUnicodeDataVersion>5.0.0-beta.20319.2</SystemPrivateRuntimeUnicodeDataVersion>
<SystemSecurityCryptographyX509CertificatesTestDataVersion>5.0.0-beta.20319.2</SystemSecurityCryptographyX509CertificatesTestDataVersion>
<SystemWindowsExtensionsTestDataVersion>5.0.0-beta.20319.2</SystemWindowsExtensionsTestDataVersion>
<SystemRuntimeTestDataVersion>5.0.0-beta.20319.2</SystemRuntimeTestDataVersion>
tqiu8 marked this conversation as resolved.
Show resolved Hide resolved
<!-- Standard dependencies -->
<NETStandardLibraryVersion>2.2.0-prerelease.19564.1</NETStandardLibraryVersion>
<!-- dotnet-optimization dependencies -->
Expand Down
3 changes: 2 additions & 1 deletion eng/testing/WasmRunnerTemplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ XHARNESS_OUT="$EXECUTION_DIR/xharness-output"
dotnet xharness wasm test --engine=$JAVASCRIPT_ENGINE \
--js-file=runtime.js -v \
--output-directory=$XHARNESS_OUT \
-- --enable-gc --run WasmTestRunner.dll ${@:2}
-- --enable-gc --enable-zoneinfo \
tqiu8 marked this conversation as resolved.
Show resolved Hide resolved
--run WasmTestRunner.dll ${@:2}

_exitCode=$?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@
<Compile Include="$(CommonTestPath)System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs"
Link="Common\System\Runtime\Serialization\Formatters\BinaryFormatterHelpers.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.TestData" Version="$(SystemRuntimeTestDataVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="TestLoadAssembly\TestLoadAssembly.csproj" />
<ProjectReference Include="TestCollectibleAssembly\TestCollectibleAssembly.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/mono/netcore/sample/wasm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ clean:
rm -rf bin

run:
cd bin/$(CONFIG)/publish && ~/.jsvu/v8 --expose_wasm runtime.js -- --enable-gc --run WasmSample.dll
cd bin/$(CONFIG)/publish && ~/.jsvu/v8 --expose_wasm runtime.js -- --enable-gc --enable-zoneinfo --run WasmSample.dll
safern marked this conversation as resolved.
Show resolved Hide resolved

runtimepack:
EMSDK_PATH=$(abspath $(TOP)/src/mono/wasm/emsdk) $(TOP)/build.sh -c $(CONFIG) -os Browser -arch wasm -subset Mono+Libs
21 changes: 19 additions & 2 deletions src/mono/netcore/sample/wasm/WasmSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@
Targets="Build;Publish"/>
</Target>

<UsingTask TaskName="WasmAppBuilder"
<UsingTask TaskName="WasmAppBuilder"
AssemblyFile="$(ArtifactsBinDir)WasmAppBuilder\$(Configuration)\$(NetCoreAppCurrent)\publish\WasmAppBuilder.dll"/>

<Target Name="BuildApp" DependsOnTargets="RebuildWasmAppBuilder;Build">
<ItemGroup>
<WasmFilesToIncludeInFileSystem Include="@(ContentWithTargetPath)" />
<WasmFilesToIncludeInFileSystem Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.BuildReference)' == 'true'" />
tqiu8 marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>
<ItemGroup>
<AssemblySearchPaths Include="bin"/>
<AssemblySearchPaths Include="$(MicrosoftNetCoreAppRuntimePackDir)native"/>
Expand All @@ -39,11 +43,24 @@
MicrosoftNetCoreAppRuntimePackDir="$(MicrosoftNetCoreAppRuntimePackDir)"
MainAssembly="bin\WasmSample.dll"
MainJS="$(MonoProjectRoot)wasm\runtime-test.js"
AssemblySearchPaths="@(AssemblySearchPaths)"/>
AssemblySearchPaths="@(AssemblySearchPaths)"
FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)"
/>
<Exec Command="chmod a+x $(AppDir)/run-v8.sh" />
</Target>



<ItemGroup>
<PackageReference Include="xunit" Version="2.4.0" />
tqiu8 marked this conversation as resolved.
Show resolved Hide resolved
<!-- <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> -->
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.TestData" Version="$(SystemRuntimeTestDataVersion)" />
tqiu8 marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

<ItemGroup>
<Compile Include="Program.cs" />
</ItemGroup>
</Project>

75 changes: 39 additions & 36 deletions src/mono/wasm/runtime-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ function fail_exec (reason) {
}

function inspect_object (o) {
var r = "";
for(var p in o) {
var t = typeof o[p];
r += "'" + p + "' => '" + t + "', ";
}
return r;
var r = "";
for(var p in o) {
var t = typeof o[p];
r += "'" + p + "' => '" + t + "', ";
}
return r;
}

// Preprocess arguments
Expand Down Expand Up @@ -132,7 +132,7 @@ while (true) {
args = args.slice (1);
} else if (args [0] == "--enable-zoneinfo") {
enable_zoneinfo = true;
args = args.slice (1);
args = args.slice (1);
} else {
break;
}
Expand All @@ -149,7 +149,7 @@ function writeContentToFile(content, path)
if (typeof window == "undefined")
load ("mono-config.js");

var Module = {
var Module = {
mainScriptUrlOrBlob: "dotnet.js",

print: function(x) { print ("WASM: " + x) },
Expand Down Expand Up @@ -189,6 +189,7 @@ var Module = {
{
var fullPath = directory != '/' ? directory + '/' + files[j] : files[j];
var content = new Uint8Array (read ("supportFiles/" + fullPath, 'binary'));
console.log(fullPath);
tqiu8 marked this conversation as resolved.
Show resolved Hide resolved
writeContentToFile(content, fullPath);
}
}
Expand All @@ -206,35 +207,37 @@ var Module = {
f ();
}
if (enable_zoneinfo) {
// Load the zoneinfo data into the VFS rooted at /zoneinfo
FS.mkdir("zoneinfo");
Module['FS_createPath']('/', 'zoneinfo', true, true);
Module['FS_createPath']('/zoneinfo', 'Indian', true, true);
Module['FS_createPath']('/zoneinfo', 'Atlantic', true, true);
Module['FS_createPath']('/zoneinfo', 'US', true, true);
Module['FS_createPath']('/zoneinfo', 'Brazil', true, true);
Module['FS_createPath']('/zoneinfo', 'Pacific', true, true);
Module['FS_createPath']('/zoneinfo', 'Arctic', true, true);
Module['FS_createPath']('/zoneinfo', 'America', true, true);
Module['FS_createPath']('/zoneinfo/America', 'Indiana', true, true);
Module['FS_createPath']('/zoneinfo/America', 'Argentina', true, true);
Module['FS_createPath']('/zoneinfo/America', 'Kentucky', true, true);
Module['FS_createPath']('/zoneinfo/America', 'North_Dakota', true, true);
Module['FS_createPath']('/zoneinfo', 'Australia', true, true);
Module['FS_createPath']('/zoneinfo', 'Etc', true, true);
Module['FS_createPath']('/zoneinfo', 'Asia', true, true);
Module['FS_createPath']('/zoneinfo', 'Antarctica', true, true);
Module['FS_createPath']('/zoneinfo', 'Europe', true, true);
Module['FS_createPath']('/zoneinfo', 'Mexico', true, true);
Module['FS_createPath']('/zoneinfo', 'Africa', true, true);
Module['FS_createPath']('/zoneinfo', 'Chile', true, true);
Module['FS_createPath']('/zoneinfo', 'Canada', true, true);
var zoneInfoData = read ('zoneinfo.data', 'binary');
var metadata = JSON.parse(read ("mono-webassembly-zoneinfo-fs-smd.js.metadata", 'utf-8'));
FS.mkdir("usr");
Module['FS_createPath']('/', 'usr', true, true);
FS.mkdir("share");
Module['FS_createPath']('/usr', 'share', true, true);
FS.mkdir("/usr/share/zoneinfo")
Module['FS_createPath']('/usr/share/zoneinfo', 'Indian', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Atlantic', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'US', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Brazil', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Pacific', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Arctic', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'America', true, true);
Module['FS_createPath']('/usr/share/zoneinfo/America', 'Indiana', true, true);
Module['FS_createPath']('/usr/share/zoneinfo/America', 'Argentina', true, true);
Module['FS_createPath']('/usr/share/zoneinfo/America', 'Kentucky', true, true);
Module['FS_createPath']('/usr/share/zoneinfo/America', 'North_Dakota', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Australia', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Etc', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Asia', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Antarctica', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Europe', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Mexico', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Africa', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Chile', true, true);
Module['FS_createPath']('/usr/share/zoneinfo', 'Canada', true, true);
var zoneInfoData = new Uint8Array(read ('supportFiles/zoneinfo/zoneinfo.data', 'binary'));
var metadata = JSON.parse(read ("supportFiles/zoneinfo/mono-webassembly-zoneinfo-fs-smd.js.metadata", 'utf-8'));
var files = metadata.files;
for (var i = 0; i < files.length; ++i) {
var byteArray = zoneInfoData.subarray(files[i].start, files[i].end);
writeContentToFile(byteArray, files[i].filename);
writeContentToFile(byteArray, `/usr/share${files[i].filename}`);
}
}
MONO.mono_load_runtime_and_bcl (
Expand Down Expand Up @@ -283,7 +286,7 @@ if (typeof window == "undefined")
const IGNORE_PARAM_COUNT = -1;

var App = {
init: function () {
init: function () {

var assembly_load = Module.cwrap ('mono_wasm_assembly_load', 'number', ['string'])
var find_class = Module.cwrap ('mono_wasm_assembly_find_class', 'number', ['number', 'string', 'string'])
Expand Down Expand Up @@ -400,5 +403,5 @@ var App = {
} else {
fail_exec ("Unhanded argument: " + args [0]);
}
},
},
};