Skip to content

Commit 89c2c78

Browse files
Tests: Hard-skip spectests on Android
1 parent ff1f477 commit 89c2c78

File tree

3 files changed

+57
-49
lines changed

3 files changed

+57
-49
lines changed

Tests/WATTests/Spectest.swift

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,29 @@ enum Spectest {
1717
}
1818

1919
static func wastFiles(include: [String] = [], exclude: [String] = ["annotations.wast"]) -> [URL] {
20-
return [
21-
testsuitePath,
22-
testsuitePath.appendingPathComponent("proposals/memory64"),
23-
testsuitePath.appendingPathComponent("proposals/tail-call"),
24-
rootDirectory.appendingPathComponent("Tests/WasmKitTests/ExtraSuite"),
25-
].flatMap {
26-
try! FileManager.default.contentsOfDirectory(at: $0, includingPropertiesForKeys: nil)
27-
}.compactMap { filePath in
28-
guard filePath.pathExtension == "wast" else {
29-
return nil
20+
#if os(Android)
21+
return []
22+
#else
23+
return [
24+
testsuitePath,
25+
testsuitePath.appendingPathComponent("proposals/memory64"),
26+
testsuitePath.appendingPathComponent("proposals/tail-call"),
27+
rootDirectory.appendingPathComponent("Tests/WasmKitTests/ExtraSuite"),
28+
].flatMap {
29+
try! FileManager.default.contentsOfDirectory(at: $0, includingPropertiesForKeys: nil)
30+
}.compactMap { filePath in
31+
guard filePath.pathExtension == "wast" else {
32+
return nil
33+
}
34+
guard !filePath.lastPathComponent.starts(with: "simd_") else { return nil }
35+
if !include.isEmpty {
36+
guard include.contains(filePath.lastPathComponent) else { return nil }
37+
} else {
38+
guard !exclude.contains(filePath.lastPathComponent) else { return nil }
39+
}
40+
return filePath
3041
}
31-
guard !filePath.lastPathComponent.starts(with: "simd_") else { return nil }
32-
if !include.isEmpty {
33-
guard include.contains(filePath.lastPathComponent) else { return nil }
34-
} else {
35-
guard !exclude.contains(filePath.lastPathComponent) else { return nil }
36-
}
37-
return filePath
38-
}
42+
#endif
3943
}
4044

4145
static func deriveFeatureSet(wast: URL) -> WasmFeatureSet {

Tests/WasmKitTests/FuzzTranslatorRegressionTests.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,20 @@
2323
}
2424
}
2525

26-
@Test(
27-
.disabled("unable to run fuzz translator regression tests on Android due to missing files on emulator", platforms: [.android]),
28-
arguments: try failCases()
29-
)
30-
func run(test: Case) throws {
31-
let data = try Data(contentsOf: test.path)
32-
do {
33-
try WasmKitFuzzing.fuzzInstantiation(bytes: Array(data))
34-
} catch {
35-
// Skip exceptions without crash
26+
#if !os(Android)
27+
@Test(
28+
.disabled("unable to run fuzz translator regression tests on Android due to missing files on emulator", platforms: [.android]),
29+
arguments: try failCases()
30+
)
31+
func run(test: Case) throws {
32+
let data = try Data(contentsOf: test.path)
33+
do {
34+
try WasmKitFuzzing.fuzzInstantiation(bytes: Array(data))
35+
} catch {
36+
// Skip exceptions without crash
37+
}
3638
}
37-
}
39+
#endif
3840
}
3941

4042
#endif

Tests/WasmKitTests/SpectestTests.swift

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,28 @@
1919
]
2020
}
2121

22-
@Test(
23-
.disabled("unable to run spectest on Android due to missing files on emulator", platforms: [.android]),
24-
arguments: try SpectestDiscovery(path: SpectestTests.testPaths).discover()
25-
)
26-
func run(test: TestCase) throws {
27-
let defaultConfig = EngineConfiguration()
28-
let runner = try SpectestRunner(configuration: defaultConfig)
29-
try runner.run(test: test, reporter: NullSpectestProgressReporter())
30-
}
22+
#if !os(Android)
23+
@Test(
24+
.disabled("unable to run spectest on Android due to missing files on emulator", platforms: [.android]),
25+
arguments: try SpectestDiscovery(path: SpectestTests.testPaths).discover()
26+
)
27+
func run(test: TestCase) throws {
28+
let defaultConfig = EngineConfiguration()
29+
let runner = try SpectestRunner(configuration: defaultConfig)
30+
try runner.run(test: test, reporter: NullSpectestProgressReporter())
31+
}
3132

32-
@Test(
33-
.disabled("unable to run spectest on Android due to missing files on emulator", platforms: [.android]),
34-
arguments: try SpectestDiscovery(path: SpectestTests.testPaths).discover()
35-
)
36-
func runWithTokenThreading(test: TestCase) throws {
37-
let defaultConfig = EngineConfiguration()
38-
guard defaultConfig.threadingModel != .token else { return }
39-
// Sanity check that non-default threading models work.
40-
let runner = try SpectestRunner(configuration: defaultConfig)
41-
try runner.run(test: test, reporter: NullSpectestProgressReporter())
42-
}
33+
@Test(
34+
.disabled("unable to run spectest on Android due to missing files on emulator", platforms: [.android]),
35+
arguments: try SpectestDiscovery(path: SpectestTests.testPaths).discover()
36+
)
37+
func runWithTokenThreading(test: TestCase) throws {
38+
let defaultConfig = EngineConfiguration()
39+
guard defaultConfig.threadingModel != .token else { return }
40+
// Sanity check that non-default threading models work.
41+
let runner = try SpectestRunner(configuration: defaultConfig)
42+
try runner.run(test: test, reporter: NullSpectestProgressReporter())
43+
}
44+
#endif
4345
}
4446
#endif

0 commit comments

Comments
 (0)