Solid-state drive testing method, device, equipment, and medium
By establishing a port information table based on slot numbers in the test host, identifying and tracking SSD ports, and using local or remote connection tunnels to send test commands, the problem of resource and time waste in SSD testing is solved, and test efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411996987.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-12-30
AI Technical Summary
The existing technology has the problem of wasting resources and time in solid-state drive testing, especially when frequently connecting the test host and the solid-state drive, the remote connection delay leads to low efficiency.
By establishing a port information table based on slot numbers in the test host, identifying and tracking the ports to be tested, and assembling test commands according to the target port numbers, the test commands are sent using local transmission lines or remote connection tunnels, reducing the frequent use of remote connections.
It effectively reduces test time and resource consumption, improves test efficiency, avoids recognition errors and test confusion caused by port information changes, and ensures the accuracy and flexibility of test commands.
Smart Images

Figure CN119851742B_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] A solid-state drive (SSD) is a hard drive made using an array of solid-state electronic storage integrated circuits. Because it lacks moving parts, SSDs offer significant advantages over traditional hard disk drives (HDDs) that use magnetic heads in terms of read / write speed, energy consumption, and shock resistance. SSDs are widely used in personal computers, servers, and various mobile devices, and are essential storage devices in modern computer systems.
[0003] Solid-state drives are divided into single-port and multi-port types. Dual-port drives have three working modes: active-active mode, link redundancy mode, and master-slave mode. Regardless of the test mode, the test method is to select a fixed port, fill in the relevant parameters according to the selected port information, assemble the command, select the corresponding test command 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 solid-state drive through a remote connection with the solid-state drive. Therefore, the solid-state drive 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 required for SSD testing is a problem that those skilled in the art 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, apparatus, device, and medium to reduce the time and resources required for solid-state drive testing. The specific solution is as follows:
[0006] In a first aspect, the present invention discloses a solid-state hard drive testing method, which is applied to a testing host and includes:
[0007] 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;
[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 results 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 the 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 with the target switch;
[0016] Accordingly, a port information table is established based on the slot number of the test host, including:
[0017] Obtaining, through a preset allocation interface, a slot number of the test host assigned by the target switch based on test-related factors; wherein the test-related factors include any one or more of the following factors: the device type of the test host, the number of slots of the target switch, configuration information of the target switch, and solid-state drive test requirements; the solid-state drive test requirements include solid-state drive test execution time and consistency of port test commands;
[0018] Based on the slot number of the test host, the physical connection location of each port of the solid-state drive is tracked to obtain the port information of each port. The port information includes the port letter, port address, and port namespace. 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, read metadata of the solid state drive and obtain 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 does not correspond to 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 corresponds to 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 corresponds to the target port number, the current port information table is determined as the target information table.
[0027] Optionally, assemble the general test command with the target port number to obtain the 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 and the target port number to obtain a first target test command;
[0029] 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.
[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 and includes:
[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 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;
[0033] A test command assembly module is used to assemble 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, configured 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;
[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 through 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 through 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 test 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 sent directly 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 test ports. 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, 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 results 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 is a brief introduction to 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 any 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 drive 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 structural diagram 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 clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0051] A solid-state drive (SSD) is a hard drive made using an array of solid-state electronic storage integrated circuits. Because it lacks moving parts, SSDs offer significant advantages over traditional mechanical hard drives (HDDs) that use magnetic heads in terms of read / write speed, energy consumption, and shock resistance. SSDs are widely used in personal computers, servers, and various mobile devices, and are essential storage devices in modern computer systems.
[0052] Solid-state drives are divided into single-port and multi-port types. Dual-port drives have three working modes: active-active mode, link redundancy mode, and master-slave mode. Regardless of the test mode, the test method is to select a fixed port, fill in the relevant parameters according to the selected port information, assemble the command, select the corresponding test command 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 solid-state drive through a remote connection with the solid-state drive. Therefore, the solid-state drive 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," as used in the present description and accompanying drawings, and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements and may include steps or elements that are not listed.
[0054] In order to enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to 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 communicatively connected to the target switch; 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 drive test requirements, and the solid-state drive test requirements include the solid-state drive 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 drive is tracked relative to the physical connection position corresponding to itself to obtain the port information of each port; wherein the port information includes the port drive letter, the port address, and the port namespace, which is a logical space used 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 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 communicatively connected to the switch. The slot number of the test host is assigned by the switch and remains stable. Specifically, the switch may be a switch for expanding the bus connectivity of PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard). The target switch assigns the slot number of the test host based on test-related factors, including any one or more of the following: the device type of the test host, the number of slots on the target switch, configuration information of the target switch, and solid-state drive test requirements. The solid-state drive test requirements include solid-state drive test execution time and consistency of port test commands. When assigning the slot number of the test host, the target switch comprehensively considers multiple factors, including switch configuration rules, hardware characteristics and limitations, and test requirements. Through reasonable slot number allocation, the test requirements are met and test efficiency is improved. Based on the slot number of the test host, each port of the solid-state drive is tracked to its corresponding physical connection position to obtain the port information of each port. The port information specifically includes the port drive letter, port address (Internet Protocol, or 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. It can always accurately identify and track the port to be tested of the solid-state drive, 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] Collecting the port number of each port through the operation of the test host's operating system and its hardware drivers ensures data accuracy and consistency. Operating systems and drivers are typically tightly integrated with the hardware, providing the most accurate and up-to-date hardware information. Most operating systems and hardware drivers support the collection of port information, so using the test host's operating system and hardware drivers to collect the port number of each port has broad compatibility and versatility. SSD metadata typically contains detailed information about the drive, including port numbers. By reading metadata, complete and accurate port information can be obtained, avoiding omissions or errors. Compared to directly manipulating the hardware, reading metadata is typically a non-invasive method that does not cause physical damage to the drive, which helps protect the drive's integrity and data security. Metadata typically contains rich information, and specific port information can be selectively extracted 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, then determining a new current port information table from each port information table, and re-jumping 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, then 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, the general test command is assembled with the target port number to obtain the 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 of the solid-state drive test, the assembly of the general test command and the target port number is also different. Specifically, if the solid-state drive test requirement indicates that the test commands of each port in the solid-state drive 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 solid-state drive test requirement indicates that the test commands of each port in the solid-state drive are different, 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, and the second target test command is obtained. 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, allowing users and software to easily find and operate 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 is important to note that not all port information needs to be included when constructing a test command. Universal test commands, as standardized test instructions, are designed to simplify the testing process and improve test versatility. These commands are typically unaffected by specific details such as the port drive letter and port namespace, but instead act directly on the target port itself. This means that regardless of how the target port's drive letter or namespace changes, the universal test command remains unchanged and accurately performs its intended test task. This design not only improves test flexibility but also reduces the complexity and maintenance cost of test commands. When the test commands for each port in an SSD are different, obtaining the specific target port information, namely the target port drive letter and target port namespace, from the target information table ensures that each port receives the test command that matches its requirements. This precision and targeting helps 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 situations where the test host and the port to be tested are in the same local area network or physically close to each other.
[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) determining the remote address of the port to be tested; 2) selecting a suitable target encryption algorithm and target key to ensure the security and reliability of the encryption process; 3) using 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) establishing 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, ensuring the security of the data transmission channel, and configuring the corresponding connection parameters and authentication information according to the selected tunnel protocol; 5) transmitting 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 commands are not eavesdropped or tampered with during transmission, thereby protecting the confidentiality and integrity of the test data. The encrypted data has stronger anti-interference capabilities 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 across 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, allowing the test host to receive the test results returned by the SSD. Furthermore, if the tested port receives an encrypted target test command, it must decrypt it using the corresponding decryption algorithm and key to verify the decrypted test command's consistency with the target test command, ensuring accurate 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 through 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 through 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 test 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 sent directly 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 test ports. 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, 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 results of the solid-state drive.
[0077] See also Figure 2 The present invention discloses a specific solid-state drive testing 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 balancing test principle.
[0079] The port on one side of the SSD is also called the interface. Its electrical signal is defined by the interface specification, and the number depends on the design of the 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 The figure shows a specific dual-port solid-state drive. The dual ports enable a single drive to be connected to two different storage controllers. This allows the other controller to still access the drive when one of the storage controllers or the link between the drive fails, 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 it can only connect to one test host. When it is a multi-port, the port test mode of the solid-state drive is a multi-port test mode, and it can connect to multiple test hosts.
[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 the preset port balanced test principle. In other words, if there are multiple ports to be tested, multiple ports to be tested can be randomly determined from these multiple ports. The preset port balanced 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] When establishing each port information table based on the test host's slot number, information such as the drive letter and namespace of the SSD on that port is collected. Because drive letters are not fixed, the test system uses the stable PCIe slot number to track SSDs. Furthermore, since the drive letters of SSDs on different ports are different, the slot numbers of the two hosts are assigned via a switch, and the slot numbers of each port correspond to each other, a slot number mapping table is established. The slot number corresponding to the test host's port can be used to determine the slot number of the other port. The slot numbers of both ports are then used to obtain the drive letter and namespace of the SSD on each port. The test system includes a test disk and a port information storage module. The drive letter, namespace, slot number, and port IP address are stored in a port information table. Each port information table is then stored in the test disk and port information storage module, with the port number serving as the storage index.
[0084] A namespace is a logical space within an SSD used for addressing and data management. It defines the scope and structure of the storage space the SSD can access and manage. Namespaces are a core concept in the NVMe (NVM Express) protocol, which defines how to access non-volatile memory through the PCIe interface. Namespaces are a way to manage storage resources, and 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, and the test system includes a test command assembly module, which 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 is N=1, and 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 is 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 the 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 the remote connection tunnel.
[0091] Step S26: receiving the test result returned by the solid state drive based on the target test command.
[0092] As can be seen, by randomly selecting ports and verifying the balanced functionality of both ports, test accuracy is improved. Improved command assembly ensures command accuracy while simplifying test scripts. Optimized command issuance reduces time loss and improves test efficiency. Automatic switching between single-port and dual-port testing eliminates the need to write two separate test scripts for single-port and dual-port testing, simplifying the entire test system and enhancing maintainability. This system is highly scalable, not only for dual-port testing but also for testing scenarios with M or more ports (M ≥ 3). Simply select the test host where any port resides as the script execution host.
[0093] Figure 5 A structural diagram of a solid-state drive testing device provided in an embodiment of the present invention, which is applied to a testing host, includes:
[0094] An information table determination module 11 is configured 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 port information table is established based on the slot number of the test host;
[0095] A test command assembling module 12 is used to assemble a general test command with a target port number to obtain a target test command;
[0096] A first command sending module 13 is 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 configured 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 through 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 through 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 test 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 sent directly 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 test ports. 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, 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 results of the solid-state drive.
[0101] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 6 This is a structural diagram of an electronic device according to an exemplary embodiment. The content in the diagram should not be considered 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 / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the solid-state drive testing 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 operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this 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. 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 resource storage, can be a read-only memory, random access memory, disk or CD, 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 the 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 capable of implementing the solid-state drive testing method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program capable of implementing other specific tasks.
[0105] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when executed by a processor, the computer program implements the aforementioned solid-state drive testing method. The specific steps of this method can be referred to the corresponding contents disclosed in the aforementioned embodiments and will not be repeated here.
[0106] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[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 above description has generally described the components and steps of each example according to their functions. 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 beyond the scope of this application.
[0108] The steps of the methods or algorithms 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 random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, 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 document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0110] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein 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 those skilled in the art, according to the ideas of the present application, there may 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 drive testing method, characterized in that: Applicable to test hosts, 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 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; 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, transmitting 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 does not match the address of the test host, sending the target test command to the port to be tested through the 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, wherein: 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, wherein: The test host is in communication with the target switch; Accordingly, each port information table is established based on the slot number of the test host, including: Obtaining, through a preset allocation interface, a slot number of the test host assigned by the target switch based on test-related factors; wherein the test-related factors include any one or more of the following: a device type of the test host, a number of slots of the target switch, configuration information of the target switch, and solid-state drive test requirements; wherein the solid-state drive test requirements include solid-state drive 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, wherein 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, wherein: 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 the port number of each port from the metadata.
5. The solid state drive testing method according to claim 3, wherein: 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: Determining a current port information table from each port information table, and judging 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 hard disk; If the index of the current port information table does not correspond to 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 corresponds to the target port number of the port to be tested in the solid-state drive; If the index of the current port information table corresponds to 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, wherein: Assembling the general test command with the target port number to obtain the target test command includes: If the consistency of the port test commands 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, wherein: 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 drive testing device, characterized in that: Applicable to test hosts, including: An information table determination module, configured 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 port information table is established based on the slot number of the test host; A test command assembling module, configured to assemble 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 according to 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.