Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
<!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties -->
<RunScriptCommand>$HARNESS_RUNNER wasm test --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand>
<RunScriptCommand>$HARNESS_RUNNER wasm test --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js -v --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand>
</PropertyGroup>

<!-- Generate a self-contained app bundle for Android with tests. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace System.IO.Tests
public class DirectoryInfo_Name : FileSystemTest
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/39998", TestPlatforms.Browser)]
public void CurrentDirectory()
{
var info = new DirectoryInfo(".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>

<RunTestsJSArguments>--working-dir=/test-dir</RunTestsJSArguments>
</PropertyGroup>
<ItemGroup>
<Compile Include="Base\BaseGetSetAttributes.cs" />
Expand Down Expand Up @@ -172,5 +174,8 @@
Link="Common\System\IO\TempFile.cs" />
<Compile Include="$(CommonTestPath)System\IO\PathFeatures.cs"
Link="Common\System\IO\PathFeatures.cs" />

<Content Include="DirectoryInfo\test-dir\dummy.txt"
Link="test-dir\dummy.txt" />
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions src/mono/wasm/runtime-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ setenv = {};
runtime_args = [];
enable_gc = true;
enable_zoneinfo = false;
working_dir='/';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the default working_dir generall?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried printing cwd for other tests, and it was /.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, we weren't setting it at all. And FS.cwd said /

while (args !== undefined && args.length > 0) {
if (args [0].startsWith ("--profile=")) {
var arg = args [0].substring ("--profile=".length);
Expand All @@ -140,6 +141,10 @@ while (args !== undefined && args.length > 0) {
} else if (args [0] == "--disable-on-demand-gc") {
enable_gc = false;
args = args.slice (1);
} else if (args [0].startsWith ("--working-dir=")) {
var arg = args [0].substring ("--working-dir=".length);
working_dir = arg;
args = args.slice (1);
} else {
break;
}
Expand Down Expand Up @@ -191,6 +196,13 @@ var Module = {
}

config.loaded_cb = function () {
let wds = FS.stat (working_dir);
if (wds === undefined || !FS.isDir (wds.mode)) {
fail_exec (`Could not find working directory ${working_dir}`);
return;
}

FS.chdir (working_dir);
App.init ();
};
config.fetch_file_cb = function (asset) {
Expand Down