Skip to content

Commit

Permalink
Update disktest.go
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS authored Jul 2, 2024
1 parent c299393 commit f0e6e15
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions disk/disktest.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ func ddTest1(path, deviceName, blockFile, blockName, blockCount, bs string) stri
result += parseResultDD(tempText, blockCount)
time.Sleep(1 * time.Second)
}
// 清理缓存, 避免影响测试结果
syncCmd := exec.Command("sync")
err = syncCmd.Run()
if err != nil {
if EnableLoger {
Logger.Info("sync command failed: " + err.Error())
}
}
// 读取测试
tempText, err = execDDTest(path+blockFile, "/dev/null", bs, blockCount)
defer os.Remove(path + blockFile)
Expand Down Expand Up @@ -150,6 +158,14 @@ func ddTest2(blockFile, blockName, blockCount, bs string) string {
result += fmt.Sprintf("%-10s", "/root") + " " + fmt.Sprintf("%-15s", blockName) + " "
}
result += parseResultDD(tempText, blockCount)
// 清理缓存, 避免影响测试结果
syncCmd := exec.Command("sync")
err = syncCmd.Run()
if err != nil {
if EnableLoger {
Logger.Info("sync command failed: " + err.Error())
}
}
// 读取测试
time.Sleep(1 * time.Second)
tempText, err = execDDTest("/root/"+blockFile, "/dev/null", bs, blockCount)
Expand Down

0 comments on commit f0e6e15

Please sign in to comment.