Solid state disk testing method and device, equipment and medium
By establishing a port information table based on slot number on the test host, determining the target port address, and selecting an appropriate transmission method, the problem of wasted time and resources in solid-state drive testing is solved, and more efficient and accurate testing is achieved.
Patent Information
- Application Number
- CN202411996987.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The prior art has problems of time and resource waste in solid-state drive testing, especially in multi-port testing mode, where frequent remote connections lead to increased latency and resource consumption.
By establishing a slot number-based port information table on the test host, determine the target port address, and select local transmission or remote connection tunnel for test command transmission based on whether it matches the test host address.
It effectively reduces test time and resource consumption, avoids disk identification errors and test confusion caused by port information changes, and improves the accuracy and efficiency of the test.
Smart Images

Figure CN119851742A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a solid state hard disk testing method, device, equipment and medium. Background Art
[0002] Solid State Drive (SSD) is a hard disk made of solid-state electronic storage integrated circuit array. Compared with the traditional mechanical hard disk (HDD) using magnetic heads, SSD has obvious advantages in read and write speed, energy consumption, shock resistance, etc. Since there is no mechanical moving parts, SSD has obvious advantages in read and write speed, energy consumption, shock resistance, etc. SSD is widely used in personal computers, servers and various mobile devices, and is an important storage device in modern computer systems.
[0003] SSDs are divided into single-port and multi-port types. Dual-ports have three working modes, namely active-active working mode, link redundancy mode, and master-slave working mode. Regardless of the test mode, the test method is to select a fixed port, fill in the relevant parameters to assemble the command according to the selected port information, select the corresponding test command to be issued according to the different working modes, and assemble the above process into a test script. For non-power-on and power-off tests, the test host sends the test command to the SSD through a remote connection with the SSD. Therefore, the SSD needs to frequently connect to the test host. The remote connection has a certain delay. If this method is used for both ports, there will be a great loss of test host resources and test time.
[0004] It can be seen that how to reduce the time and resources of SSD testing is a problem that technical personnel in this field need to solve. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a solid state drive testing method, device, equipment and medium to reduce the time and resources of solid state drive testing. The specific scheme is as follows:
[0006] In a first aspect, the present invention discloses a solid state hard disk testing method, which is applied to a testing host, comprising:
[0007] Determine the corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive, and obtain the target port address from the target information table; wherein each port information table is established based on the slot number of the test host;
[0008] Assemble the general test command and the target port number to obtain the target test command;
[0009] If the target port address matches the address of the test host, the target test command is transmitted to the port to be tested via the transmission line between the local port and the port to be tested;
[0010] If the target port address does not match the address of the test host, the target test command is sent to the port to be tested through the remote connection tunnel;
[0011] Receive the test result returned by the solid state drive based on the target test command.
[0012] Optionally, before determining the corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive, the method further includes:
[0013] If the port test mode of the solid state drive is a single-port test mode, the single port of the solid state drive is determined as a port to be tested;
[0014] If the port test mode of the solid state drive is a multi-port test mode, a port to be tested is randomly determined from the ports of the solid state drive based on a preset port balance test principle.
[0015] Optionally, the test host is in communication connection with the target switch;
[0016] Accordingly, each port information table is established based on the slot number of the test host, including:
[0017] Obtaining the slot number of the test host assigned by the target switch according to test-related factors through a preset allocation interface; wherein the test-related factors include any one or more of the device type of the test host, the number of slots of the target switch, the configuration information of the target switch, and the solid-state hard disk test requirements, and the solid-state hard disk test requirements include the solid-state hard disk test execution time and the consistency of the port test command;
[0018] Based on the slot number of the test host, the physical connection position of each port of the solid-state drive and the solid-state drive itself is tracked to obtain the port information of each port; wherein the port information includes the port drive letter, the port address, and the port namespace, and the port namespace is a logical space used for addressing and data management;
[0019] The port number of each port is obtained, and the mapping relationship between the slot number and the port information is recorded to establish each port information table containing the mapping relationship, and the corresponding port number is determined as the index of each port information table.
[0020] Optionally, obtain the port number of each port, including:
[0021] Use the operating system and hardware driver of the test host to collect the port number of each port;
[0022] And / or, reading metadata of the solid state drive, and obtaining the port number of each port from the metadata.
[0023] Optionally, determining a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive includes:
[0024] Determine the current port information table from each port information table, and determine whether the index of the current port information table corresponds to the target port number of the port to be tested in the solid state drive;
[0025] If the index of the current port information table is not in correspondence with the target port number, a new current port information table is determined from each port information table, and the process jumps again to the step of determining whether the index of the current port information table is in correspondence with the target port number of the port to be tested in the solid state drive;
[0026] If the index of the current port information table is in a corresponding relationship with the target port number, the current port information table is determined as the target information table.
[0027] Optionally, the general test command is assembled with the target port number to obtain a target test command, including:
[0028] If the consistency of the port test command required by the solid state drive test indicates that the test commands of each port in the solid state drive are the same, assembling the common test command with the target port number to obtain a first target test command;
[0029] If the consistency of the port test command required by the SSD test indicates that the test commands for each port in the SSD are different, the corresponding target port information is obtained from the target information table, and the general test command is assembled with the target port number and the target port information to obtain a second target test command.
[0030] Optionally, the target port information includes a target port drive letter and a target port namespace corresponding to the target port number, and the general test command is a command that is not affected by the port drive letter and the port namespace.
[0031] In a second aspect, the present invention discloses a solid state hard disk testing device, which is applied to a testing host, comprising:
[0032] An information table determination module is used to determine a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid-state hard disk, and obtain the target port address from the target information table; wherein each port information table is established based on the slot number of the test host;
[0033] A test command assembly module, used for assembling a general test command with a target port number to obtain a target test command;
[0034] A first command sending module, configured to transmit a target test command to the port to be tested via a transmission line between the local port and the port to be tested if the target port address matches the address of the test host;
[0035] A second command sending module, used for sending a target test command to the port to be tested through a remote connection tunnel if the target port address does not match the address of the test host;
[0036] The test result receiving module is used to receive the test result returned by the solid state drive based on the target test command.
[0037] In a third aspect, the present invention discloses an electronic device, comprising:
[0038] Memory, used to store computer programs;
[0039] The processor is used to execute a computer program to implement the steps of the solid state drive testing method disclosed above.
[0040] In a fourth aspect, the present invention discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the solid-state hard disk testing method disclosed above are implemented.
[0041] It can be seen that the present invention is applied to a test host, including: determining a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid-state hard disk, and obtaining a target port address from the target information table; wherein each port information table is established based on the slot number of the test host; assembling a general test command with the target port number to obtain a target test command; if the target port address matches the address of the test host, transmitting the target test command to the port to be tested via a transmission line between the local and the port to be tested; if the target port address does not match the address of the test host, sending the target test command to the port to be tested via a remote connection tunnel; and receiving a test result returned by the solid-state hard disk based on the target test command.
[0042] The beneficial effects are as follows: the slot number of the test host is fixed, while the port information will change due to system configuration and driver updates. In the long-term testing process and complex system environment changes, a port information table is established based on the slot number of the test host, which can always accurately identify and track the port to be tested of the solid-state hard disk, avoiding problems such as disk identification errors or test confusion caused by changes in port information; the general test command is assembled with the target port number to obtain the target test command. The general test command provides basic test function logic, and after being assembled in combination with the target port number, the generated target test command can be accurately adapted to a specific port; if the target port address matches the address of the test host , it means that the current test is a local port test, so the target test command can be directly sent to the port to be tested, that is, the target test command is transmitted to the port to be tested through the transmission line between the local and the port to be tested. If the target port address does not match the address of the test host, the current test is not a local port test. At this time, the target test command is sent to the port to be tested through the remote connection tunnel. It is not necessary to send the target test command through the remote connection tunnel every time. In this way, the command sending delay is effectively reduced, and the test host does not need to frequently establish a remote connection with the solid-state drive, thereby reducing the resources of the test host. The solid-state drive processes the target test command received by the test port, thereby receiving the test result of the solid-state drive. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A flow chart of a solid state drive testing method provided by an embodiment of the present invention;
[0045] Figure 2 A flow chart of a specific solid state drive testing method provided by an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of a specific dual-port solid-state hard disk provided by an embodiment of the present invention;
[0047] Figure 4 A schematic diagram of a specific test system provided by an embodiment of the present invention;
[0048] Figure 5 A schematic diagram of the structure of a solid state drive testing device provided by an embodiment of the present invention;
[0049] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] Solid-state drives are hard disks made of solid-state electronic storage integrated circuit arrays. Since there are no mechanical moving parts, solid-state drives have obvious advantages over traditional mechanical hard disks that use magnetic heads in terms of read and write speed, energy consumption, and shock resistance. Solid-state drives are widely used in personal computers, servers, and various mobile devices, and are important storage devices in modern computer systems.
[0052] SSDs are divided into single-port and multi-port types. Dual-ports have three working modes, namely active-active working mode, link redundancy mode, and master-slave working mode. Regardless of the test mode, the test method is to select a fixed port, fill in the relevant parameters to assemble the command according to the selected port information, select the corresponding test command to be issued according to the different working modes, and assemble the above process into a test script. For non-power-on and power-off tests, the test host sends the test command to the SSD through a remote connection with the SSD. Therefore, the SSD needs to frequently connect to the test host. The remote connection has a certain delay. If this method is used for both ports, there will be a great loss of test host resources and test time.
[0053] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0054] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0055] Next, a solid state drive testing solution provided by an embodiment of the present invention is described in detail. Figure 1 A solid state drive testing method provided in an embodiment of the present invention is applied to a testing host, comprising:
[0056] Step S11: determining a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive, and obtaining a target port address from the target information table; wherein each port information table is established based on the slot number of the test host.
[0057] In this embodiment, the test host is connected to the target switch for communication; accordingly, each port information table is established based on the slot number of the test host, including: obtaining the slot number of the test host assigned by the target switch according to test-related factors through a preset allocation interface; wherein the test-related factors include any one or more factors of the device type of the test host, the number of slots of the target switch, the configuration information of the target switch, and the solid-state hard disk test requirements, and the solid-state hard disk test requirements include the solid-state hard disk test execution time and the consistency of the port test command; based on the slot number of the test host, each port of the solid-state hard disk is tracked to its corresponding physical connection position to obtain the port information of each port; wherein the port information includes the port drive letter, the port address, and the port namespace, and the port namespace is a logical space for addressing and data management; obtaining the port number of each port, and recording the mapping relationship between the slot number and the port information, so as to establish each port information table containing the mapping relationship, and determining the corresponding port number as the index of each port information table.
[0058] The test host is connected to the switch for communication, and the slot number of the test host is assigned by the switch and is stable and unchanged. Specifically, the switch may be a switch for expanding the connection capability of a PCIe (Peripheral Component Interconnect Express, i.e., a high-speed serial computer expansion bus standard) bus. The target switch assigns the slot number of the test host according to test-related factors. The test-related factors include any one or more of the device type of the test host, the number of slots of the target switch, the configuration information of the target switch, and the solid-state hard disk test requirements. The solid-state hard disk test requirements include the execution time of the solid-state hard disk test and the consistency of the port test command. When assigning the slot number of the test host, the target switch will comprehensively consider multiple factors such as the switch configuration rules, hardware characteristics and limitations, and test requirements, and meet the test requirements and improve the test efficiency through reasonable slot number allocation. Based on the slot number of the test host, the physical connection position corresponding to each port of the solid-state hard disk is tracked to obtain the port information of each port. The port information specifically includes the port letter, port address (Internet Protocol, i.e. IP), and port namespace. The port namespace is a logical space used for addressing and data management. Next, the port number of each port is obtained, and each port information table containing the mapping relationship between the slot number and the port information is established, and the corresponding port number is determined as the index of each port information table. The slot number of the test host is fixed, while the port information will change due to system configuration and driver updates. In the long-term testing process and complex system environment changes, the port information table is established based on the slot number of the test host, which can always accurately identify and track the port to be tested of the solid-state hard disk, avoiding problems such as disk identification errors or test confusion caused by changes in port information.
[0059] In this embodiment, obtaining the port number of each port includes: using the operating system and hardware driver of the test host to collect the port number of each port; and / or reading the metadata of the solid state drive and obtaining the port number of each port from the metadata.
[0060] By collecting the port numbers of each port through the operation of the operating system of the test host and its hardware driver, the accuracy and consistency of the data can be ensured. The operating system and driver are usually tightly integrated with the hardware and can provide the most accurate and latest hardware information. Most operating systems and hardware drivers support the collection of port information. Therefore, using the operating system and hardware driver of the test host to collect the port numbers of each port has wide compatibility and versatility. The metadata of the solid-state drive usually contains detailed information about the hard drive, including the port number, etc. By reading the metadata, complete and accurate port information can be obtained to avoid omissions or errors. Compared with direct hardware operation, reading metadata is usually a non-invasive method that does not cause physical damage to the hard drive, which helps to protect the integrity of the hard drive and data security. Metadata usually contains rich information and can selectively extract specific port information as needed. This flexibility can adapt to different testing needs and environments.
[0061] In this embodiment, the corresponding target information table is determined from each port information table based on the target port number of the port to be tested in the solid-state hard disk, including: determining the current port information table from each port information table, and judging whether the index of the current port information table corresponds to the target port number of the port to be tested in the solid-state hard disk; if the index of the current port information table does not correspond to the target port number, determining a new current port information table from each port information table, and jumping again to the step of judging whether the index of the current port information table corresponds to the target port number of the port to be tested in the solid-state hard disk; if the index of the current port information table corresponds to the target port number, determining the current port information table as the target information table.
[0062] It can be understood that, because when establishing each port information table, the index of each port information table is the port number, therefore, when the target port number of the port to be tested is determined, the target information table can be determined based on the target port number of the port to be tested, that is, the target information table whose index is the target port number is filtered out from each port information table. The specific filtering method can be to determine one by one whether the index of the current port information table corresponds to the target port number. If not, determine whether the index of the next port information table corresponds to the target port number, until the target information table whose index corresponds to the target port number is found.
[0063] Step S12: Assemble the general test command and the target port number to obtain a target test command.
[0064] In this embodiment, a general test command is assembled with a target port number to obtain a target test command, including: if the consistency of the port test command required by the solid-state hard disk test indicates that the test commands of each port in the solid-state hard disk are the same, then the general test command is assembled with the target port number to obtain a first target test command; if the consistency of the port test command required by the solid-state hard disk test indicates that the test commands of each port in the solid-state hard disk are different, then the corresponding target port information is obtained from the target information table, and the general test command is assembled with the target port number and the target port information to obtain a second target test command.
[0065] Depending on the different requirements for SSD testing, the assembly of the general test command and the target port number is also different. Specifically, if the SSD test requirement indicates that the test commands of each port in the SSD are the same, then only the general test command and the target port number can be assembled to obtain the first target test command. If the SSD test requirement indicates that the test commands of each port in the SSD are different, then it is also necessary to obtain the corresponding target port information from the target information table, and assemble the general test command with the target port number and the target port information to obtain the second target test command. If all ports need to perform the same test, a simplified command assembly process is used, saving Save time and resources. If different test commands are required for each port, the command can be customized according to the specific information of the port to ensure the accuracy and effectiveness of the test. For the same test command, the overhead of repeatedly assembling complex commands is avoided, and the test efficiency is improved. At the same time, for different test commands, the accuracy and pertinence of the command can be ensured by obtaining the necessary port information from the target information table, avoiding unnecessary errors and duplication of work. When processing a large number of port tests, the utilization of system resources can be optimized by intelligently selecting the appropriate test command assembly method. For example, in the case of the same test command, the commands can be processed in batches to reduce processing time and resource consumption.
[0066] In this embodiment, the target port information includes the target port drive letter and the target port namespace corresponding to the target port number, and the general test command is a command that is not affected by the port drive letter and the port namespace. First, the target port number is a unique identifier for each port, which enables the test system to distinguish and locate a specific port, and the target port drive letter corresponding to the target port number is the logical name used in the operating system to identify and access the port. This name plays a vital role in the file system and data management, which enables users and software to easily find and operate the data stored on the port. In addition, the target port namespace is also an important concept. It is a logical space used for address addressing and data management. It provides an organizational structure and access rules for data on the solid-state drive. The namespace enables the system to efficiently manage and access data in the port, and also helps to ensure the security and integrity of the data.
[0067] It should be noted that when constructing a test command, not all port information needs to be included. As a standardized test instruction, the original design of the general test command is to simplify the test process and improve the versatility of the test. Such commands are usually not affected by specific details such as the port drive letter and port namespace, but can directly act on the target port itself. This means that no matter how the drive letter or namespace of the target port changes, the general test command can remain unchanged and accurately perform its intended test task. This design not only improves the flexibility of the test, but also reduces the complexity and maintenance cost of the test command. When the test commands of each port in the SSD are different, by obtaining the specific target port information, that is, the target port drive letter and target port namespace, from the target information table, it can be ensured that each port receives the test command that matches its needs. This precision and pertinence helps to improve the accuracy and effectiveness of the test.
[0068] Step S13: If the target port address matches the address of the test host, the target test command is transmitted to the port to be tested via the transmission line between the local port and the port to be tested.
[0069] It is understandable that if the target port address matches the address of the test host, it means that the port to be tested is local to the test host. Therefore, the test host can use the local transmission line to send the test command directly to the port to be tested. The local transmission line can specifically be Ethernet or Universal Serial Bus (USB). This transmission method usually has the characteristics of high speed, low latency and low resource consumption, and is suitable for the situation where the test host and the port to be tested are in the same local area network or physically close.
[0070] Step S14: If the target port address does not match the address of the test host, the target test command is sent to the port to be tested through the remote connection tunnel.
[0071] When the target port address does not match the address of the test host, it means that the port to be tested is not local to the test host. The test host needs to establish a remote connection tunnel to send the test command. The remote connection tunnel can be established through various network protocols, such as SSH (Secure Shell) and VPN (Virtual Private Network) to ensure the security and reliability of data transmission. After the remote connection tunnel is established, the target test command is sent to the port to be tested through the remote connection tunnel.
[0072] Furthermore, in the process of sending the target test command to the port to be tested through the remote connection tunnel, the target test command can be encrypted first and the encrypted command can be transmitted to the port to be tested. The specific process is: 1) determine the remote address of the port to be tested; 2) select a suitable target encryption algorithm and target key to ensure the security and reliability of the encryption process; 3) use the target encryption algorithm and target key to encrypt the target test command to obtain an encrypted target test command, wherein the data format of the encrypted target test command meets the preset requirements of the remote connection tunnel for smooth transmission; 4) establish a remote connection tunnel between the test host and the port to be tested based on the remote address of the port to be tested, ensure the security of the data transmission channel, and configure the corresponding connection parameters and authentication information according to the selected tunnel protocol; 5) transmit the encrypted target test command to the port to be tested through the remote connection tunnel. In this way, encryption processing can ensure that the target test command is not eavesdropped or tampered with during transmission, thereby protecting the confidentiality and integrity of the test data. The encrypted data has stronger anti-interference ability during transmission and can resist risks such as network attacks and data corruption. By selecting appropriate encryption algorithms and key management strategies, the compatibility of test data between different devices and platforms can be ensured.
[0073] Step S15: receiving the test result returned by the solid state drive based on the target test command.
[0074] The SSD generates test results based on the target test command, so that the test host can receive the test results returned by the SSD. Furthermore, if the encrypted target test command is received at the port to be tested, it is also necessary to use the corresponding decryption algorithm and key to decrypt the command and verify the consistency between the decrypted test command and the target test command to ensure the accuracy of data transmission.
[0075] It can be seen that the present invention is applied to a test host, including: determining a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid-state hard disk, and obtaining a target port address from the target information table; wherein each port information table is established based on the slot number of the test host; assembling a general test command with the target port number to obtain a target test command; if the target port address matches the address of the test host, transmitting the target test command to the port to be tested via a transmission line between the local and the port to be tested; if the target port address does not match the address of the test host, sending the target test command to the port to be tested via a remote connection tunnel; and receiving a test result returned by the solid-state hard disk based on the target test command.
[0076] The beneficial effects are as follows: the slot number of the test host is fixed, while the port information will change due to system configuration and driver updates. In the long-term testing process and complex system environment changes, a port information table is established based on the slot number of the test host, which can always accurately identify and track the port to be tested of the solid-state hard disk, avoiding problems such as disk identification errors or test confusion caused by changes in port information; the general test command is assembled with the target port number to obtain the target test command. The general test command provides basic test function logic, and after being assembled in combination with the target port number, the generated target test command can be accurately adapted to a specific port; if the target port address matches the address of the test host , it means that the current test is a local port test, so the target test command can be directly sent to the port to be tested, that is, the target test command is transmitted to the port to be tested through the transmission line between the local and the port to be tested. If the target port address does not match the address of the test host, the current test is not a local port test. At this time, the target test command is sent to the port to be tested through the remote connection tunnel. It is not necessary to send the target test command through the remote connection tunnel every time. In this way, the command sending delay is effectively reduced, and the test host does not need to frequently establish a remote connection with the solid-state drive, thereby reducing the resources of the test host. The solid-state drive processes the target test command received by the test port, thereby receiving the test result of the solid-state drive.
[0077] See also Figure 2 The embodiment of the present invention discloses a specific solid state hard disk test method. Compared with the previous embodiment, this embodiment further illustrates and optimizes the technical solution. It is applied to a test host and includes:
[0078] Step S21: If the port test mode of the solid state drive is a single-port test mode, the single port of the solid state drive is determined as the port to be tested; if the port test mode of the solid state drive is a multi-port test mode, the port to be tested is randomly determined from the ports of the solid state drive based on a preset port balance test principle.
[0079] The port on one side of the SSD is also called an interface. Its electrical signal is defined by the interface specification, and the number depends on the design of the controller chip (Controller IC, also including RoC). The interfaces of hard disks, HBA (Host Bus Adapter) cards, etc. are physically pins and connectors. In the case of a single port, a disk cannot be connected to two storage controllers at the same time. For example, Figure 3 A specific dual-port solid-state drive schematic diagram is shown. The dual ports enable a disk to be connected to two different storage controllers, allowing the other controller to still access the hard disk when one of the storage controllers or the link between the disk fails, thereby improving system high availability and ensuring business continuity.
[0080] Furthermore, the port of the solid-state drive can be a single port or a multi-port. When it is a single port, the port test mode of the solid-state drive is a single-port test mode, and only one test host can be connected. When it is a multi-port, the port test mode of the solid-state drive is a multi-port test mode, and multiple test hosts can be connected.
[0081] If the port test mode of the solid-state drive is a single-port test mode, the single port of the solid-state drive is determined as the port to be tested. Since the solid-state drive has only one port to be tested, this port can be directly determined as the port to be tested. If the port test mode of the solid-state drive is a multi-port test mode, multiple ports to be tested are randomly determined from the ports of the solid-state drive based on a preset port balance test principle. That is to say, if there are multiple ports to be tested, multiple ports to be tested can be randomly determined from these multiple ports. The preset port balance test principle means that the number of times each port is used as a port to be tested is relatively balanced, thereby improving the comprehensiveness of the test.
[0082] Step S22: determining a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive, and obtaining a target port address from the target information table; wherein each port information table is established based on the slot number of the test host.
[0083] In the process of establishing each port information table based on the slot number of the test host, the information such as the drive letter and namespace of the solid-state drive on the port is collected. Since the drive letter is not fixed, the stable PCIe slot number is used to track the solid-state drive in this test system. At the same time, since the drive letters of the solid-state drive on different ports are different, but the slot numbers of the two hosts are allocated through a switch (pcie switch), there is a corresponding relationship between the slot numbers of each port, and a slot number mapping table is established. The slot number corresponding to the port of the test host can be used to obtain the slot number of another port, and then the drive letter of the SSD disk on each port is obtained from the slot numbers of the two ports, and then the namespace is obtained. The test system includes a test disk and a port information storage module, which uniformly stores the drive letter, namespace, slot number and port IP in the port information table, and then stores each port information table in the test disk and port information storage module, and the port number is used as the storage index.
[0084] Namespace refers to the logical space inside the SSD for addressing and data management. It defines the scope and structure of the storage space that the SSD can access and manage. In the NVMe (NVM Express, i.e., non-volatile memory host controller interface specification) protocol, namespace is a core concept. NVMe defines how to access non-volatile memory through the PCIe interface, where namespace is a way to manage storage resources. Each NVMe SSD can have one or more namespaces.
[0085] Step S23: Assemble the general test command and the target port number to obtain the target test command.
[0086] For example Figure 4 A specific test system schematic diagram is shown, the test system includes a test command assembly module, the test command assembly module is used to assemble a general test command with a target port number to obtain a target test command; it can be understood that if it is a single-port test mode, the number of target test commands obtained after assembly N=1, if the port test mode of the solid state drive is a multi-port test mode, the number of target test commands obtained after assembly N≥2.
[0087] Step S24: If the target port address matches the address of the test host, the target test command is transmitted to the port to be tested via the transmission line between the local port and the port to be tested.
[0088] The test system includes a test execution module. If the target port address matches the address of the test host, the test execution module transmits the target test command to the port to be tested through a transmission line between the local port and the port to be tested.
[0089] Step S25: If the target port address does not match the address of the test host, the target test command is sent to the port to be tested through the remote connection tunnel.
[0090] The test system includes a test execution module. If the target port address does not match the address of the test host, the test execution module sends the target test command to the port to be tested through a remote connection tunnel.
[0091] Step S26: receiving the test result returned by the solid state drive based on the target test command.
[0092] It can be seen that by randomly selecting ports and verifying the balanced functions of the two ports, the test accuracy is improved, the command assembly method is improved, the command accuracy is ensured, and the test script is simplified. The command issuance method is optimized to reduce time loss and improve test efficiency. Single-port and dual-port tests are automatically switched, and there is no need to write two sets of test scripts for single-port and dual-port tests, which simplifies the entire test system and has high maintainability. It is highly scalable and is not only suitable for dual-port situations, but can also be expanded to test scenarios with more than M ports (M≥3). It only needs to use the test host where any of the ports is located as the host for script execution.
[0093] Figure 5 A structural diagram of a solid state drive testing device provided by an embodiment of the present invention, which is applied to a testing host, includes:
[0094] The information table determination module 11 is used to determine the corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive, and obtain the target port address from the target information table; wherein each port information table is established based on the slot number of the test host;
[0095] A test command assembling module 12, used for assembling a general test command with a target port number to obtain a target test command;
[0096] A first command sending module 13, configured to transmit a target test command to the port to be tested via a transmission line between the local port and the port to be tested if the target port address matches the address of the test host;
[0097] A second command sending module 14 is used to send a target test command to the port to be tested through a remote connection tunnel if the target port address does not match the address of the test host;
[0098] The test result receiving module 15 is used to receive the test result returned by the solid state drive based on the target test command.
[0099] It can be seen that the present invention is applied to a test host, including: determining a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid-state hard disk, and obtaining a target port address from the target information table; wherein each port information table is established based on the slot number of the test host; assembling a general test command with the target port number to obtain a target test command; if the target port address matches the address of the test host, transmitting the target test command to the port to be tested via a transmission line between the local and the port to be tested; if the target port address does not match the address of the test host, sending the target test command to the port to be tested via a remote connection tunnel; and receiving a test result returned by the solid-state hard disk based on the target test command.
[0100] The beneficial effects are as follows: the slot number of the test host is fixed, while the port information will change due to system configuration and driver updates. In the long-term testing process and complex system environment changes, a port information table is established based on the slot number of the test host, which can always accurately identify and track the port to be tested of the solid-state hard disk, avoiding problems such as disk identification errors or test confusion caused by changes in port information; the general test command is assembled with the target port number to obtain the target test command. The general test command provides basic test function logic, and after being assembled in combination with the target port number, the generated target test command can be accurately adapted to a specific port; if the target port address matches the address of the test host , it means that the current test is a local port test, so the target test command can be directly sent to the port to be tested, that is, the target test command is transmitted to the port to be tested through the transmission line between the local and the port to be tested. If the target port address does not match the address of the test host, the current test is not a local port test. At this time, the target test command is sent to the port to be tested through the remote connection tunnel. It is not necessary to send the target test command through the remote connection tunnel every time. In this way, the command sending delay is effectively reduced, and the test host does not need to frequently establish a remote connection with the solid-state drive, thereby reducing the resources of the test host. The solid-state drive processes the target test command received by the test port, thereby receiving the test result of the solid-state drive.
[0101] Furthermore, the present application also discloses an electronic device. Figure 6 It is a structural diagram of an electronic device according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input and output interface 25 and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the solid state drive test method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0102] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0103] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0104] The operating system 221 is used to manage and control various hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the solid-state hard disk test method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0105] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the solid-state hard disk test method disclosed above. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0106] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0107] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0108] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0109] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0110] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A solid state hard disk testing method, characterized in that: Applicable to test hosts, including: Determine the corresponding target information table from each port information table based on the target port number of the port to be tested in the solid-state hard disk, and obtain the target port address from the target information table; wherein each of the port information tables is established based on the slot number of the test host; Assembling the general test command with the target port number to obtain a target test command; If the target port address matches the address of the test host, the target test command is transmitted to the port to be tested via a transmission line between the local device and the port to be tested; If the target port address does not match the address of the test host, sending the target test command to the port to be tested through a remote connection tunnel; Receive a test result returned by the solid state drive based on the target test command.
2. The solid state drive testing method according to claim 1, characterized in that: Before determining the corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state hard disk, the method further includes: If the port test mode of the solid state hard disk is a single-port test mode, determining the single port of the solid state hard disk as the port to be tested; If the port test mode of the solid state drive is a multi-port test mode, a port to be tested is randomly determined from the ports of the solid state drive based on a preset port balance test principle.
3. The solid state drive testing method according to claim 1, characterized in that: The test host is in communication connection with the target switch; Correspondingly, each port information table is established based on the slot number of the test host, including: Obtaining the slot number of the test host assigned by the target switch according to test-related factors through a preset allocation interface; wherein the test-related factors include any one or more of the device type of the test host, the number of slots of the target switch, the configuration information of the target switch, and solid-state hard disk test requirements, and the solid-state hard disk test requirements include solid-state hard disk test execution time and consistency of port test commands; Tracking the physical connection position of each port of the solid-state drive and the solid-state drive itself based on the slot number of the test host to obtain port information of each port; wherein the port information includes a port drive letter, a port address, and a port namespace, and the port namespace is a logical space used for addressing and data management; The port number of each port is obtained, and the mapping relationship between the slot number and the port information is recorded to establish each port information table containing the mapping relationship, and the corresponding port number is determined as the index of each port information table.
4. The solid state drive testing method according to claim 3, characterized in that: The obtaining of the port number of each port includes: Using the operating system and hardware driver of the test host to collect the port number of each port; And / or, reading metadata of the solid state drive, and obtaining a port number of each port from the metadata.
5. The solid state drive testing method according to claim 3, characterized in that: The step of determining a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive includes: Determine a current port information table from each port information table, and determine whether an index of the current port information table corresponds to a target port number of a port to be tested in the solid state drive; If the index of the current port information table is not in a corresponding relationship with the target port number, a new current port information table is determined from each of the port information tables, and the process jumps again to the step of determining whether the index of the current port information table is in a corresponding relationship with the target port number of the port to be tested in the solid state drive; If the index of the current port information table is in a corresponding relationship with the target port number, the current port information table is determined as the target information table.
6. The solid state drive testing method according to any one of claims 3 to 5, characterized in that: The step of assembling the general test command with the target port number to obtain the target test command includes: If the consistency of the port test command required by the solid state drive test indicates that the test commands of the ports in the solid state drive are the same, assembling the common test command with the target port number to obtain a first target test command; If the consistency of the port test command required by the solid-state hard drive test indicates that the test commands of each port in the solid-state hard drive are different, the corresponding target port information is obtained from the target information table, and the general test command is assembled with the target port number and the target port information to obtain a second target test command.
7. The solid state drive testing method according to claim 6, characterized in that: The target port information includes a target port drive letter and a target port namespace corresponding to the target port number, and the general test command is a command not affected by the port drive letter and the port namespace.
8. A solid state hard disk testing device, characterized in that: Applicable to test hosts, including: An information table determination module, used to determine a corresponding target information table from each port information table based on the target port number of the port to be tested in the solid state drive, and obtain a target port address from the target information table; wherein each of the port information tables is established based on the slot number of the test host; A test command assembling module, used for assembling a general test command with the target port number to obtain a target test command; A first command sending module, configured to transmit the target test command to the port to be tested via a transmission line between the local device and the port to be tested if the target port address matches the address of the test host; A second command sending module, configured to send the target test command to the port to be tested through a remote connection tunnel if the target port address does not match the address of the test host; The test result receiving module is used to receive the test result returned by the solid state drive based on the target test command.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the solid state drive testing method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the solid-state hard disk testing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for adjusting hard disk starting sequence in user mode, equipment and medium
CN112540889A
Method for testing terminal equipment based on test switch and test switch network
CN116760756A
Firmware mode switching method and device, electronic equipment and storage medium
CN117707436A
Solid state disk firmware debugging method, system and device, computer equipment and storage medium
CN118409964A
Systems and methods for testing how computer systems interact with long-term memory storage devices
US20060111889A1