Skip to content

Commit b47cb68

Browse files
committed
fix:由于app的局限性,暂时警告处理不做真正的内存和硬盘读写测试
1 parent abe6c06 commit b47cb68

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

internal/tests/disk.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ import (
88
)
99

1010
func DiskTest(language, testMethod, testPath string, isMultiCheck bool, autoChange bool) (realTestMethod, res string) {
11+
// Android 平台不支持二进制文件测试
12+
if runtime.GOOS == "android" {
13+
realTestMethod = "disabled"
14+
if language == "en" {
15+
res = "Disk test is not supported on Android platform.\n\n" +
16+
"Reason: Android security sandbox prevents apps from executing\n" +
17+
"Alternative: Please use Termux to run the binary test from:\n" +
18+
"https://github.com/oneclickvirt/ecs\n"
19+
} else {
20+
res = "Android 平台不支持硬盘测试。\n\n" +
21+
"原因:Android 安全沙箱机制禁止应用直接执行外部二进制文件\n" +
22+
"替代方案:请使用 Termux 执行以下项目的二进制文件测试:\n" +
23+
"https://github.com/oneclickvirt/ecs\n"
24+
}
25+
return
26+
}
27+
1128
switch testMethod {
1229
case "fio":
1330
res = disk.FioTest(language, isMultiCheck, testPath)

internal/tests/memory.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ func MemoryTest(language, testMethod string) (realTestMethod, res string) {
1212
if testMethod == "" {
1313
testMethod = "auto"
1414
}
15+
16+
// Android 平台不支持二进制文件测试
17+
if runtime.GOOS == "android" {
18+
realTestMethod = "disabled"
19+
if language == "en" {
20+
res = "Memory test is not supported on Android platform.\n\n" +
21+
"Reason: Android security sandbox prevents apps from executing\n" +
22+
"Alternative: Please use Termux to run the binary test from:\n" +
23+
"https://github.com/oneclickvirt/ecs\n"
24+
} else {
25+
res = "Android 平台不支持内存测试。\n\n" +
26+
"原因:Android 安全沙箱机制禁止应用直接执行外部二进制文件\n" +
27+
"替代方案:请使用 Termux 执行以下项目的二进制文件测试:\n" +
28+
"https://github.com/oneclickvirt/ecs\n"
29+
}
30+
return
31+
}
32+
1533
if runtime.GOOS == "windows" {
1634
switch testMethod {
1735
case "stream":

0 commit comments

Comments
 (0)