Script running result comparison method, system, equipment and product
Through automated batch operation and cross -comparison function, the labor comparison time consuming in existing technologies is solved, the efficient script operation results comparison is achieved, and the verification efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202411445582.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-16
AI Technical Summary
In the prior art, it is time-consuming and inefficient to manually compare the running results of M language scripts in Matlab software and Mlang compatible tools, especially when the number of scripts is large.
Provide a script running result comparison method. By creating a script automated batch running function and automated comparison function, the automated batch operation of multiple scripts and the cross -comparison of results are achieved to generate comparison results data.
It greatly reduces artificial intervention, improves the verification efficiency and accuracy of the consistency of the script operation results, and ensures the functional correctness and performance consistency after code transplantation.
Smart Images

Figure CN119377112A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software testing, and in particular relates to a script running result comparison method, system, device and product. Background Art
[0002] At present, there are a large number of M language (a paper-based programming language) scripts that can run and output results in Matlab software (commercial mathematical software produced by MathWorks, USA). Using Mlang compatible tools (M language compatible tools), M language scripts originally designed for Matlab software can be run in Syslab software (a control system simulation software based on Windows operating system, which can simulate the operation of various control systems, including PID control, fuzzy control, neural network control, etc.), that is, M language can be run in Syslab software using Mlang compatible tools and output results.
[0003] However, when the M language script is transplanted from Matlab software to Syslab software using Mlang compatible tools, it is necessary to ensure the consistency between the output results when the M language script is run using the Mlang compatible tool and the output results after the M language script is run in Matlab software, that is, when the same M language script is run in the Mlang compatible tool and in Matlab software, the results obtained should be the same or within an acceptable error range. In the prior art, the results output by Matlab software and the Mlang compatible tool for the same M language script are usually manually compared one by one to confirm whether the results output by the Mlang compatible tool are accurate.
[0004] However, in the process of using the prior art, the inventors found that the prior art has at least the following problems: In the prior art, the manual one-by-one comparison method is very time-consuming and inefficient, especially when the number of M language scripts is relatively large.
[0005] Therefore, it is necessary to study an automated comparison scheme that can quickly and batch-verify whether the results of running M language scripts in Mlang compatible tools are consistent with those of running in Matlab software. Summary of the invention
[0006] The present invention aims to solve, at least to a certain extent, the technical problem that the above-mentioned manual one-by-one comparison method is very time-consuming and inefficient. The present invention provides a script running result comparison method, system, device and product.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions: In a first aspect, the present invention provides a script running result comparison method, comprising: Create a script automated batch run function and an automated comparison function; wherein the script automated batch run function is used to automatically run the specified scripts in batches and store the script run results obtained after the specified scripts are run; the automated comparison function is used to perform cross-comparison processing on any two script run results; Get the script to be run; Calling the script automatic batch running function to perform automatic batch running processing on the script to be run through Matlab software to obtain a first script running result; Calling the script automatic batch running function to perform automatic batch running processing on the script to be run through an Mlang compatible tool to obtain a second script running result; The automated comparison function is called to perform a cross comparison on the first script running result and the second script running result to obtain comparison result data.
[0008] In a possible design, the script automatic batch running function includes a script running function and a script path management function; correspondingly, the script automatic batch running function is called to perform automatic batch running processing on the scripts to be run through a specified script execution tool to obtain script running results, including: The designated script execution tool receives the designated path where the script to be run is located and the script name of the script to be run; The designated script execution tool inputs the designated path and the script name into the script path management function, and inputs the script name into the script running function, so that the script path management function obtains a dependency table matching the script to be run according to the designated path, and the script running function automatically batch runs all scripts in the script to be run based on the script name and the dependency table to obtain the script running result of the script to be run; wherein the dependency table includes the designated path and all subfolder paths under the designated path that include the script corresponding to the script name, and the designated path and all subfolder paths are spliced and set; Among them, the designated script execution tool is Matlab software or an Mlang compatible tool; correspondingly, the script running result is the first script running result obtained by automatically batch running the scripts to be run through the Matlab software or the second script running result obtained by automatically batch running the scripts to be run through the Mlang compatible tool.
[0009] In a possible design, the script path management function includes an addpath_recursive function and a joinpath function; correspondingly, obtaining a dependency table matching the script to be run according to the specified path through the script path management function includes: Traversing all subfolders under the specified path according to the script name through the addpath_recursive function to obtain the subfolder paths of all target scripts in the script to be run; According to the joinpath function, all subfolder paths of the target script are concatenated to obtain a concatenated path; A dependency table is obtained according to the specified path and the concatenated path.
[0010] In a possible design, the script running function adopts the runscript function; correspondingly, all scripts in the script to be run are automatically batch-run based on the script name and the dependency table by the script running function to obtain the script running results of the script to be run, including: Enable the preset sprof function to turn on the timer; Searching for a target script that matches the script name based on the path in the dependency table, and executing all target scripts that match the script name in the order of the paths in the dependency table through a preset eval function to obtain a script running output variable that matches the script to be run; Calling the sprof function to close the timer, so as to obtain the script running time of the script to be run; The script running output variable and the script running time are taken as the script running result, and the script running result is stored in a specified file path matching the specified script execution tool through a preset save function.
[0011] In a possible design, the automated comparison function includes a loaddata function, a datashow function, and a compare function; correspondingly, the automated comparison function is called to perform a cross-comparison process on the first script running result and the second script running result to obtain comparison result data, including: Respectively obtain the paths where the first script execution result and the second script execution result are located, and search and import the first script execution result and the second script execution result according to the paths where the first script execution result and the second script execution result are located through the loaddata function; Performing image conversion processing on the first script running result and the second script running result by using the datashow function to obtain a first image and a second image corresponding to the first script running result and the second script running result respectively; The first picture and the second picture are compared by the compare function to obtain a difference map, and the difference map is used as comparison result data of the first script running result and the second script running result.
[0012] In a possible design, after obtaining the comparison result data, the method further includes: A comparison report is generated according to the comparison result data.
[0013] In a possible design, a comparison report is generated according to the comparison result data, including: Create a report generation function; wherein the report generation function includes a create_table function, an add_heading function and a generate_report function; The report generation function is called, and table elements are added based on the create_table function, title fields are added based on the add_heading function, and a report file is generated based on the generate_report function, and then the table elements, title fields and report file are integrated to obtain a comparison report.
[0014] In a second aspect, the present invention provides a script running result comparison system, which is used to implement the script running result comparison method as described in any one of the above; the script running result comparison system comprises: A function creation module, used to create a script automated batch run function and an automated comparison function; wherein the script automated batch run function is used to automatically batch run a specified script and store the script run results obtained after the specified script is run; the automated comparison function is used to perform a cross comparison process on any two script run results; The script acquisition module is used to obtain the script to be run; A script running module, which is respectively connected to the function creation module and the script acquisition module in communication, and is used to call the script automatic batch running function so as to perform automatic batch running processing on the scripts to be run through Matlab software to obtain a first script running result; and is also used to call the script automatic batch running function so as to perform automatic batch running processing on the scripts to be run through an Mlang compatible tool to obtain a second script running result; The result comparison module is connected to the script running module for calling the automatic comparison function to perform a cross comparison on the first script running result and the second script running result to obtain comparison result data.
[0015] In a third aspect, the present invention provides an electronic device, comprising: a memory for storing computer program instructions; and, A processor is used to execute the computer program instructions to complete the operation of the script running result comparison method as described in any one of the above.
[0016] In a fourth aspect, the present invention provides a computer program product, including a computer program or instructions, which, when executed by a computer, implements the script running result comparison method as described in any one of the above.
[0017] The beneficial effects of the present invention are: The present invention discloses a script running result comparison method, system, device and product, which can process multiple scripts in batches through Matlab software and Mlang compatible tools respectively, and can automatically compare the running results of two scripts to obtain comparison result data, so that users can quickly confirm whether the results output by the Mlang compatible tool are accurate. Specifically, during the implementation of the present invention, a script automatic batch running function and an automatic comparison function are first created, and after obtaining the script to be run, the script automatic batch running function is called to automatically run the script to be run through Matlab software to obtain the first script running result, and then the script automatic batch running function is called to automatically run the script to be run through the Mlang compatible tool to obtain the second script running result, and finally the automatic comparison function is called to cross-comparison the first script running result and the second script running result to obtain the comparison result data. Based on this, the present invention can realize the automated batch running data of the script to be run by Matlab software and Mlang compatible tools through the script automated batch running function, and cross-compare the two script running results through the automated comparison function to quickly obtain the comparison result data, thereby greatly reducing manual intervention, realizing automated testing of the script to be run and comparison of the script running results, which is beneficial to improving the verification efficiency and accuracy of whether the script running results obtained by the Mlang compatible tool are consistent with the script running results obtained by the Matlab software, thereby ensuring the functional correctness and performance consistency after code transplantation.
[0018] Other beneficial effects of the present invention will be further described in the specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a flowchart of a script running result comparison method in an embodiment; Figure 2 It is a schematic diagram of the first picture and the second picture obtained when the data type of the first script running result or the second script running result is an array type; Figure 3 It is a schematic diagram of the first picture and the second picture obtained when the data type of the first script running result or the second script running result is a scalar type; Figure 4 It is a schematic diagram of a difference graph obtained when the data type of the first script running result or the second script running result is an array type; Figure 5 It is a schematic diagram of a difference graph obtained when the data type of the first script running result or the second script running result is a scalar type; Figure 6 It is a module block diagram of a script running result comparison system in an embodiment; Figure 7 It is a module block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0021] Embodiment 1: This embodiment discloses a script running result comparison method, which can be executed by, but is not limited to, a computer device or a virtual machine with certain computing resources, such as a personal computer, a smart phone, a personal digital assistant, or a wearable device, or by a virtual machine.
[0022] like Figure 1 As shown, a script running result comparison method may include but is not limited to the following steps: S1. Create a script automated batch run function and an automated comparison function; wherein the script automated batch run function is used to automatically batch run specified scripts and store the script run results obtained after the specified script is run; the automated comparison function is used to cross-compare any two script run results.
[0023] S2. Get the script to be run.
[0024] S3. Call the script automatic batch running function so as to automatically batch run the scripts to be run through Matlab software to obtain the first script running result; specifically, in this embodiment, by calling the script automatic batch running function, automatic batch processing of a series of scripts to be run is realized in the Matlab environment, which can be conducive to effectively integrating the execution of multiple independent scripts, greatly improving the script running efficiency, and finally obtaining the running result of the script to be run, that is, the first script running result, which provides convenience for subsequent data analysis.
[0025] S4. Call the script automatic batch running function so as to perform automatic batch running processing on the scripts to be run through the Mlang compatible tool to obtain the second script running result; specifically, in this embodiment, by calling the script automatic batch running function, automatic batch processing of a series of scripts to be run is implemented in the environment where the Mlang compatible tool is located, which can be beneficial to effectively integrate the execution of multiple independent scripts, greatly improve the script running efficiency, and finally obtain the running result of the script to be run, that is, the second script running result, which provides convenience for subsequent data analysis.
[0026] The script automatic batch running function includes a script running function and a script path management function; correspondingly, in step S3 or S4, the script automatic batch running function is called so as to perform automatic batch running processing on the scripts to be run by specifying a script execution tool to obtain script running results, including: A1. The designated script execution tool receives the designated path where the script to be run is located and the script name of the script to be run; A2. The designated script execution tool inputs the designated path and the script name into the script path management function, and inputs the script name into the script running function, so that the script path management function obtains a dependency table matching the script to be run according to the designated path, and the script running function automatically batch runs all scripts in the script to be run based on the script name and the dependency table to obtain the script running result of the script to be run; wherein the dependency table includes the designated path and all subfolder paths under the designated path that include the script corresponding to the script name, and the designated path and all subfolder paths are spliced and set; Among them, the designated script execution tool is Matlab software or an Mlang compatible tool; correspondingly, the script running result is the first script running result obtained by automatically batch running the scripts to be run through the Matlab software or the second script running result obtained by automatically batch running the scripts to be run through the Mlang compatible tool.
[0027] Specifically, in this embodiment, the script path management function includes an addpath_recursive function (a Matlab function for recursively adding a specified directory and its subdirectories to the search path) and a joinpath function (a Matlab function for combining multiple partial paths into a complete path). It should be noted that the addpath_recursive function and the joinpath function can be used to record and identify the location of the target file where the script running result is located, so that the script running function automatically batch runs all scripts in the script to be run; correspondingly, the script path management function obtains a dependency table matching the script to be run according to the specified path, including: A201. All subfolders under the specified path are traversed according to the script name through the addpath_recursive function to obtain the subfolder paths of all target scripts in the script to be executed; specifically, in this embodiment, the subfolder path under the specified path is returned through the dir function (used to return a property list or method list of an object).
[0028] A202. According to the joinpath function, all subfolder paths of the target script are concatenated to obtain a concatenated path; A203. Obtain a dependency table according to the specified path and the concatenated path. It should be noted that, in this embodiment, the dependency table also includes script files in folders corresponding to all paths in the concatenated path, so that the script execution function can directly execute the script in the script to be executed based on the dependency table.
[0029] It should be noted that, in this embodiment, the addpath_recursive function is used to recursively traverse the file directory corresponding to the specified path to find all target scripts, and the joinpath function is used to generate the correct file path so as to obtain a dependency table that can be used by the runscript function to automatically batch run all scripts in the script to be run, thereby realizing the automated execution of the script to be run.
[0030] In this embodiment, the script running function adopts the runscript function (a function used to execute scripts in a programming language). It should be noted that the runscript function can directly run the script and store the script running results such as the script running time and variable data; correspondingly, the script running function automatically batch runs all the scripts in the script to be run based on the script name and the dependency table to obtain the script running results of the script to be run, including: A204. When the script name is received, a preset sprof function (a command line tool for reading and displaying analysis data of shared objects (shared libraries)) is enabled to turn on a timer; specifically, during the implementation process, the script running time can be recorded by the sprof function, and specifically, the sprof function can generate a start timing mark and set a breakpoint on the marked line.
[0031] A205. Search for a target script matching the script name based on the path in the dependency table, and execute all target scripts matching the script name in the path order in the dependency table through a preset eval function (used to execute a string expression and return the value of the expression), to obtain script running output variables matching the script to be run; in this embodiment, the script running output variables include the variable name and corresponding data generated in the workspace after the eval function executes the script to be run; specifically, during the implementation process, the eval function can search for the corresponding target script in the dependency table through the script name, that is, the script in the script to be run, and run the script line by line in the path order in the dependency table until the end.
[0032] A206. Call the sprof function to turn off the timer so as to obtain the script running time of the script to be run; specifically, during the implementation process, the sprof function can generate an end timing mark and set a breakpoint on the marked line to turn off the timer, and obtain the running time of the script to be run according to the timing result of the timer.
[0033] A207. The script running output variables and the script running time are taken as the script running results, and the script running results are stored in the specified file path matching the specified script execution tool through the preset save function (a function for saving array objects in a file). Specifically, in this embodiment, the first script running result obtained by the Matlab software for automatically batch running the script to be run is stored in the preset matlab_data folder, and the second script running result obtained by the Mlang compatible tool for automatically batch running the script to be run is stored in the preset mlang_data folder. Specifically, during the implementation process, the save function can scan the script running output variables such as the variable name and the corresponding value in the workspace, and write the script running output variables in sequence in the form of a structure until the last variable, and finally save all the data as a .mat format file (standard binary file) to facilitate subsequent data processing.
[0034] In this embodiment, the runscript function can automatically batch run the scripts to be run based on the script name and the dependency table and save the script running results.
[0035] S5. Call the automatic comparison function to perform a cross comparison on the first script running result and the second script running result to obtain comparison result data.
[0036] Specifically, in this embodiment, the automatic comparison function includes a loaddata function (a function used to load pre-stored data), a datashow function (a visual analysis and display tool) and a compare function (a public member function of a string class); correspondingly, the automatic comparison function is called to perform a cross-comparison process on the first script running result and the second script running result to obtain comparison result data, including: S501. Obtain the paths where the first script execution result and the second script execution result are located respectively, and search and import the first script execution result and the second script execution result according to the paths where the first script execution result and the second script execution result are located through the loaddata function; specifically, the loaddata function can search whether the first script execution result and the second script execution result exist through the specified path information, and if so, import the corresponding data.
[0037] S502. Performing image conversion processing on the first script running result and the second script running result through the datashow function to obtain a first image and a second image corresponding to the first script running result and the second script running result respectively; Specifically, during the implementation of this embodiment, the first script execution result and the second script execution result are often arrays composed of multiple scalar elements. Before performing image conversion processing on the first script execution result or the second script execution result, the data type of the first script execution result or the second script execution result is pre-determined.
[0038] If the data type of the first script running result or the second script running result is an array type, in the process of converting the first script running result and the second script running result into an image through the datashow function, the first script running result and the second script running result are drawn into an image through the preset plot function; specifically, in the process of drawing the first script running result or the second script running result into an image through the preset plot function, an x-axis and y-axis coordinate system are first generated, and the y-axis data points are used as the data in the first script running result or the second script running result, and the x-axis data points are adaptively distributed at uniform intervals according to the length of the data in the first script running result or the second script running result (scalar: length is 1; array: length is greater than or equal to 1). At this time, the schematic diagrams of the first image and the second image obtained are respectively as shown in Figure 2 As shown in Figure (a) and Figure (b).
[0039] If the data type of the first script running result or the second script running result is a scalar type (not an array), then after the image conversion process, the value is printed in the drawn image to obtain a first image corresponding to the first script running result or a second image corresponding to the second script running result. The schematic diagrams of the first image and the second image obtained at this time are respectively as follows: Figure 3 As shown in Figure (a) and Figure (b).
[0040] In this embodiment, after obtaining the first picture and the second picture, a preset saveas function (a function used to save an image) is used to save the first picture and the second picture.
[0041] S503. Compare the first image and the second image through the compare function to obtain a difference map, and use the difference map as the comparison result data of the first script running result and the second script running result. Specifically, the compare function can perform subtraction processing on the first image and the second image to obtain a difference map between the two, which can help to quickly identify the difference between the first script running result and the second script running result, and can avoid intuitively describing data features when recording too much data.
[0042] In the implementation process of this embodiment, when the first picture and the second picture are compared and processed by the compare function, the data corresponding to the first picture and the second picture are directly subtracted to obtain a difference array or a difference scalar. Specifically, when the data type of the first script running result and the second script running result is an array type, as an example, the first script running result is 2.55, the second script running result is 2.54, and the obtained difference data is 0.01 (difference scalar); when the data type of the first script running result and the second script running result is a scalar type, as an example, the first script running result is [2.55, 2.55], the second script running result is [2.54, 2.54], and the obtained difference data is [0.01, 0.01] (difference value). Finally, the preset plot function is used to draw the drawing corresponding to the difference data to obtain a difference map, and the preset saveas function is used to save the difference map to the compare_data folder. As an example, when the data types of the first script execution result and the second script execution result are array types, the schematic diagram of the corresponding difference graph is as follows: Figure 4 As shown, when the data types of the first script running result and the second script running result are scalar types, the schematic diagram of the corresponding difference graph is as follows Figure 5 shown.
[0043] In this embodiment, in step S5, after obtaining the comparison result data, the method further includes: S6. Generate a comparison report based on the comparison result data.
[0044] Specifically, generating a comparison report according to the comparison result data includes: S601. Create a report generation function; wherein the report generation function includes a create_table function (for creating a table), an add_heading function (for adding a title to a report or document) and a generate_report function (for generating a report or document); it should be noted that the create_table function, the add_heading function and the generate_report function are all developed using the Julia language, thereby directly generating a report based on the stored comparison result data.
[0045] S602. Call the report generation function, and add table elements based on the create_table function, wherein the table elements include table frames, fields and fonts. Add table elements based on the create_table function, that is, generate a table in the report, and select font style and style, etc.; add title fields based on the add_heading function, that is, confirm the number of titles in the table, and add title fields in the table, such as the script name and the comparison result of whether the comparison is passed, and generate a report file based on the generate_report function, and then integrate the table elements, title fields and report files to obtain a comparison report. Specifically, generate a report file based on the generate_report function, that is, first confirm the report name, such as "results automated comparison report.docx", and confirm the report template, such as a word document with a company logo, to obtain a report file, so as to integrate the table elements, title fields and report files to generate a comparison report.
[0046] It should be noted that, in this embodiment, the comparison report includes data such as script accuracy statistics, speed comparison, quantity statistics, Mlang error information statistics, etc. During the implementation process, by checking the "script accuracy statistics", it is possible to quickly verify whether the results output by the Mlang compatible tool are accurate, by checking the "speed comparison", it is possible to quickly understand the running speed of the Mlang compatible tool and the Matlab software, by checking the "quantity statistics", it is possible to quickly understand the number of scripts run by the Mlang compatible tool and the Matlab software, and the number of successful / failed runs, by checking the "Mlang error information statistics", it is possible to quickly understand the error information corresponding to the script that failed to run the Mlang compatible tool, thereby facilitating users to promptly confirm whether the results output by the Mlang compatible tool are accurate.
[0047] Based on the setting of the above step S6, after obtaining the comparison result data, this embodiment can further generate a comparison report so that the user can quickly understand the script running status, and can batch verify whether the running script results are accurate based on the comparison report, thereby further improving the script testing efficiency.
[0048] This embodiment can process multiple scripts in batches through Matlab software and Mlang compatible tools respectively, and can automatically compare the running results of two scripts to obtain comparison result data, so that users can quickly confirm whether the results output by the Mlang compatible tool are accurate. Specifically, during the implementation of this embodiment, a script automated batch running function and an automated comparison function are first created, and after obtaining the script to be run, the script automated batch running function is called to perform automated batch running processing on the script to be run through Matlab software to obtain the first script running result, and then the script automated batch running function is called to perform automated batch running processing on the script to be run through the Mlang compatible tool to obtain the second script running result, and finally the automated comparison function is called to perform cross-comparison processing on the first script running result and the second script running result to obtain the comparison result data. Based on this, this embodiment can realize the automated batch running data of the script to be run by Matlab software and Mlang compatible tools through the script automated batch running function, and cross-compare the two script running results through the automated comparison function to quickly obtain the comparison result data, thereby greatly reducing manual intervention, and realizing automated testing of the script to be run and comparison of the script running results, which is beneficial to improving the verification efficiency and accuracy of whether the script running results obtained by the Mlang compatible tool are consistent with the script running results obtained by the Matlab software, thereby ensuring the functional correctness and performance consistency after code transplantation.
[0049] Embodiment 2: This embodiment discloses a script running result comparison system, which is used to implement the script running result comparison method in Embodiment 1; Figure 6 As shown, the script running result comparison system includes: A function creation module, used to create a script automated batch run function and an automated comparison function; wherein the script automated batch run function is used to automatically batch run a specified script and store the script run results obtained after the specified script is run; the automated comparison function is used to perform a cross comparison process on any two script run results; The script acquisition module is used to obtain the script to be run; A script running module, which is respectively connected to the function creation module and the script acquisition module in communication, and is used to call the script automatic batch running function so as to perform automatic batch running processing on the scripts to be run through Matlab software to obtain a first script running result; and is also used to call the script automatic batch running function so as to perform automatic batch running processing on the scripts to be run through an Mlang compatible tool to obtain a second script running result; The result comparison module is connected to the script running module for calling the automatic comparison function to perform a cross comparison on the first script running result and the second script running result to obtain comparison result data.
[0050] It should be noted that the working process, working details and technical effects of the script running result comparison system provided in this embodiment 2 can be found in embodiment 1 and will not be described in detail here.
[0051] Embodiment 3: Based on Embodiment 1 or 2, this embodiment discloses an electronic device, which may be a smart phone, a tablet computer, a laptop computer, or a desktop computer. The electronic device may be referred to as a user terminal, a portable terminal, a desktop terminal, etc. Figure 7 As shown, the electronic equipment includes: a memory for storing computer program instructions; and, A processor is used to execute the computer program instructions to complete the operation of the script running result comparison method as described in any one of Example 1.
[0052] Specifically, the processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 301 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 301 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen.
[0053] The memory 302 may include one or more computer-readable storage media, which may be non-transitory. The memory 302 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 302 is used to store at least one instruction, which is used to be executed by the processor 301 to implement the script running result comparison method provided in Example 1 of the present application.
[0054] In some embodiments, the terminal may further optionally include: a communication interface 303 and at least one peripheral device. The processor 301, the memory 302 and the communication interface 303 may be connected via a bus or a signal line. Each peripheral device may be connected to the communication interface 303 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 304, a display screen 305 and a power supply 306.
[0055] The communication interface 303 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 301 and the memory 302. In some embodiments, the processor 301, the memory 302, and the communication interface 303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 301, the memory 302, and the communication interface 303 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0056] The radio frequency circuit 304 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 304 communicates with a communication network and other communication devices through electromagnetic signals.
[0057] The display screen 305 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof.
[0058] The power supply 306 is used to supply power to various components in the electronic device.
[0059] Embodiment 4: Based on any one of Examples 1 to 3, this embodiment discloses a computer program product, including a computer program or instructions, which, when executed by a computer, implements the script running result comparison method as described in any one of Example 1.
[0060] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0061] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, a person skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A script running result comparison method, characterized in that: include: Create a script automated batch run function and an automated comparison function; wherein the script automated batch run function is used to automatically run the specified scripts in batches and store the script run results obtained after the specified scripts are run; the automated comparison function is used to perform cross-comparison processing on any two script run results; Get the script to be run; Calling the script automatic batch running function to perform automatic batch running processing on the script to be run through Matlab software to obtain a first script running result; Calling the script automatic batch running function to perform automatic batch running processing on the script to be run through an Mlang compatible tool to obtain a second script running result; The automated comparison function is called to perform a cross comparison on the first script running result and the second script running result to obtain comparison result data.
2. A script running result comparison method according to claim 1, characterized in that: The script automatic batch running function includes a script running function and a script path management function; correspondingly, the script automatic batch running function is called to perform automatic batch running processing on the scripts to be run through a specified script execution tool to obtain script running results, including: The designated script execution tool receives the designated path where the script to be run is located and the script name of the script to be run; The designated script execution tool inputs the designated path and the script name into the script path management function, and inputs the script name into the script running function, so that the script path management function obtains a dependency table matching the script to be run according to the designated path, and the script running function automatically batch runs all scripts in the script to be run based on the script name and the dependency table to obtain the script running result of the script to be run; wherein the dependency table includes the designated path and all subfolder paths under the designated path that include the script corresponding to the script name, and the designated path and all subfolder paths are spliced and set; Among them, the designated script execution tool is Matlab software or an Mlang compatible tool; correspondingly, the script running result is the first script running result obtained by automatically batch running the scripts to be run through the Matlab software or the second script running result obtained by automatically batch running the scripts to be run through the Mlang compatible tool.
3. A script running result comparison method according to claim 2, characterized in that: The script path management function includes an addpath_recursive function and a joinpath function; correspondingly, obtaining a dependency table matching the script to be run according to the specified path through the script path management function includes: Traversing all subfolders under the specified path according to the script name through the addpath_recursive function to obtain the subfolder paths of all target scripts in the script to be run; According to the joinpath function, all subfolder paths of the target script are concatenated to obtain a concatenated path; A dependency table is obtained according to the specified path and the concatenated path.
4. A script running result comparison method according to claim 2, characterized in that: The script running function adopts the runscript function; correspondingly, all the scripts in the script to be run are automatically batch-run based on the script name and the dependency table through the script running function to obtain the script running results of the script to be run, including: Enable the preset sprof function to turn on the timer; Searching for a target script that matches the script name based on the path in the dependency table, and executing all target scripts that match the script name in the order of the paths in the dependency table through a preset eval function to obtain a script running output variable that matches the script to be run; Calling the sprof function to close the timer, so as to obtain the script running time of the script to be run; The script running output variable and the script running time are taken as the script running result, and the script running result is stored in a specified file path matching the specified script execution tool through a preset save function.
5. A script running result comparison method according to claim 1, characterized in that: The automated comparison function includes a loaddata function, a datashow function, and a compare function; correspondingly, the automated comparison function is called to perform a cross-comparison process on the first script running result and the second script running result to obtain comparison result data, including: Respectively obtain the paths where the first script execution result and the second script execution result are located, and search and import the first script execution result and the second script execution result according to the paths where the first script execution result and the second script execution result are located through the loaddata function; Performing image conversion processing on the first script running result and the second script running result through the datashow function to obtain a first image and a second image corresponding to the first script running result and the second script running result respectively; The first picture and the second picture are compared by the compare function to obtain a difference map, and the difference map is used as comparison result data of the first script running result and the second script running result.
6. A script running result comparison method according to claim 1, characterized in that: After obtaining the comparison result data, the method further includes: A comparison report is generated according to the comparison result data.
7. A script running result comparison method according to claim 6, characterized in that: Generate a comparison report based on the comparison result data, including: Create a report generation function; wherein the report generation function includes a create_table function, an add_heading function and a generate_report function; The report generation function is called, and table elements are added based on the create_table function, title fields are added based on the add_heading function, and a report file is generated based on the generate_report function, and then the table elements, title fields and report file are integrated to obtain a comparison report.
8. A script running result comparison system, characterized in that: Used to implement the script running result comparison method as described in any one of claims 1 to 7; The script running result comparison system includes: A function creation module, used to create a script automated batch run function and an automated comparison function; wherein the script automated batch run function is used to automatically batch run a specified script and store the script run results obtained after the specified script is run; the automated comparison function is used to perform a cross comparison process on any two script run results; The script acquisition module is used to obtain the script to be run; A script running module, which is respectively connected to the function creation module and the script acquisition module in communication, and is used to call the script automatic batch running function so as to perform automatic batch running processing on the scripts to be run through Matlab software to obtain a first script running result; and is also used to call the script automatic batch running function so as to perform automatic batch running processing on the scripts to be run through an Mlang compatible tool to obtain a second script running result; The result comparison module is connected to the script running module for calling the automatic comparison function to perform a cross comparison on the first script running result and the second script running result to obtain comparison result data.
9. An electronic device, characterized in that: include: a memory for storing computer program instructions; as well as, A processor is used to execute the computer program instructions to complete the operation of the script running result comparison method as described in any one of claims 1 to 7.
10. A computer program product comprising a computer program or instructions, characterized in that: When the computer program or the instruction is executed by a computer, the script running result comparison method as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Automatic generation system and automatic generation method of electronic control unit (ECU) diagnosis software model of automobile
CN102902852A
Automatic detection method of testing scripts for rail transit vehicle-mounted controller software
CN105912469A
Operation data verification method and device, computer equipment and readable storage medium
CN110737985A
Automatic script testing method and device, electronic equipment and readable medium
CN111274147A
ModeLica modeling method and device based on Python model library, electronic equipment and product
CN118607222A