<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>
<ItemGroup>
public class DirectoryInfo_Name : FileSystemTest
{
[Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/39998", TestPlatforms.Browser)]
public void CurrentDirectory()
{
var info = new DirectoryInfo(".");
<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" />
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>
runtime_args = [];
enable_gc = true;
enable_zoneinfo = false;
+working_dir='/';
while (args !== undefined && args.length > 0) {
if (args [0].startsWith ("--profile=")) {
var arg = args [0].substring ("--profile=".length);
} 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;
}
}
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) {