Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jul 30, 2024
1 parent 56e2467 commit f1f6b4c
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions disk/disktest.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,32 +159,35 @@ func ddTest2(blockFile, blockName, blockCount, bs string) string {
}
result += parseResultDD(tempText, blockCount)
// 清理缓存, 避免影响测试结果
if testFilePath != "/tmp/" {
syncCmd := exec.Command("sync")
err = syncCmd.Run()
if err != nil {
if EnableLoger {
Logger.Info("sync command failed: " + err.Error())
}
}
}
// if testFilePath == "/tmp/" {
// syncCmd := exec.Command("sync")
// err = syncCmd.Run()
// if err != nil {
// if EnableLoger {
// Logger.Info("sync command failed: " + err.Error())
// }
// }
// }
// 读取测试
if EnableLoger {
Logger.Info("Path:" + testFilePath)
}
time.Sleep(1 * time.Second)
tempText, err = execDDTest("/root/"+blockFile, "/dev/null", bs, blockCount)
defer os.Remove("/root/" + blockFile)
if err != nil {
if EnableLoger {
Logger.Info("execDDTest read error for /root/ path: " + err.Error())
}
}
if err != nil || strings.Contains(tempText, "Invalid argument") || strings.Contains(tempText, "Permission denied") {
time.Sleep(1 * time.Second)
tempText, err = execDDTest(testFilePath+blockFile, "/tmp/read"+blockFile, bs, blockCount)
defer os.Remove(testFilePath + blockFile)
defer os.Remove("/tmp/read" + blockFile)
if err != nil {
if EnableLoger {
Logger.Info("execDDTest read error for /tmp/ path: " + err.Error())
if strings.Contains(tempText, "Invalid argument") || strings.Contains(tempText, "Permission denied") {
time.Sleep(1 * time.Second)
tempText, err = execDDTest(testFilePath+blockFile, "/tmp/read"+blockFile, bs, blockCount)
defer os.Remove(testFilePath + blockFile)
defer os.Remove("/tmp/read" + blockFile)
if err != nil {
if EnableLoger {
Logger.Info("execDDTest read error for /tmp/ path: " + err.Error())
}
}
}
}
Expand Down

0 comments on commit f1f6b4c

Please sign in to comment.