예제 #1
0
def run_ATTO_Disk_Benchmark(target="T"):

    tool = "Untitled - ATTO Disk Benchmark"
    tool_path = r'start "aa" "D:\SSD performance\ATTO Disk Benchmark\ATTO Disk Benchmark.exe"'

    tool, tool_path = tool_dic["ATTO"]
    run_tool(tool_path)
    #找到tool 所在的窗口
    hwnd = win32gui.FindWindow(None, tool)
    #设置窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 0, 0, 0,
                          win32con.SWP_NOSIZE)

    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"

    hwndChildList = get_child_windows(hwnd)

    disk_select = button_center(hwndChildList[2])
    mouse_move(disk_select[0], disk_select[1])
    keybd_single_char(target)

    start_button = button_center(hwndChildList[27])
    mouse_click(start_button[0], start_button[1])

    start_time = time.time()
    while win32gui.GetWindowText(hwndChildList[-10]) == "":
        time.sleep(1)
        elapsed_time = time.time() - start_time
        assert elapsed_time < 6000, "timeout!"

    filename = "{}.bmp".format(tool)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
    print("run {} finished!".format(tool))
    cmd = r'taskkill /F /IM "ATTO Disk Benchmark.exe"'
    os.system(cmd)
예제 #2
0
def run_TxBENCH(target="T"):

    tool = "TxBENCH - New project"
    tool_path = r'start "aa" "D:\SSD performance\TxBENCH.exe'

    tool, tool_path = tool_dic["TXB"]
    run_tool(tool_path)
    #找到tool 所在的窗口

    hwnd = win32gui.FindWindow(None, tool)
    #设置窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 140, 0, 0,
                          win32con.SWP_NOSIZE)
    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"
    hwndChildList = get_child_windows(hwnd)

    start_button = button_center(hwndChildList[13])
    start_init = win32gui.GetWindowText(hwndChildList[13])
    mouse_click(start_button[0], start_button[1])
    time.sleep(4)

    start_time = time.time()
    while win32gui.GetWindowText(hwndChildList[13]) != start_init:
        time.sleep(1)
        elapsed_time = time.time() - start_time
        assert elapsed_time < 6000, "timeout!"

    filename = "{}.bmp".format(tool)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)

    print("run {} finished!".format(tool))
    close_window(tool)
예제 #3
0
def run_Anvil(target="T"):

    tool = "Anvil's Storage Utilities 1.1.0 (2014-January-1)"
    tool, tool_path = tool_dic["Anvil"]
    run_tool(tool_path, 7)

    #找到tool 所在的窗口
    hwnd = win32gui.FindWindow(None, tool)
    #设置窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 140, 0, 0,
                          win32con.SWP_NOSIZE)
    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"
    hwndChildList = get_child_windows(hwnd)
    hwnd_QD_Write = win32gui.FindWindow(None,
                                        "IO - Threaded QD (Random Write)")

    disk_select = button_center(hwndChildList[8])
    disk_run = button_center(hwndChildList[14])
    disk_tmp = button_center(hwndChildList[10])
    mouse_click(disk_select[0], disk_select[1])
    mouse_click(disk_select[0], disk_select[1])
    keybd_single_char(target)

    mouse_click(disk_run[0], disk_run[1])
    # #print(disk_select)
    # mouse_move(disk_select[0], disk_select[1])

    for i in range(0, 3):
        while not win32gui.IsWindowVisible(hwnd_QD_Write):
            time.sleep(0.1)
        while win32gui.IsWindowVisible(hwnd_QD_Write):
            time.sleep(0.1)
    else:
        time.sleep(3)

# win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383,140,0,0, win32con.SWP_NOSIZE)
#time.sleep(3)

#开始测试
    mouse_click(disk_tmp[0], disk_tmp[1], 2)
    mouse_click(disk_tmp[0], disk_tmp[1], 2)
    filename = "{}.bmp".format(tool)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
예제 #4
0
def run_CrystalDiskInfo(target="T"):

    tool = "CrystalDiskInfo 7.6.0 "
    tool_path = r'start "aa" "C:\Program Files (x86)\CrystalDiskInfo\DiskInfo64.exe'
    os.system(tool_path)
    time.sleep(5)
    hwnd = win32gui.FindWindow(None, tool)  #找到tool 所在的窗口
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 140, 0, 0,
                          win32con.SWP_NOSIZE)  #设置窗口为焦点
    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"

    filename = "{}.bmp".format(tool)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
    print("run {} finished!".format(tool))
예제 #5
0
def run_assd(target="F"):

    tool, tool_path = tool_dic["ASSD"]
    run_tool(tool_path)
    #找到tool 所在的窗口
    hwnd = win32gui.FindWindow(None, tool)
    #设置assd窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 140, 0, 0,
                          win32con.SWP_NOSIZE)

    hwndChildList = get_child_windows(hwnd)

    #磁盘选择窗口/磁盘名称窗口/开始按键
    disk_select = hwndChildList[10]
    write_aactime = hwndChildList[31]
    #选择待测试磁盘
    xy = button_center(disk_select)
    mouse_click(xy[0], xy[1])

    keybd_single_char("C")

    keybd_single_char(target)
    mouse_click(xy[0], xy[1])

    # 找到 start按键
    hwnd1 = win32gui.FindWindowEx(hwnd, None, None, "Start")
    xy = button_center(hwnd1)
    mouse_move(xy[0], xy[1])
    #开始运行
    mouse_click(xy[0], xy[1])
    while True:
        write_aactime_current = win32gui.GetWindowText(write_aactime)
        flag = 0
        #判断当前是否Acc time write 是否 为0
        if write_aactime_current != "0.000 ms":
            for cnt in range(0, 10):
                if write_aactime_current != win32gui.GetWindowText(
                        write_aactime):
                    break
                else:
                    flag = flag + 1
                    time.sleep(1)
        if flag == 10:
            break

    filename = "{}.bmp".format(tool)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
    close_window(tool)
예제 #6
0
def run_CrystalDiskMark5(target="T"):

    tool = "CrystalDiskMark 5.1.2 x64"
    tool_path = r'start "aa" "D:\SSD performance\CrystalDiskMark5\DiskMark64.exe"'
    os.system(tool_path)
    time.sleep(5)
    #找到tool 所在的窗口
    hwnd = win32gui.FindWindow(None, tool)
    #设置窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 140, 0, 0,
                          win32con.SWP_NOSIZE)

    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"

    hwndChildList = get_child_windows(hwnd)
    x1, y1, x2, y2 = win32gui.GetWindowRect(hwndChildList[0])

    disk_select_xy = [x1 + 300, y1 + 25]
    start_xy = [x1 + 50, y1 + 35]

    mouse_click(disk_select_xy[0], disk_select_xy[1], cnt=2)
    keybd_single_char(target)
    time.sleep(0.5)
    #开始测试
    mouse_click(start_xy[0], start_xy[1])
    time.clock()

    #判断运行状态是否结束,当600s后超时退出
    while win32gui.GetWindowText(hwnd) != "Random Write 4KiB [5/5]":
        time.sleep(1)
        assert time.clock() < 600, "run err or time out!"

    #判断运行状态是否结束,当window name 不等于Random Write 4KiB [5/5],并且为tool 名称时,则为结束
    while win32gui.GetWindowText(hwnd) == "Random Write 4KiB [5/5]":
        time.sleep(1)
        if win32gui.GetWindowText(hwnd) == tool:
            print("run {} finished!".format(tool))
            break

    filename = "{}.bmp".format(tool)

    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
예제 #7
0
def get_DiskInfo(target=0, image=""):

    tool, tool_path = tool_dic["CDI"]
    run_tool(tool_path)

    hwnd = win32gui.FindWindow(None, tool)  #找到tool 的句柄
    print(hwnd)
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0, 0, 2000, 2000,
                          win32con.SWP_SHOWWINDOW)  #设置窗口为焦点
    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"
    hwndChildList = get_child_windows(hwnd)

    target_button = button_center(hwndChildList[2 + target])  #获取所需磁盘的按键
    mouse_click(target_button[0], target_button[1])

    filename = "{}-{}.bmp".format(image, tool)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)

    print("run {} finished!".format(tool))
    #close_window(tool)
    return filename
예제 #8
0
def run_HDtune(disk_number=100):

    a = diskpart_tool.DiskPart()
    a.clean(disk_number)

    tool = "HD Tune Pro 5.60 - 硬盘/固态硬盘实用程序 "
    tool_path = r'start "aa" "D:\SSD performance\HD Tune Pro.exe'

    tool, tool_path = tool_dic["HDtune"]
    run_tool(tool_path)

    hwnd = win32gui.FindWindow(None, tool)

    #设置窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 0, 0, 0,
                          win32con.SWP_NOSIZE)
    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"
    hwndChildList = get_child_windows(hwnd)

    disk_select = button_center(hwndChildList[0])
    mouse_click(disk_select[0], disk_select[1])
    mouse_click(disk_select[0], disk_select[1] + 14 * (disk_number + 1))

    start_button = button_center(hwndChildList[13])
    read_button = button_center(hwndChildList[14])
    write_button = button_center(hwndChildList[15])

    start_init = win32gui.GetWindowText(hwndChildList[13])
    print(start_init)

    mouse_click(write_button[0], write_button[1])
    time.sleep(0.5)
    mouse_click(start_button[0], start_button[1])
    time.sleep(0.5)

    hwnd_write_yes_window = win32gui.FindWindow(None, "警告!")
    hwnd_ChildList = get_child_windows(hwnd_write_yes_window)
    run_write_button = button_center(hwnd_ChildList[3])
    confirm_button = button_center(hwnd_ChildList[0])
    mouse_click(run_write_button[0], run_write_button[1])
    time.sleep(2)

    mouse_click(confirm_button[0], confirm_button[1])

    time.sleep(5)
    start_time = time.time()
    while win32gui.GetWindowText(hwndChildList[13]) != start_init:
        time.sleep(1)
        elapsed_time = time.time() - start_time
        assert elapsed_time < 600, "timeout!"
    time.sleep(2)
    filename = "HDtune_write.bmp"
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)

    time.sleep(4)
    mouse_click(read_button[0], read_button[1])
    time.sleep(0.5)
    mouse_click(start_button[0], start_button[1])
    time.sleep(5)

    start_time = time.time()
    while win32gui.GetWindowText(hwndChildList[13]) != start_init:
        time.sleep(1)
        elapsed_time = time.time() - start_time
        assert elapsed_time < 600, "timeout!"
    time.sleep(1)
    filename = "HDtune_read.bmp"
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
    close_window(tool)
    return filename
예제 #9
0
def run_CrystalDiskMark5(target="T"):

    tool = "CrystalDiskMark 5.1.2 x64"
    tool, tool_path = tool_dic["CDM"]
    run_tool(tool_path)

    #找到tool 所在的窗口
    hwnd = win32gui.FindWindow(None, tool)
    #设置窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 140, 0, 0,
                          win32con.SWP_NOSIZE)

    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"

    hwndChildList = get_child_windows(hwnd)
    x1, y1, x2, y2 = win32gui.GetWindowRect(hwndChildList[0])

    disk_select_xy = [x1 + 300, y1 + 25]
    start_xy = [x1 + 50, y1 + 35]

    mouse_click(disk_select_xy[0], disk_select_xy[1])
    mouse_click(disk_select_xy[0], disk_select_xy[1])
    keybd_single_char(target)

    #开始测试
    mouse_click(start_xy[0], start_xy[1])
    if "CrystalDiskMark 5." in tool:

        run_check = [  #"Sequential Read Multi [5/5]", 
            "Sequential Write Multi [5/5]",
            #"Random Read 4KiB Multi [5/5]",
            "Random Write 4KiB Multi [5/5]",
            #"Sequential Read [5/5]",
            "Sequential Write [5/5]",
            "Random Write 4KiB [5/5]"
        ]
    elif "CrystalDiskMark 6." in tool:

        run_check = [  #"Sequential Read Multi [5/5]", 
            # "Sequential Write Multi [5/5]",
            # #"Random Read 4KiB Multi [5/5]",
            # "Random Write 4KiB Multi [5/5]",
            #"Sequential Read [5/5]",
            "Sequential Write [5/5]",
            "Interval Time 1/5 sec",
            "Random Write 4KiB [5/5]",
            "Interval Time 1/5 sec",
            "Random Write 4KiB [5/5]",
            "Interval Time 1/5 sec",
            "Random Write 4KiB [5/5]"
        ]
    for status in run_check:
        while True:
            if win32gui.GetWindowText(hwnd) != status:
                time.sleep(0.1)
            else:
                time.sleep(1)
                break
        print(status)

    while win32gui.GetWindowText(hwnd) != tool:
        time.sleep(1)

    filename = "{}.bmp".format(tool)
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
    close_window(tool)
예제 #10
0
def run_HDtune(disk_number=100):

    a = diskpart_tool.DiskPart()
    a.clean(disk_number)  #删除文件系统
    tool = "HD Tune Pro 5.60 - 硬盘/固态硬盘实用程序 "
    tool_path = r'start "aa" "D:\SSD performance\HD Tune Pro.exe'
    os.system(tool_path)
    time.sleep(5)

    hwnd = win32gui.FindWindow(None, tool)  #找到tool 所在的窗口
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 0, 0, 0,
                          win32con.SWP_NOSIZE)  #设置窗口为焦点
    assert win32gui.GetWindowText(hwnd) == tool, "run tool name wrong!"
    hwndChildList = get_child_windows(hwnd)  #获取所有句柄列表
    disk_select = button_center(hwndChildList[0])  #选择框中心坐标
    mouse_click(disk_select[0], disk_select[1])  #打开选择框
    time.sleep(0.5)
    mouse_click(disk_select[0],
                disk_select[1] + 20 * (disk_number + 1))  #点击磁盘框
    time.sleep(0.5)

    #获取按键位置
    start_button = button_center(hwndChildList[13])
    read_button = button_center(hwndChildList[14])
    write_button = button_center(hwndChildList[15])

    #开始写测试
    start_init = win32gui.GetWindowText(hwndChildList[13])  #开始按键状态

    mouse_click(write_button[0], write_button[1])
    time.sleep(0.5)
    mouse_click(start_button[0], start_button[1])
    time.sleep(2)

    hwnd_write_yes_window = win32gui.FindWindow(None, "警告!")
    hwnd_ChildList = get_child_windows(hwnd_write_yes_window)
    run_write_button = button_center(hwnd_ChildList[3])
    confirm_button = button_center(hwnd_ChildList[0])

    mouse_click(run_write_button[0], run_write_button[1])
    time.sleep(2)
    mouse_click(confirm_button[0], confirm_button[1])
    time.sleep(5)

    start_time = time.time()
    while win32gui.GetWindowText(hwndChildList[13]) != start_init:
        time.sleep(1)
        elapsed_time = time.time() - start_time
        assert elapsed_time < 600, "timeout!"
    time.sleep(2)
    filename = "HDtune_write.bmp"
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)

    mouse_click(read_button[0], read_button[1])
    time.sleep(0.5)
    mouse_click(start_button[0], start_button[1])
    time.sleep(5)

    start_time = time.time()
    while win32gui.GetWindowText(hwndChildList[13]) != start_init:
        time.sleep(1)
        elapsed_time = time.time() - start_time
        assert elapsed_time < 600, "timeout!"
    time.sleep(1)
    filename = "HDtune_read.bmp"
    screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
예제 #11
0
def run_assd(target="F"):
    """[summary]

    Keyword Arguments:
        target {str} -- [description] (default: {"F"})
    """

    tool = "AS SSD Benchmark 1.9.5986.35387"
    tool_path = r'start "aa" "D:\SSD performance\AS SSD Benchmark\AS SSD Benchmark.exe"'
    os.system(tool_path)
    time.sleep(5)
    #找到tool 所在的窗口
    hwnd = win32gui.FindWindow(None, tool)
    #设置assd窗口为焦点
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 383, 140, 0, 0,
                          win32con.SWP_NOSIZE)

    hwndChildList = get_child_windows(hwnd)
    print(hwndChildList)
    #磁盘选择窗口/磁盘名称窗口/开始按键
    disk_select = hwndChildList[10]
    disk_name = hwndChildList[25]
    #start_button = hwndChildList[24]
    write_aactime = hwndChildList[31]
    #write_aactime_init = win32gui.GetWindowText(write_aactime)
    disk_select_init = win32gui.GetWindowText(disk_name)
    #print(disk_select_init)
    #选择待测试磁盘
    xy = button_center(disk_select)
    mouse_click(xy[0], xy[1])
    time.sleep(0.5)
    keybd_single_char("C")
    disk_select_init = win32gui.GetWindowText(disk_name)

    time.sleep(0.5)
    keybd_single_char(target)
    mouse_click(xy[0], xy[1])

    #判断选择磁盘是否成功,若成功,当前磁盘名称应与init不一样

    disk_select_current = win32gui.GetWindowText(disk_name)
    print(disk_select_current)

    if disk_select_init != disk_select_current:
        print('{0} start testing ! '.format(disk_select_current))
        #
        # 找到 start按键
        hwnd1 = win32gui.FindWindowEx(hwnd, None, None, "Start")
        xy = button_center(hwnd1)
        print(xy)
        mouse_move(xy[0], xy[1])
        #开始运行
        mouse_click(xy[0], xy[1])
        while True:

            write_aactime_current = win32gui.GetWindowText(write_aactime)
            flag = 0
            #判断当前是否Acc time write 是否 为0
            if write_aactime_current != "0.000 ms":
                for cnt in range(0, 10):
                    if write_aactime_current != win32gui.GetWindowText(
                            write_aactime):
                        print(write_aactime_current)
                        cnt
                        break
                    else:
                        flag = flag + 1
                        time.sleep(1)

            if flag == 10:
                break

        filename = "{}.bmp".format(tool)

        # x1, y1, x2, y2 = win32gui.GetWindowRect(hwnd)
        # x1 = x1 + 7
        # x2 = x2 - 9
        # y2 = y2 - 8
        screenPrt.ScreenPrintWin().save_bitmap(bmp_filename=filename)
        print(write_aactime_current)
    else:
        print(23)