Skip to content

Commit e042405

Browse files
committed
Filter out listDirectory test on Windows
1 parent f50f6ee commit e042405

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

core/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6+
import org.gradle.internal.os.OperatingSystem
67
import org.jetbrains.dokka.gradle.DokkaTaskPartial
78

89
plugins {
@@ -30,6 +31,17 @@ kotlin {
3031
}
3132
}
3233
}
34+
wasmWasi {
35+
nodejs {
36+
testTask {
37+
// fd_readdir is unsupported on Windows:
38+
// https://github.com/nodejs/node/blob/6f4d6011ea1b448cf21f5d363c44e4a4c56ca34c/deps/uvwasi/src/uvwasi.c#L19
39+
if (OperatingSystem.current().isWindows) {
40+
filter.setExcludePatterns("*SmokeFileTest.listDirectory")
41+
}
42+
}
43+
}
44+
}
3345

3446
sourceSets {
3547
commonMain.dependencies {

core/wasmWasi/src/files/FileSystemWasm.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ internal object WasiFileSystem : SystemFileSystemImpl() {
311311
val bufferSize = metadata.filesize.toInt()
312312
val buffer = allocator.allocate(bufferSize)
313313
val resultSize: Int
314+
// Unsuported on Windows and Android:
315+
// https://github.com/nodejs/node/blob/6f4d6011ea1b448cf21f5d363c44e4a4c56ca34c/deps/uvwasi/src/uvwasi.c#L19
314316
val res = Errno(
315317
fd_readdir(
316318
fd = dir_fd,

core/wasmWasi/test/WasiFsTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,14 @@ class WasiFsTest {
219219
SystemFileSystem.delete(Path("/tmp/a"))
220220
}
221221
}
222+
223+
// https://github.com/nodejs/node/blob/6f4d6011ea1b448cf21f5d363c44e4a4c56ca34c/deps/uvwasi/src/uvwasi.c#L19
224+
@Test
225+
fun readdirUnsupportedOnWindows() {
226+
if (!isWindows) return
227+
228+
assertFailsWith<IOException> {
229+
SystemFileSystem.list(PreOpens.roots.first())
230+
}
231+
}
222232
}

0 commit comments

Comments
 (0)