mirror of
https://github.com/oneclickvirt/ecs.git
synced 2025-12-18 23:38:13 +08:00
fix:添加UI配置参数对接
Some checks failed
Build All UI APP / Prepare Version (push) Has been cancelled
Build All UI APP / Build Android APK (push) Has been cancelled
Build All UI APP / Build Desktop Apps (amd64, macos-amd64, macos-13, darwin) (push) Has been cancelled
Build All UI APP / Build Desktop Apps (amd64, windows-amd64, windows-latest, windows) (push) Has been cancelled
Build All UI APP / Build Desktop Apps (arm64, macos-arm64, macos-latest, darwin) (push) Has been cancelled
Some checks failed
Build All UI APP / Prepare Version (push) Has been cancelled
Build All UI APP / Build Android APK (push) Has been cancelled
Build All UI APP / Build Desktop Apps (amd64, macos-amd64, macos-13, darwin) (push) Has been cancelled
Build All UI APP / Build Desktop Apps (amd64, windows-amd64, windows-latest, windows) (push) Has been cancelled
Build All UI APP / Build Desktop Apps (arm64, macos-arm64, macos-latest, darwin) (push) Has been cancelled
This commit is contained in:
@@ -36,7 +36,9 @@ func NewCommandExecutor(outputCallback func(string)) *CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
func (e *CommandExecutor) Execute(selectedOptions map[string]bool, language string, testUpload bool, testDownload bool, chinaModeEnabled bool) error {
|
||||
func (e *CommandExecutor) Execute(selectedOptions map[string]bool, language string, testUpload bool, testDownload bool, chinaModeEnabled bool,
|
||||
cpuMethod, threadMode, memoryMethod, diskMethod, diskPath string, diskMulti bool,
|
||||
nt3Location, nt3Type string, spNum int) error {
|
||||
// 设置测试选项
|
||||
basicStatus := selectedOptions["basic"]
|
||||
cpuTestStatus := selectedOptions["cpu"]
|
||||
@@ -135,7 +137,7 @@ func (e *CommandExecutor) Execute(selectedOptions map[string]bool, language stri
|
||||
// 2. CPU测试
|
||||
if cpuTestStatus {
|
||||
outputMutex.Lock()
|
||||
realTestMethod, res := cputest.CpuTest(language, "sysbench", "multi")
|
||||
realTestMethod, res := cputest.CpuTest(language, cpuMethod, threadMode)
|
||||
if language == "zh" {
|
||||
ecsutils.PrintCenteredTitle(fmt.Sprintf("CPU测试-通过%s测试", realTestMethod), 82)
|
||||
} else {
|
||||
@@ -148,7 +150,7 @@ func (e *CommandExecutor) Execute(selectedOptions map[string]bool, language stri
|
||||
// 3. 内存测试
|
||||
if memoryTestStatus {
|
||||
outputMutex.Lock()
|
||||
realTestMethod, res := memorytest.MemoryTest(language, "auto")
|
||||
realTestMethod, res := memorytest.MemoryTest(language, memoryMethod)
|
||||
if language == "zh" {
|
||||
ecsutils.PrintCenteredTitle(fmt.Sprintf("内存测试-通过%s测试", realTestMethod), 82)
|
||||
} else {
|
||||
@@ -161,7 +163,7 @@ func (e *CommandExecutor) Execute(selectedOptions map[string]bool, language stri
|
||||
// 4. 磁盘测试
|
||||
if diskTestStatus {
|
||||
outputMutex.Lock()
|
||||
realTestMethod, res := disktest.DiskTest(language, "fio", "", false, true)
|
||||
realTestMethod, res := disktest.DiskTest(language, diskMethod, diskPath, diskMulti, true)
|
||||
if language == "zh" {
|
||||
ecsutils.PrintCenteredTitle(fmt.Sprintf("硬盘测试-通过%s测试", realTestMethod), 82)
|
||||
} else {
|
||||
@@ -255,7 +257,7 @@ func (e *CommandExecutor) Execute(selectedOptions map[string]bool, language stri
|
||||
} else {
|
||||
ecsutils.PrintCenteredTitle("NextTrace-3Networks-Check", 82)
|
||||
}
|
||||
nexttrace.NextTrace3Check(language, "GZ", "ipv4")
|
||||
nexttrace.NextTrace3Check(language, nt3Location, nt3Type)
|
||||
outputMutex.Unlock()
|
||||
}
|
||||
|
||||
@@ -286,7 +288,7 @@ func (e *CommandExecutor) Execute(selectedOptions map[string]bool, language stri
|
||||
if testUpload || testDownload {
|
||||
speedtest.NearbySP()
|
||||
if language == "zh" {
|
||||
speedtest.CustomSP("net", "global", 2, language)
|
||||
speedtest.CustomSP("net", "global", spNum, language)
|
||||
} else {
|
||||
speedtest.CustomSP("net", "global", -1, language)
|
||||
}
|
||||
|
||||
@@ -37,12 +37,55 @@ func (ui *TestUI) runTestsWithExecutor() {
|
||||
// 获取中国模式配置
|
||||
chinaModeEnabled := ui.ChinaModeCheck.Checked
|
||||
|
||||
// 获取CPU配置
|
||||
cpuMethod := ui.CpuMethodSelect.Selected
|
||||
if cpuMethod == "" {
|
||||
cpuMethod = "sysbench"
|
||||
}
|
||||
threadMode := ui.ThreadModeSelect.Selected
|
||||
if threadMode == "" {
|
||||
threadMode = "multi"
|
||||
}
|
||||
|
||||
// 获取内存配置
|
||||
memoryMethod := ui.MemoryMethodSelect.Selected
|
||||
if memoryMethod == "" {
|
||||
memoryMethod = "auto"
|
||||
}
|
||||
|
||||
// 获取磁盘配置
|
||||
diskMethod := ui.DiskMethodSelect.Selected
|
||||
if diskMethod == "" {
|
||||
diskMethod = "auto"
|
||||
}
|
||||
diskPath := ui.DiskPathEntry.Text
|
||||
diskMulti := ui.DiskMultiCheck.Checked
|
||||
|
||||
// 获取NT3配置
|
||||
nt3Location := ui.Nt3LocationSelect.Selected
|
||||
if nt3Location == "" {
|
||||
nt3Location = "GZ"
|
||||
}
|
||||
nt3Type := ui.Nt3TypeSelect.Selected
|
||||
if nt3Type == "" {
|
||||
nt3Type = "ipv4"
|
||||
}
|
||||
|
||||
// 获取测速节点数
|
||||
spNum := 2 // 默认值
|
||||
if ui.SpNumEntry.Text != "" {
|
||||
// 尝试解析spNum,如果失败则使用默认值
|
||||
fmt.Sscanf(ui.SpNumEntry.Text, "%d", &spNum)
|
||||
}
|
||||
|
||||
// 更新进度
|
||||
ui.ProgressBar.SetValue(0.1)
|
||||
ui.StatusLabel.SetText("正在执行测试...")
|
||||
|
||||
// 执行测试(输出会实时显示在terminal widget中)
|
||||
err := executor.Execute(selectedOptions, language, testUpload, testDownload, chinaModeEnabled)
|
||||
err := executor.Execute(selectedOptions, language, testUpload, testDownload, chinaModeEnabled,
|
||||
cpuMethod, threadMode, memoryMethod, diskMethod, diskPath, diskMulti,
|
||||
nt3Location, nt3Type, spNum)
|
||||
|
||||
// 显示结束信息
|
||||
endTime := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user