Method, device and equipment for clearing cache report based on Google MTT tool, storage medium and product
Obtain permissions in the Linux environment through shell scripts and iterate through the file system of Google MTT tool, and automatically clear test reports and cache files, solving the performance degradation caused by the accumulation of test reports and cache files in the device, and achieving efficient and automated cache manage.
Patent Information
- Application Number
- CN202411271823.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2025-02-07
AI Technical Summary
When conducting Google GMS certification test, after the Android device performs XTS test through Google MTT tool, the generated test reports and cache files accumulate, occupying storage space, resulting in system performance degradation or test process crashes, and the existing technology lacks efficient and automated Cleaning method.
Obtain permissions in the Linux environment through shell scripts, set read, write and execute permissions for the file system of Google MTT tool, traverse the file path, determine whether there is a storage path, and delete the corresponding report and cache files if there is.
Implements automated clearance of cached reports generated by Google MTT tools, reducing the complexity and error rate of manual operations, improving the efficiency and accuracy of cleaning, preventing system performance or crashing of test processes, and improving the Google MTT tools during testing. stability and work efficiency.
Smart Images

Figure CN119397521A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer system technology, and in particular to a method, apparatus, device, storage medium and product for clearing cache reports based on the Google MTT tool. Background Art
[0002] When conducting the Google GMS certification test, Android devices (such as tablets, mobile phones, etc.) need to perform XTS testing through the Google MTT tool. During this process, the Google MTT tool will generate a large number of test reports and cache files. These files accumulate over time, not only taking up storage space, but also may cause system performance to degrade or even crash the test process. In the prior art, users usually need to manually find and delete these files. This operation is not only cumbersome and error-prone, but the Google MTT tool does not directly provide the function of clearing cache reports. Therefore, there is an urgent need for an efficient and automated method to clear the cache reports generated by the Google MTT tool to avoid wasting system resources and performance degradation, and to improve the stability and efficiency of the testing process. Summary of the invention
[0003] The main purpose of this application is to provide a method, device, equipment, storage medium and product for clearing cache reports based on the Google MTT tool, aiming to solve the technical problem of how to improve the efficiency of Google GMS certification testing.
[0004] To achieve the above purpose, the present application provides a method for clearing cache reports based on the Google MTT tool, the method comprising the following steps:
[0005] Obtain permissions in the Linux environment through a shell script and set read, write, and execute permissions for the file system of the Google MTT tool;
[0006] Traverse the file path in the Google MTT tool;
[0007] Determine whether there is a storage path in the file path;
[0008] If so, delete the report and cache files corresponding to the storage path.
[0009] In one embodiment, after the step of deleting the report and cache file corresponding to the storage path, the method further includes:
[0010] If not, create new report and cache file storage paths.
[0011] In one embodiment, before the step of deleting the report and cache file corresponding to the storage path, the method further includes:
[0012] Creating a backup directory in the file system of the Google MTT tool through the Shell script;
[0013] copying the report and cache files to the backup directory;
[0014] The copied report and cache files are verified for integrity and consistency.
[0015] In one embodiment, after the step of verifying the integrity and consistency of the copied report and cache file, the method further includes:
[0016] Detecting the process status of the Google MTT tool through the Shell script, and obtaining the process ID of the Google MTT tool based on a preset process acquisition command;
[0017] Determine whether the process ID exists;
[0018] If it exists, issue a pause and clear command;
[0019] If it does not exist, issue a clear execution command.
[0020] In one embodiment, the method further comprises:
[0021] Creating a log file in the Shell script;
[0022] Writing the report and cache file deletion time, file quantity and file path list into the log file;
[0023] The log file is stored in a preset log storage location.
[0024] In one embodiment, the method further comprises:
[0025] Re-traversing the file path of the GoogleMTT tool using the Shell script;
[0026] Use the preset cache file search command to find and clear the report and cache files in the path;
[0027] If there are reports and cache files in the search results, perform the clear operation again.
[0028] In addition, to achieve the above purpose, the present application also proposes a device for clearing cache reports based on the Google MTT tool, and the device for clearing cache reports based on the Google MTT tool includes:
[0029] A permission acquisition module, used to obtain permissions in a Linux environment through a Shell script, and set read, write, and execute permissions for the file system of the Google MTT tool;
[0030] A traversal module, used to traverse the file path in the Google MTT tool;
[0031] A judging module, used for judging whether there is a storage path in the file path;
[0032] The clearing module is used to delete the report and cache files corresponding to the storage path.
[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a device for clearing cache reports based on the Google MTT tool, wherein the device includes: a memory, a processor, and a program for clearing cache reports based on the Google MTT tool stored on the memory and executable on the processor, wherein the program for clearing cache reports based on the Google MTT tool is configured to implement the steps of the method for clearing cache reports based on the Google MTT tool as described above.
[0034] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, on which is stored a program for clearing cache reports based on the Google MTT tool. When the program for clearing cache reports based on the Google MTT tool is executed by a processor, the steps of the method for clearing cache reports based on the Google MTT tool as described above are implemented.
[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the method for clearing cache reports based on the Google MTT tool as described above.
[0036] This application obtains permissions in the Linux environment through a Shell script, sets read, write, and execute permissions for the file system of the Google MTT tool; traverses the file path in the Google MTT tool; determines whether a storage path exists in the file path; if so, deletes the report and cache files corresponding to the storage path. This application obtains permissions in the Linux environment through a Shell script and sets read, write, and execute permissions for the file system of the Google MTT tool. It can automatically traverse the file path, determine and delete the reports and cache files in the storage path, reducing the complexity and error rate of manual operations, and improving the efficiency and accuracy of clearing cached reports, thereby preventing system performance degradation or test process crashes due to too many cached files, and effectively improving the stability and work efficiency of the Google MTT tool during the test process. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a flowchart of the first embodiment of the method for clearing cache reports based on the Google MTT tool in this application;
[0038] Figure 2 This is a schematic diagram of a sub-flow in the second embodiment of the method for clearing cache reports based on the Google MTT tool of this application;
[0039] Figure 3 This is a schematic diagram of a sub-flow in the third embodiment of the method for clearing cache reports based on the Google MTT tool of this application;
[0040] Figure 4 This is a flow chart of the application principle in an embodiment of a method for clearing cache reports based on the Google MTT tool in this application;
[0041] Figure 5 This is a schematic diagram of the module structure of a device for clearing cache reports based on the Google MTT tool in an embodiment of the present application;
[0042] Figure 6 This is a schematic diagram of the device structure of the hardware operating environment involved in the method for clearing cache reports based on the Google MTT tool in an embodiment of the present application.
[0043] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0046] It should be noted that when conducting the Google GMS certification test, Android devices (such as tablets, mobile phones, etc.) need to perform XTS testing through the Google MTT tool. During this process, the Google MTT tool will generate a large number of test reports and cache files. These files accumulate over time, not only taking up storage space, but also may cause system performance to degrade or even crash the test process. In the prior art, users usually need to manually find and delete these files. This operation is not only cumbersome and error-prone, but the Google MTT tool does not directly provide the function of clearing cache reports. Therefore, there is an urgent need for an efficient and automated method to clear the cache reports generated by the Google MTT tool to avoid wasting system resources and performance degradation, and to improve the stability and efficiency of the testing process.
[0047] The main solution of this application is: obtain permissions in the Linux environment through Shell scripts, set read, write and execute permissions for the file system of the GoogleMTT tool; traverse the file path in the Google MTT tool; determine whether there is a storage path in the file path; if so, delete the report and cache files corresponding to the storage path.
[0048] This application obtains permissions in the Linux environment through Shell scripts and sets read, write, and execute permissions for the file system of the Google MTT tool. It can automatically traverse the file path, determine and delete the report and cache files in the storage path, reduce the complexity and error rate of manual operations, and improve the efficiency and accuracy of clearing cache reports, thereby preventing system performance degradation or test process crashes due to too many cache files, and effectively improving the stability and work efficiency of the Google MTT tool during the test process.
[0049] It should be noted that the execution subject of the method of this embodiment can be a computing service device with data processing, network communication and program running functions, or it can be the above-mentioned device based on the Google MTT tool to clear the cache report with the same or similar functions. This embodiment and the following embodiments will be described by taking the device based on the Google MTT tool to clear the cache report as an example.
[0050] Based on this, the first embodiment of the method for clearing cache reports based on the Google MTT tool is proposed. Please refer to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for clearing cache reports based on the Google MTT tool in this application.
[0051] In this embodiment, the method for clearing cache reports based on the Google MTT tool includes the following steps:
[0052] S1: Obtain permissions in the Linux environment through a shell script to set read, write, and execute permissions for the file system of the Google MTT tool;
[0053] It should be noted that Shell script is a scripting language used to automate command line tasks. By writing script files, users can automatically execute a series of commands in the Linux operating system. Shell scripts are often used in scenarios such as system management, file operations, batch processing tasks, and automated testing. Linux is an open source operating system based on Unix, widely used in servers, embedded systems, and personal computers. The Linux environment refers to the operating system and command line interface used on computing devices with the Linux operating system installed. In the Linux file system, permissions determine the access level of users or processes to files and directories, including read (Read), write (Write), and execute (Execute) permissions. By adjusting the file system permissions, the user or process's ability to operate files and directories can be controlled. Google Mobile Testing Tool (MTT) is a testing tool for Android devices, commonly used in the testing process of Google GMS certification. The test reports and cache files generated by the tool are stored in the device's file system.
[0054] Specifically, before executing the operation of clearing the cache report, the Shell script first obtains the required permissions in the Linux environment. The Shell script uses the sudo command or is directly executed under an account with administrator privileges to ensure that the file system of the Google MTT tool can be accessed and modified. The permissions of files and directories are set through commands such as chmod, and the access permissions of the file system are set to read (r), write (w), and execute (x). For example, the chmod 777 command sets the permissions of the target file or directory to readable, writable, and executable for all users, ensuring that the Shell script can successfully access and modify the files generated by the Google MTT tool in subsequent operations.
[0055] Furthermore, after obtaining the permissions, the Shell script will traverse the file system of the Google MTT tool to determine the storage location of the report and cache files. To ensure that these files can be effectively operated, the script needs to further set the corresponding permissions so that the file system has the ability to read, write, and execute. This is usually done by checking and repairing the permissions of the relevant file paths. For example, the script can use the find command to find a specific path, and combine the chmod command to recursively set the permissions of all files and subdirectories under the path to ensure that the operation will not fail due to insufficient permissions during the entire cleanup process.
[0056] By using Shell scripts to obtain the necessary permissions in the Linux environment and set read, write, and execute permissions for the file system of the Google MTT tool, the script can successfully access and operate the required files and directories during the automated operation. This process significantly reduces the possible operation failures due to insufficient permissions, improves the reliability and efficiency of script operation, and ensures that the cache report clearing operation can proceed smoothly, avoiding the impact of file system permission restrictions on the normal use of the Google MTT tool and the stability of the test process.
[0057] S2: traverse the file path in the Google MTT tool;
[0058] It should be noted that traversal refers to the process of accessing or checking a set of elements one by one. In a computer file system, traversing a file path means checking each directory and file in the file system in sequence to find a specific target file or directory. A file path refers to the location of a specific file or directory in a file system. A path can be an absolute path (a full path starting from the root directory) or a relative path (a path starting from the current working directory). In this application, the file path refers to the location where the Google MTT tool generates reports and cache files in the file system.
[0059] Specifically, the Shell script starts traversing the file path of the Google MTT tool by using Linux commands such as find or ls. The script first locates the root directory or main working directory of the Google MTT tool, which is the initial storage location of all related files and cached reports. Next, the script recursively checks each subdirectory and file starting from this directory, going deeper layer by layer to ensure that no file path is missed. During the traversal process, the script records the name, size, type, and path information of each file, and matches it with predefined file features (such as specific file extensions or name patterns) to identify the location of report and cache files.
[0060] Furthermore, during the traversal process, the script uses filtering conditions to distinguish target files that need to be cleared from other irrelevant files. Filtering conditions can include file name patterns (such as .log or .tmp), file size ranges, file creation or modification times, etc. For example, the script can specify search conditions through the find command combined with options such as -name, -type, and -size to traverse only paths and files that match the report and cache file characteristics. After locating the target file, the script saves its path to a temporary list or array so that subsequent operations can quickly access these files and perform deletion or other processing.
[0061] By traversing the file path in the Google MTT tool through a Shell script, the location of all storage reports and cache files can be automatically found, avoiding the tediousness and errors in the manual search process. This traversal method ensures that all target files are effectively identified and processed to avoid omissions, significantly improving the efficiency and accuracy of the clearing operation. At the same time, through automated path traversal, the use of system resources and the risk of human error are reduced, ensuring that the cache management of the Google MTT tool is more efficient and reliable.
[0062] S3: Determine whether there is a storage path in the file path;
[0063] S4: If yes, delete the report and cache files corresponding to the storage path.
[0064] It should be noted that in computer science, judgment refers to the process of checking and verifying a certain condition or state. In this step, judgment refers to checking whether there is a specific storage path in the file path, that is, the location of the report and cache files, through a shell script. The storage path refers to a specific directory or folder used to store reports and cache files generated by the Google MTT tool. In the Linux file system, the storage path is usually expressed in the form of an absolute path or a relative path, indicating the location of the file in the file system.
[0065] Specifically, after traversing the file path, the Shell script uses Linux commands (such as test or []) to determine whether the required storage path exists. If the judgment result is true (that is, the storage path exists), the script will mark the path as the target path and continue to perform the deletion operation to clear the report and cache files in the path; if the judgment result is false (that is, the storage path does not exist), the script will record the missing path and call the corresponding creation command (such as mkdir) to generate the required directory structure to ensure that subsequent operations can proceed normally.
[0066] By determining whether a storage path exists in the file path, the Shell script can quickly confirm whether the storage location of the report and cache files is available, thereby avoiding invalid operations or potential errors. This checking mechanism ensures the effectiveness and security of the clearing operation: if the path exists, all target files are correctly cleared; if the path does not exist, a new storage path can be created in time to ensure that subsequent files can be correctly saved and managed. This process effectively improves the stability of the system and the reliability of operations, and prevents operation failures or data loss caused by missing paths.
[0067] This embodiment obtains permissions in the Linux environment through a Shell script, sets read, write, and execute permissions for the file system of the Google MTT tool; traverses the file path in the Google MTT tool; determines whether a storage path exists in the file path; if so, deletes the report and cache files corresponding to the storage path. This embodiment obtains permissions in the Linux environment through a Shell script and sets read, write, and execute permissions for the file system of the Google MTT tool. It can automatically traverse the file path, determine and delete the reports and cache files in the storage path, reduce the complexity and error rate of manual operations, and improve the efficiency and accuracy of clearing cached reports, thereby preventing system performance degradation or test process crashes due to too many cached files, and effectively improving the stability and work efficiency of the Google MTT tool during the test process.
[0068] Based on the above first embodiment, a second embodiment of the method for clearing cache reports based on the Google MTT tool is proposed. In this embodiment, after step S4, it also includes:
[0069] S5: If not, create a new report and cache file storage path.
[0070] Specifically, when it is detected that the storage path does not exist, the Shell script will automatically execute the operation of creating a new storage path. This involves generating a new directory or folder in the file system of the Google MTT tool for storing reports and cache files. This process ensures that the system can continue to save and manage data even if the original storage path is missing, thereby preventing file saving failure or data loss.
[0071] Furthermore, after creating a new storage path, the script will record the details of the operation, such as the creation time and path, for subsequent maintenance and inspection. This step ensures that the newly created storage path is valid and accessible in the file system, and that the cleanup operation will not fail again due to path problems in future operations.
[0072] By automatically creating a new storage path for reports and cache files when the storage path does not exist, the Shell script ensures the integrity and operability of the file system. This measure avoids the problem of file saving failure or data loss due to the missing storage path, and improves the stability of the system and the continuity of operation. At the same time, recording detailed information about the operation will also help with future system maintenance and troubleshooting, ensuring the transparency and traceability of the operation process. In this way, not only the flexibility of file management is enhanced, but also the risk of human error is effectively reduced, and the efficiency and reliability of the use of Google MTT tools are improved.
[0073] See also Figure 2 , Figure 2 This is a schematic diagram of a sub-process in the second embodiment of the method for clearing cache reports based on the Google MTT tool in this application.
[0074] like Figure 2 As shown, in this embodiment, before step S4, the following is further included:
[0075] S4a: Creating a backup directory in the file system of the Google MTT tool through the Shell script;
[0076] S4b: copying the report and cache file to the backup directory;
[0077] S4c: Verify the integrity and consistency of the copied report and cache file.
[0078] It should be noted that creating a backup directory refers to creating a new directory in the file system to store copies of report and cache files to prevent data loss due to unexpected circumstances during the cleanup operation. The backup directory is usually separated from the original file storage location to ensure data security and recoverability. Copying files refers to copying original files (such as report and cache files) to another location (such as a backup directory) to retain a copy of the original data. The copying process should ensure that the file content and attributes remain unchanged. Integrity and consistency verification refers to checking the integrity and consistency of file data after copying files to ensure that the backup file completely matches the original file and no data loss or corruption has occurred.
[0079] Specifically, before performing the clearing operation, the Shell script will create a backup directory in the file system of the Google MTT tool. This backup directory is specifically used to store copies of reports and cache files to be deleted. The purpose of creating a backup directory is to ensure that all important data is backed up before the clearing operation to prevent permanent data loss due to misoperation or system failure during the clearing process. After creating the backup directory, the Shell script copies all reports and cache files to be cleared to the backup directory. This step ensures that all original data has a safe copy stored in the backup directory before being deleted, so that data can be restored when needed. During the copying process, it is necessary to ensure that all file attributes and contents remain unchanged.
[0080] Furthermore, after the file copy is completed, the Shell script verifies the integrity and consistency of the backup report and cache files. This process includes checking whether the size, hash value or checksum of each backup file is consistent with the original file to ensure that the backup file is not damaged or omitted. This verification process ensures that all copied files are completely consistent with the original files, ensuring the reliability and validity of the backup data.
[0081] By using a Shell script to create a backup directory and copying the report and cache files to this directory before the cleanup operation, we ensure that all data is properly backed up before the cleanup operation, reducing the risk of data loss. The accuracy and reliability of the backup data are further guaranteed through integrity and consistency verification, so that even in the event of an unexpected situation, data can be quickly restored to ensure the continued stable operation of the Google MTT tool. This method greatly enhances the security of data management and the robustness of system operations.
[0082] Based on the above first embodiment, in this embodiment, after step S4c, the following is further included:
[0083] S4d: Detecting the process status of the Google MTT tool through the Shell script, and obtaining the process ID of the Google MTT tool based on a preset process acquisition command;
[0084] S4e: Determine whether the process ID exists;
[0085] S4f: If it exists, issue a pause and clear command;
[0086] S4g: If it does not exist, issue a clear execution instruction.
[0087] It should be noted that detecting the process status refers to checking the status of the program or service currently running in the system to determine whether it is running, stopped or abnormal. For the Google MTT tool, the purpose of detecting the process status is to determine whether it is executing a task to decide whether a clearing operation can be performed. The process ID is a unique identifier assigned by the operating system to each running program or service. By obtaining the process ID of the Google MTT tool, the current running status of the tool can be clarified and further operational decisions can be made based on it. The pause clearing instruction is a command issued when it is detected that the Google MTT tool is running. It is used to suspend the clearing operation to avoid interfering with ongoing tests or other activities. The clearing execution instruction is a command issued when it is detected that the Google MTT tool is not running. It is used to start the operation of clearing the cache report.
[0088] Specifically, the Shell script first uses a preset process acquisition command (such as ps or pgrep) to check the current process status of the Google MTT tool. The script looks for the process ID of the Google MTT tool based on the process name or other identifiers. The existence or absence of the process ID directly reflects the running status of the tool. If the script can successfully obtain the process ID, it means that the Google MTT tool is running; if the process ID cannot be obtained, it means that the tool has been stopped or not started.
[0089] Furthermore, after obtaining the process ID, the script determines the existence of the process ID: If the process ID exists (the Google MTT tool is running): the script will issue a pause and clear command to avoid clearing operations during the tool operation to prevent impact on ongoing tests or other tasks. This step ensures that the clearing operation does not interfere with the normal operation of the Google MTT tool. If the process ID does not exist (the Google MTT tool is not running): the script will issue a clear execution command to start clearing cache reports. This step indicates that the Google MTT tool is not currently in use and the clearing operation can be performed safely.
[0090] By detecting the process status of the GoogleMTT tool through a Shell script, the timing of the clearing operation is ensured to be appropriate, avoiding the accidental clearing of data during the tool operation and preventing interference or damage to the ongoing tasks. This method improves the safety and reliability of system operation, allowing the clearing operation to be performed only at a safe and appropriate time, ensuring the stability and normal use of the GoogleMTT tool, and reducing the risk of test failure or system abnormality caused by improper clearing operations.
[0091] This embodiment obtains permissions in the Linux environment through a Shell script, sets read, write, and execute permissions for the file system of the Google MTT tool; traverses the file path in the Google MTT tool; determines whether a storage path exists in the file path; if so, deletes the report and cache files corresponding to the storage path. This embodiment obtains permissions in the Linux environment through a Shell script and sets read, write, and execute permissions for the file system of the Google MTT tool. It can automatically traverse the file path, determine and delete the reports and cache files in the storage path, reduce the complexity and error rate of manual operations, and improve the efficiency and accuracy of clearing cached reports, thereby preventing system performance degradation or test process crashes due to too many cached files, and effectively improving the stability and work efficiency of the Google MTT tool during the test process.
[0092] Based on the above second embodiment, a third embodiment of the method for clearing cache reports based on the Google MTT tool is proposed. Figure 3 , Figure 3 This is a schematic diagram of a sub-process in the third embodiment of the method for clearing cache reports based on the Google MTT tool in this application.
[0093] In this embodiment, the method further includes:
[0094] S101: creating a log file in the Shell script;
[0095] S102: writing the report and the deletion time, the number of files and the file path list of the cached files into the log file;
[0096] S103: storing the log file in a preset log storage location.
[0097] It should be noted that a log file is a file that records events, operations, and status that occur during the operation of a system or application. Log files are used to track operation history to facilitate subsequent maintenance, troubleshooting, and auditing. In the present invention, log files record detailed information on deletion operations of reports and cache files. The deletion time refers to the time point of the file deletion operation, the number of files refers to the total number of files deleted in a clearing operation, and the file path list contains the specific locations of all deleted files for easy search and tracing. The preset log storage location is a directory or path designated in the system for storing log files. It is usually a secure and easily accessible location so that subsequent review and maintenance work can quickly find the required log records.
[0098] Specifically, the Shell script first creates a new log file before the cleanup operation begins to record important information during the entire operation. The name of the log file can be dynamically generated based on the current time or operation type to ensure that each operation has a unique record file. Creating a log file helps record the specific details of the cleanup operation for subsequent review and analysis.
[0099] Furthermore, when the cleanup operation is performed, the Shell script writes the deleted report and relevant information of the cached files to the log file, including the time of deletion, the number of files, and the list of file paths. This ensures that all operation details are accurately recorded, which is convenient for backtracking or review when needed. The information recorded in the log should be as complete as possible to provide a clear operation history. After the log file is created and the content is written, the Shell script stores it to the preset log storage location. This storage location is usually a secure directory for centralized management of all operation logs to ensure that they are easily accessible and protected. Saving the log file in the preset location facilitates subsequent maintenance and inspection, making it easier for system administrators or maintenance personnel to quickly find and review relevant log records.
[0100] By creating a log file in the Shell script and recording the time, number of files, and path of the deletion operation in detail, a complete operation record can be provided to improve the traceability and transparency of the operation. Storing the log file in a preset location helps with system maintenance and management, facilitates review and troubleshooting, and ensures the safety and controllability of the removal operation. This process not only improves the reliability of the system, but also provides an important reference for future maintenance and inspection.
[0101] Based on the above second embodiment, in this embodiment, the method further includes:
[0102] S104: using the Shell script to re-traverse the file path of the GoogleMTT tool;
[0103] S105: searching for reports and cache files in the clearing path through a preset cache file search command;
[0104] S106: If there are reports and cache files in the search results, the clearing operation is performed again.
[0105] It should be noted that re-traversing the file path means that after the clearing operation is completed, the Shell script will check each file and directory in the file system of the Google MTT tool one by one again to ensure that no target files are missed. This traversal is a verification process for the initial clearing operation to ensure that all cache and report files have been completely cleared. The preset cache file search command refers to a specific command or instruction used in the script to find and identify specific types of files (such as cache files or report files). These commands search for target files in the file system based on conditions such as file name, file type, and file size. Executing the clearing operation again means that when it is detected that there are still report and cache files in the clearing path, the Shell script will initiate the deletion command again to ensure that all unnecessary files are completely removed.
[0106] Specifically, after the first cleanup operation is completed, the Shell script will re-traverse the file system of the Google MTT tool and check each directory and file path one by one. The purpose of the re-traversal is to verify the effect of the first cleanup operation to ensure that no files are missed or incompletely cleaned. During the traversal process, the script will scan all paths where reports and cache files are stored again to confirm the status of the files in these paths. During the re-traversal process, the Shell script uses the preset cache file search command to search the target path, specifically looking for possible residual reports and cache files. The search command can identify the target file based on features such as file name pattern, file type, file size, or file timestamp. If the target file still exists in the search results, it means that the initial cleanup operation did not completely clear these files.
[0107] Furthermore, if the search results show that there are still report and cache files in the cleanup path, the Shell script will perform the cleanup operation again. The purpose of this operation is to completely remove all remaining report and cache files to ensure that the file system is clean and free of redundant data. The script can continue to repeat this checking and cleaning process until no residual files are found.
[0108] By retraversing the file path and using preset search commands, the Shell script ensures the thoroughness and effectiveness of the cleanup operation. This process prevents any omission or residue of report and cache files through repeated checks and verifications, ensuring a clean state of the file system. This multiple verification and cleanup method improves the reliability of system operation, prevents system performance degradation or unexpected failures caused by residual data, and effectively maintains the operational stability of the Google MTT tool.
[0109] This embodiment obtains permissions in the Linux environment through a Shell script, sets read, write, and execute permissions for the file system of the Google MTT tool; traverses the file path in the Google MTT tool; determines whether a storage path exists in the file path; if so, deletes the report and cache files corresponding to the storage path. This embodiment obtains permissions in the Linux environment through a Shell script and sets read, write, and execute permissions for the file system of the Google MTT tool. It can automatically traverse the file path, determine and delete the reports and cache files in the storage path, reduce the complexity and error rate of manual operations, and improve the efficiency and accuracy of clearing cached reports, thereby preventing system performance degradation or test process crashes due to too many cached files, and effectively improving the stability and work efficiency of the Google MTT tool during the test process.
[0110] For example, in order to help understand the technical concept or technical principle of the method for clearing cache reports based on the Google MTT tool in the above embodiment, please refer to Figure 4 , Figure 4 This is a flow chart of the application principles in an embodiment of a method for clearing cache reports based on the Google MTT tool in this application.
[0111] Figure 4 This paper describes a method based on Shell scripts to automatically clear the reports and cache files generated by the Google MTT tool. The following is a detailed analysis of the various steps:
[0112] 1. Launch of Shell Script: The flowchart starts with running the Shell script, which means that the cleanup operation is automatically performed by the Shell script. Shell script is an automation tool suitable for Linux environment that can execute a series of commands in batches to complete specific tasks.
[0113] 2. Grant 777 permissions: After running the shell script, the first step is to grant the required directory or file "777" permissions. Permissions set to "777" means that all users (including the file's owner, group users, and other users) are granted read, write, and execute permissions. This step ensures that the script has sufficient permissions to access, modify, and delete reports and cache files generated by the Google MTT tool.
[0114] 3. Traverse the storage path of Google MTT tool: Next, the script will traverse the storage path related to Google MTT tool. The purpose of this step is to find all directories and paths where reports and cache files may be stored. The traversal operation usually involves recursively looking in various folders in the file system to identify the location of the target file.
[0115] 4. Determine whether the path exists: The judgment node in the flowchart represents the check of the storage path. If the storage path exists ("YES"), the script will continue to execute the deletion operation. If the storage path does not exist ("NO"), it means that the corresponding path needs to be created first.
[0116] 5. Delete operation: If the storage path is confirmed to exist, the script will perform the delete operation. This step clears all reports and cache files in the path to ensure that there is no redundant data in the file system of the Google MTT tool.
[0117] 6. Create path directory: If the storage path does not exist, the script will create a new path directory. This step ensures that in the absence of a storage path, a valid storage location is created for subsequent possible reports and cache files to prevent future storage failures.
[0118] 7. Cyclic Check and Clear: The flowchart uses a cyclic path to ensure that each path can be cleared after creation or checking. This repeated operation ensures the clean state of the file system and helps prevent any residual reports and cache files from interfering with the normal operation of the system.
[0119] The present application also provides a device for clearing cache reports based on the Google MTT tool, please refer to Figure 5 , Figure 5 This is a schematic diagram of the module structure of a device for clearing cache reports based on the Google MTT tool in an embodiment of the present application. The device for clearing cache reports based on the Google MTT tool includes:
[0120] The permission acquisition module 501 is used to acquire permissions in the Linux environment through a Shell script and set read, write and execute permissions for the file system of the GoogleMTT tool;
[0121] A traversal module 502, used to traverse the file path in the Google MTT tool;
[0122] A determination module 503 is used to determine whether there is a storage path in the file path;
[0123] The clearing module 504 is used to delete the report and cache files corresponding to the storage path if yes.
[0124] The device for clearing cache reports based on the Google MTT tool provided in the embodiment of the present application adopts the method for clearing cache reports based on the Google MTT tool in the above embodiment, which can solve the technical problem of how to improve the efficiency of Google GMS certification testing. Compared with the prior art, the beneficial effects of the device for clearing cache reports based on the Google MTT tool provided in the embodiment of the present application are the same as the beneficial effects of the method for clearing cache reports based on the Google MTT tool provided in the above embodiment, and the other technical features of the device for clearing cache reports based on the Google MTT tool are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0125] The present application provides a device for clearing cache reports based on the Google MTT tool, and the device for clearing cache reports based on the Google MTT tool includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for clearing cache reports based on the Google MTT tool in the above-mentioned embodiment.
[0126] Reference below Figure 6 , which shows a schematic diagram of the structure of a device suitable for implementing the Google MTT tool-based cache report clearing embodiment of the present application. The device based on the Google MTT tool cache report clearing embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The device shown for clearing cache reports based on the Google MTT tool is merely an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present application.
[0127] like Figure 6As shown, the device for clearing cache reports based on the Google MTT tool may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the device based on the Google MTT tool to clear cache reports are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the device based on the Google MTT tool to clear the cache report to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a device based on the Google MTT tool to clear the cache report with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0128] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0129] The device for clearing cache reports based on the Google MTT tool provided in this application adopts the method for clearing cache reports based on the Google MTT tool in the above embodiment, which can solve the technical problem of how to improve the efficiency of Google GMS certification testing. Compared with the prior art, the beneficial effects of the device for clearing cache reports based on the Google MTT tool provided in this application are the same as the beneficial effects of the method for clearing cache reports based on the Google MTT tool provided in the above embodiment, and the other technical features of the device for clearing cache reports based on the Google MTT tool are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0130] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0131] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0132] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the method for clearing cache reports based on the Google MTT tool in the above-mentioned embodiment.
[0133] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0134] The above-mentioned computer-readable storage medium may be included in the device for clearing cache reports based on the Google MTT tool; or it may exist independently without being assembled into the device for clearing cache reports based on the Google MTT tool.
[0135] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by a device that clears cache reports based on the Google MTT tool, the device that clears cache reports based on the Google MTT tool: obtains permissions in the Linux environment through a Shell script, sets read, write and execute permissions for the file system of the Google MTT tool; traverses the file path in the Google MTT tool; determines whether there is a storage path in the file path; if so, deletes the report and cache file corresponding to the storage path. The computer program code for performing the operations of the present application can be written in one or more programming languages or a combination thereof, and the programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer (for example, through the Internet using an Internet service provider).
[0136] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0137] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0138] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for clearing cache reports based on the Google MTT tool, and can solve the technical problem of how to improve the efficiency of Google GMS certification testing. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the method for clearing cache reports based on the Google MTT tool provided in the above-mentioned embodiment, and will not be repeated here.
[0139] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method for clearing cache reports based on the Google MTT tool as described above.
[0140] The computer program product provided by this application can solve the technical problem of how to improve the efficiency of Google GMS certification testing. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of this application are the same as the beneficial effects of the method for clearing cache reports based on the Google MTT tool provided by the above embodiment, which will not be repeated here.
[0141] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
Claims
1. A method for clearing cache reports based on Google MTT tool, characterized in that: The method comprises: Obtain permissions in the Linux environment through a shell script and set read, write, and execute permissions for the file system of the Google MTT tool; Traverse the file path in the Google MTT tool; Determine whether there is a storage path in the file path; If so, delete the report and cache files corresponding to the storage path.
2. The method according to claim 1, characterized in that If yes, after the step of deleting the report and cache file corresponding to the storage path, the method further includes: If not, create new report and cache file storage paths.
3. The method according to claim 1, characterized in that If so, before the step of deleting the report and cache files corresponding to the storage path, the method further includes: Creating a backup directory in the file system of the Google MTT tool through the Shell script; copying the report and cache files to the backup directory; The copied report and cache files are verified for integrity and consistency.
4. The method according to claim 3, characterized in that After the step of verifying the integrity and consistency of the copied report and cache file, the method further includes: Detecting the process status of the Google MTT tool through the Shell script, and obtaining the process ID of the Google MTT tool based on a preset process acquisition command; Determine whether the process ID exists; If it exists, issue a pause and clear command; If it does not exist, issue a clear execution command.
5. The method according to claim 4, characterized in that The method further comprises: Creating a log file in the Shell script; Writing the report and cache file deletion time, file quantity and file path list into the log file; The log file is stored in a preset log storage location.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Re-traversing the file path of the GoogleMTT tool using the Shell script; Use the preset cache file search command to find and clear the report and cache files in the path; If there are reports and cache files in the search results, perform the clear operation again.
7. A device for clearing cache reports based on Google MTT tool, characterized in that: The device comprises: A permission acquisition module, used to obtain permissions in a Linux environment through a Shell script, and set read, write, and execute permissions for the file system of the Google MTT tool; A traversal module, used to traverse the file path in the Google MTT tool; A judging module, used to judge whether there is a storage path in the file path; The clearing module is used to delete the report and cache files corresponding to the storage path if so.
8. A computer device, characterized in that: The device includes: a memory, a processor, and a program for clearing cache reports based on the Google MTT tool stored in the memory and executable on the processor, wherein the program for clearing cache reports based on the Google MTT tool is configured to implement the steps of the method for clearing cache reports based on the Google MTT tool as described in any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium stores a program for clearing cache reports based on the Google MTT tool. When the program for clearing cache reports based on the Google MTT tool is executed by the processor, the steps of the method for clearing cache reports based on the Google MTT tool as described in any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product includes a computer program, which, when executed by a processor, implements the steps of the method for clearing cache reports based on the Google MTT tool as described in any one of claims 1 to 6.