Code processing methods, devices, electronic devices and readable media

By automatically creating target virtual machines and deploying a test environment with an adapted operating system kernel and compiler version in the cloud platform, the problem of time-consuming code adaptation is solved, and efficient automated testing is achieved.

CN114546819BActive Publication Date: 2025-10-31LOONGSON TECH CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011355526.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-26
Publication Date
2025-10-31
Estimated Expiration
2040-11-26

AI Technical Summary

Technical Problem

In existing technologies, code adaptation is time-consuming and inefficient, especially since manual configuration of the entire device is required for testing and verification after generating new code.

Method used

By creating a target virtual machine in the cloud platform, a test environment with the operating system kernel version and compiler version is automatically deployed according to the test configuration information, thus achieving automated code testing.

Benefits of technology

It reduces the time spent on code testing, improves testing efficiency, reduces resource waste and implementation difficulty, and simplifies user operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114546819B_ABST
    Figure CN114546819B_ABST
Patent Text Reader

Abstract

This invention provides a code processing method, apparatus, electronic device, and readable medium. The method involves receiving test data sent by a user. The test data includes code to be tested and test configuration information. Based on the hardware configuration information in the test configuration information, a target virtual machine is created in a cloud platform. If the code to be tested is source code, a test environment is deployed in the target virtual machine using an operating system kernel version compatible with the operating system kernel version in the test configuration information, and a compilation environment is deployed in the target virtual machine using a compiler version compatible with the compiler version in the test configuration information. The code to be tested is then tested based on the target virtual machine. In this invention, the user only needs to provide test configuration information; the cloud platform automatically creates a target virtual machine that meets the test configuration requirements and automatically performs the test, thereby reducing time consumption and improving efficiency to some extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electronic device technology, and in particular to a code processing method, apparatus, electronic device and readable medium. Background Technology

[0002] Currently, new code is frequently generated for operating systems. This includes developing application code for that operating system, code for operating system components, code for updating system software within the operating system, and so on. To ensure the newly generated code runs correctly later, it is often necessary to adapt the code file after development; that is, to test and verify the code file.

[0003] In existing technologies, developers typically manually configure the entire device to meet the configuration requirements and then perform adaptation. This approach is time-consuming and inefficient. Summary of the Invention

[0004] This invention provides a code processing method, apparatus, electronic device, and readable medium to solve the problems of long processing time and low efficiency in code adaptation in related technologies.

[0005] Firstly, a code processing method is provided for application on a cloud platform, the method comprising:

[0006] Receive test data sent by the user; the test data includes the code to be tested and test configuration information;

[0007] Based on the hardware configuration information in the test configuration information, create the target virtual machine on the cloud platform;

[0008] When the code to be tested is source code, a test environment is deployed in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, and a compilation environment is deployed in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information; the cloud platform stores different versions of operating system kernels and different versions of compilers;

[0009] The code to be tested is tested based on the target virtual machine, and the test results are obtained.

[0010] Secondly, a code processing device is provided for use on a cloud platform, the device comprising:

[0011] The first receiving module is used to receive test data sent by the user; the test data includes the code to be tested and test configuration information.

[0012] A creation module is used to create a target virtual machine on the cloud platform based on the hardware configuration information in the test configuration information;

[0013] The first deployment module is used to deploy a test environment in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, when the code to be tested is source code; and to deploy a compilation environment in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information; the cloud platform stores different versions of operating system kernels and different versions of compilers.

[0014] The first testing module is used to test the code to be tested based on the target virtual machine and obtain test results.

[0015] Thirdly, an electronic device is provided, comprising:

[0016] One or more processors; and

[0017] One or more machine-readable media on which instructions are stored, which, when executed by the one or more processors, cause the electronic device to perform the code processing method.

[0018] Fourthly, one or more machine-readable media are provided, having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the code processing method.

[0019] In this embodiment of the invention, the method includes receiving test data sent by a user; the test data includes code to be tested and test configuration information; based on the hardware configuration information in the test configuration information, a target virtual machine is created in a cloud platform; if the code to be tested is source code, a test environment is deployed in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, and a compilation environment is deployed in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information. The cloud platform stores different versions of operating system kernels and different versions of compilers. The test code is tested based on the target virtual machine to obtain test results. In this invention, the user only needs to provide test configuration information, and the cloud platform will automatically create a target virtual machine that meets the test configuration requirements and automatically perform the test, thereby reducing time consumption and improving efficiency to a certain extent.

[0020] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0021] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0022] Figure 1 This is a flowchart of the steps of a code processing method provided in an embodiment of the present invention;

[0023] Figure 2 This is a schematic diagram of a processing flow provided in an embodiment of the present invention;

[0024] Figure 3 This is a structural block diagram of a code processing device provided in an embodiment of the present invention. Detailed Implementation

[0025] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.

[0026] Figure 1 This is a flowchart illustrating the steps of a code processing method provided in an embodiment of the present invention. This method can be applied to cloud platforms, such as... Figure 1 As shown, the method may include:

[0027] Step 101: Receive the test data sent by the user; the test data includes the test code and test configuration information.

[0028] In this embodiment of the invention, the cloud platform can be a server cluster composed of multiple server nodes, and the cloud platform can be operated and maintained by the operating system provider. The cloud platform can include different types of nodes. The type of node can be determined based on factors such as the instruction set type applied by the node's CPU, the type of operating system running the node, or the maximum data width that the node's CPU can process per unit time. That is, the cloud platform in this embodiment of the invention can include nodes supporting different instruction set types and nodes supporting different operating systems. The operating system can be Loongnix or UOS, etc., and the applied instruction set type can be the instruction set architecture (ISA) corresponding to the operating system, such as MIPS, or LoongISA, LoongARCH, etc.

[0029] Furthermore, the data to be tested can be sent by the user to the cloud platform based on their own terminal. The code to be tested in the data can be system-level code targeting the operating system. For example, it could be code generated during updates to the kernel, drivers, file systems, security management components, resource management components (e.g., cgroup components, namespace components), development environment, desktop system, etc., involved in the construction of an operating system ecosystem based on the operating system's instruction set architecture. The code to be tested can also be application-level code applied to the operating system, such as the code of software developed for the operating system and applied to that operating system.

[0030] Furthermore, test configuration information can characterize the configuration requirements that need to be met when testing the code under test. Test configuration information can indicate the hardware configuration required for testing to ensure the testing process can proceed normally. Test configuration information can also further indicate the operating system configuration requirements, such as the compiler version and operating system kernel version used for testing, etc., to ensure that the code under test, after passing the test, is compatible with the operating system and can subsequently run normally on that operating system.

[0031] Step 102: Create the target virtual machine in the cloud platform according to the hardware configuration information in the test configuration information.

[0032] In this embodiment of the invention, the target virtual machine can be built based on the hardware resources of a cloud platform, and the configuration used by the target virtual machine matches the hardware configuration indicated by the hardware configuration information. The hardware resources used by the target virtual machine can be the minimum amount of resources required to satisfy the hardware configuration indicated by the test configuration information. This avoids the problem of wasted resources compared to directly using an entire physical machine for adaptation, where there are idle resources within the physical machine.

[0033] Step 103: If the code to be tested is source code, deploy a test environment in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, and deploy a compilation environment in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information; the cloud platform stores different versions of operating system kernels and different versions of compilers.

[0034] Since source code needs to be compiled before it can run, when the code to be tested is source code—that is, when the operating system-compatible medium is source code—a compatible compiler and a compilation environment must be obtained to ensure that the code to be tested can be run. Similarly, to ensure that the compiled code to be tested can run correctly, a compatible operating system kernel and a test environment must be obtained.

[0035] In this embodiment of the invention, a target virtual machine matching the configuration is built and adapted according to the configuration indicated by the test configuration information, thereby avoiding resource waste to some extent. Simultaneously, by automatically building a target virtual machine whose compilation and testing environments both conform to the compiler version and operating system kernel version specified by the user, it can be ensured that the target virtual machine meets the testing requirements. This eliminates the need for users to manually configure the entire machine to meet the configuration requirements while ensuring test effectiveness, thus reducing time consumption and improving efficiency to some extent.

[0036] Step 104: Test the code to be tested based on the target virtual machine and obtain the test results.

[0037] In this embodiment of the invention, the code to be tested can be tested on a target virtual machine. Since the target virtual machine meets the configuration requirements, testing the code to be tested on the target virtual machine can, to some extent, ensure the smooth progress of the testing process. Furthermore, in this embodiment of the invention, the test results can also be returned to the user. By returning the test results to the user, the user can conveniently know whether the code to be tested has passed the test.

[0038] In summary, the code processing method provided by this invention includes: receiving test data sent by a user; the test data includes code to be tested and test configuration information; creating a target virtual machine in a cloud platform according to the hardware configuration information in the test configuration information; if the code to be tested is source code, deploying a test environment in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, and deploying a compilation environment in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information; the cloud platform stores different versions of operating system kernels and different versions of compilers; testing the code to be tested based on the target virtual machine to obtain test results. In this invention, the user only needs to provide test configuration information, and the cloud platform will automatically create a target virtual machine that meets the test configuration requirements and automatically perform testing, thereby reducing time consumption and improving efficiency to a certain extent.

[0039] Furthermore, in practical applications, compiler and operating system kernel versions are often quite complex. For code to be tested that is compatible with different compiler and operating system kernel versions, code developers need to manually obtain the corresponding compiler and operating system kernel versions before they can perform subsequent testing operations. This leads to significant implementation difficulty and cost for code testing. In this embodiment of the invention, by pre-storing various compiler and operating system kernel versions in the cloud platform, users only need to specify the required compiler and operating system kernel versions in the test configuration information to control the cloud platform to test the code to be tested with the corresponding compiler and operating system kernel versions. This eliminates the need for manual acquisition, reduces implementation difficulty and cost, and further improves testing efficiency.

[0040] Meanwhile, in this embodiment of the invention, the cloud platform can directly test the code to be tested in the form of source code. This allows code developers to perform testing operations through the cloud platform immediately after developing the code, without having to perform any additional operations, such as converting the source code into executable software. This further simplifies user operations and improves testing efficiency.

[0041] Optionally, in one implementation of this invention, the number of operating system kernel versions included in the test configuration information can be one or more, and the specific number can be set according to actual needs. Further, the operation of creating a target virtual machine in the cloud platform based on the test configuration information can include: scheduling computing resources from the cloud platform that meet the configuration indicated by the hardware configuration information, and creating the target virtual machine based on the computing resources.

[0042] It should be noted that the cloud platform may include management nodes and computing nodes. The various steps in this embodiment of the invention may be specifically executed by the management node in the cloud platform. Furthermore, the management node can configure and schedule the hardware resources of the computing nodes according to the hardware configuration information, providing a hardware foundation for the target virtual machine, thereby enabling the target virtual machine to subsequently possess data processing capabilities. The hardware configuration information may include one or more hardware-related parameters such as the model of the Central Processing Unit (CPU), the number of CPU cores, memory capacity, and storage capacity. Since an operating system based on an instruction set architecture must be tested and passed on complete machines (e.g., computers, servers, etc.) that support the corresponding operating system chips before it can be used normally on terminal devices, servers, etc., that is, on ecosystem products that use the operating system.

[0043] Therefore, by specifying the CPU model in the hardware configuration information, the subsequent adaptation effect can be ensured. Of course, the test configuration information can also include other information, such as the location of the modified source code, which could be the location of the modified Git repository. This facilitates the subsequent retrieval of the corresponding source code; however, this embodiment of the invention does not limit this aspect.

[0044] For example, after receiving the test data, the cloud platform administrator initiates the creation process, or the process can be started automatically. The creation time can be 3-5 seconds. After successful creation, it can be handed over to the adaptation personnel, who can then control the initiation of subsequent testing processes, or the process can be started automatically. Assuming the hardware configuration information includes the CPU model, number of CPU cores, and memory capacity, specifically the CPU model AAA, the number of CPU cores, and the memory capacity 8GB, the cloud platform can schedule a 16-core CPU of model AAA and 8GB of memory from the compute node as computing resources to provide computing power to the target virtual machine. These scheduled computing resources can occupy a portion of the resources of a single compute node, or they can represent the total resources provided by one or more compute nodes.

[0045] Furthermore, the operation of deploying the test environment in the target virtual machine using an operating system kernel compatible with the operating system kernel version in the test configuration information may include the following steps:

[0046] Step S11: Obtain an operating system kernel that is compatible with the operating system kernel version from the various versions of operating system kernels pre-stored in the cloud platform.

[0047] In this embodiment of the invention, the cloud platform can pre-store various versions of operating system kernels. Each operating system kernel corresponds to the code that makes up the basic functional framework of the operating system. The operating system kernel can be divided into user mode and kernel mode. Generally, application-level software code runs in user mode, while system-level code runs in kernel mode. For example, drivers in an operating system need to run in kernel mode. When the code to be tested is application-level software code, the operating system kernel version can indicate the corresponding version in user mode; when the code to be tested is system-level code, the operating system kernel version can indicate the corresponding version in kernel mode.

[0048] Furthermore, based on the operating system kernel version specified in the configuration information, a search can be conducted among the stored operating system kernel versions to obtain an operating system kernel compatible with that version. For example, an operating system kernel with the same version as the specified kernel can be identified as the compatible kernel. For instance, if the operating system kernel version specified in the configuration information is Linux system version 1.0, then a Linux system kernel version 1.0 can be searched for in the cloud platform as the compatible operating system kernel.

[0049] Step S12: Deploy the test environment in the target virtual machine according to the compatible operating system kernel.

[0050] In this embodiment of the invention, the compatible operating system kernel is one that meets the user's needs and is consistent with the operating system kernel version required by the user. Therefore, by deploying a test environment in the target virtual machine based on this compatible operating system kernel, the final test environment in the target virtual machine can meet the user's testing requirements, thereby ensuring the subsequent adaptation effect.

[0051] In this embodiment of the invention, a target virtual machine is created by scheduling computing resources that meet the configuration specified in the hardware configuration information. An operating system kernel matching the user's needs is then deployed within this target virtual machine. This ensures, to a certain extent, that the target virtual machine can meet the user's configuration requirements, guaranteeing smooth execution of the adaptation process on the operating system platform corresponding to the code under test. It also avoids the problem of testing failing due to inconsistencies between the operating system kernel version used and the user's required version.

[0052] Optionally, the above-described operation of deploying the compilation environment in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information may include the following steps:

[0053] Step S21: Obtain a compiler that is compatible with the compiler version from the various versions of compilers pre-stored in the cloud platform.

[0054] The compiler can be the code used for compilation. Further, it can first detect whether the code to be tested is source code. For example, it can determine whether the code to be tested is source code based on the code type specified by the user. If the code to be tested is source code, it can search among the stored compiler versions specified in the configuration information to find a compiler compatible with that version. For example, a compiler with the same version as the specified compiler can be identified as the compatible compiler. For instance, if the compiler version specified in the configuration information is GCC version 7.3, then a GCC version 7.3 compiler can be found on the cloud platform as the compatible compiler. It should be noted that the cloud platform is based on Linux. The cloud platform itself and the virtual machine images running on the cloud platform can support real-time updates of the kernel code library and compiler code library within the virtual machine at the Linux kernel level, thereby ensuring that the cloud platform can build virtual machines and find the corresponding kernel and compiler versions.

[0055] Step S22: Deploy the compilation environment in the target virtual machine according to the compatible compiler.

[0056] Since the compatible compiler is one that meets the user's needs and is consistent with the compiler version required by the user, deploying the compilation environment in the target virtual machine based on this compatible compiler ensures that the final compilation environment in the target virtual machine meets the user's compilation requirements, thereby ensuring the subsequent compilation effect. It should be noted that in this embodiment of the invention, the code to be tested can also be the compiled code corresponding to an image file. The image format can be ISO format, and the image file can also be called an ISO file; this image file can be a cloud operating system image. The number of compiler versions can be one or more, and the specific number can be set according to actual needs. In this embodiment of the invention, when the code to be tested is the compiled code corresponding to an image file, the test environment can be deployed in the target virtual machine only based on an operating system kernel that is compatible with the operating system kernel version in the test configuration information. The deployment of the compilation environment is only performed when the code to be tested is source code, to save operational costs. Of course, the compilation environment can also be deployed directly in the target virtual machine to ensure normal compilation when needed, while omitting the operation of determining whether the code to be tested is source code.

[0057] In this embodiment of the invention, by determining whether the code to be tested is source code, a compiler matching the user's requirements is obtained only if the code to be tested is source code. The compilation environment is then deployed on the target virtual machine based on this matching compiler. This avoids unnecessary deployment of the compilation environment, thereby saving processing resources. Simultaneously, it also helps to prevent compilation errors caused by a mismatch between the compiler version used and the user's required version during subsequent compilation.

[0058] Optionally, the above test configuration information may also include package information for the first dependency package required by the compilation environment and package information for the second dependency package required by the test environment. Package information can be used to indicate dependency packages; for example, package information may include the dependency package's name, number, version, etc. The number and specific content of the first dependency package information and the second dependency package information included in the operating system configuration information can be set by the user according to actual needs.

[0059] Accordingly, the operation of deploying the compilation environment in the target virtual machine according to the adapted compiler may include: step S22a, obtaining the first dependency package from a preset dependency package database according to the package information of the first dependency package; step S22b, generating a compilation image corresponding to the code to be tested based on the adapted compiler and the first dependency package, and installing the compilation image in the target virtual machine to deploy the compilation environment.

[0060] Specifically, the preset dependency package database can be pre-created in the cloud platform, storing different versions of dependency packages. Correspondingly, based on the package information of the first dependency package, the database can be searched for the dependency package indicated by that package information. This first dependency package can be a code package that the compilation operation depends on. The absence of the first dependency package may cause compilation errors. Then, the compatible compiler and the first dependency package can be combined to obtain a compiled image. Further, this compiled image can be installed on the target virtual machine to deploy the compilation environment.

[0061] In this embodiment of the invention, a compilation environment is deployed by obtaining a first dependency package and, based on the first dependency package and a compatible compiler. This can, to some extent, avoid compilation errors caused by missing packages or incompatibility between dependency packages and user requirements, thereby improving compilation efficiency.

[0062] Furthermore, the operation of deploying the test environment in the target virtual machine according to the adapted operating system kernel may include: step S13a, obtaining the second dependency package from the preset dependency package database according to the package information of the second dependency package; step S13b, generating a test image corresponding to the code to be tested based on the adapted operating system kernel and the second dependency package, and installing the test image in the target virtual machine to deploy the test environment.

[0063] Specifically, based on the package information of the second dependency package, the system can search for the dependency package indicated by the package information of the second dependency package in a preset dependency package database to obtain the second dependency package. This second dependency package can be a code package that the test operation depends on. The absence of the second dependency package may cause the test operation to fail. Then, the compatible operating system kernel and the second dependency package can be combined to obtain a test image. Further, this test image can be installed into the target virtual machine to deploy the test environment. The test image can be represented as testimage1.

[0064] In this embodiment of the invention, a test environment is deployed based on a second dependency package and a compatible operating system kernel. This can, to some extent, avoid test errors caused by missing packages, thereby improving test efficiency.

[0065] Optionally, in this embodiment of the invention, after creating the compilation image and the test image, the following operations may be performed:

[0066] Step S31: Store the compiled image and the test image in a preset file.

[0067] In this embodiment of the invention, the specific type of the preset file can be set according to actual needs. For example, the preset file can be a service directory. Specifically, during storage, the specific versions and dependency package information used in the compiled image and test image can be stored corresponding to the image, thus facilitating subsequent retrieval from the preset file. It should be noted that in this embodiment of the invention, the compiled image and test image can be stored in the preset file after creation. Correspondingly, when deploying the compilation environment and test environment, the compiled image and test image can be read from the preset file for deployment. Due to the specific characteristics of operating system adaptation projects, such as the kernel source code not being fixed, frequent compiler updates and iterations, and continuous new code contributions to the file system and minor versions of the development language, there are often many pieces of code to be tested in actual application scenarios. In this embodiment of the invention, a test environment and a compilation environment are created on the cloud platform for each piece of code to be tested, and the image is placed in the service directory for convenient use.

[0068] Step S32: If new test data is received and a compilation image and / or test image that matches the test configuration information of the new test data exists in the preset file, then the matching compilation image and / or test image shall be used as the compilation image and / or test image adapted to the new test data.

[0069] The new test data can be submitted by the same user or by different users, including code developers. Upon receiving the new test data, the system determines the required operating system kernel version, compiler version, and dependencies based on the test configuration information within the new data. Then, it searches a pre-defined file for an image whose operating system, compiler, and dependencies match the requirements of the new test data. This matching image can then be used as the image adapted to the new test data. When creating a target virtual machine for the new test data, this adapted image can be reused.

[0070] In this embodiment of the invention, after each generation of a compiled image and a test image, the compiled image and test image are stored in a preset file. When new test data is received subsequently, a matching image is searched from the preset file for use. In this way, by reusing previously generated compiled images and test images, the number of image generation operations can be reduced to some extent, thereby saving processing resources and improving the efficiency of subsequent operations.

[0071] Optionally, in one implementation of this invention, the operation of testing the code to be tested based on the target virtual machine to obtain test results may include the following steps:

[0072] Step S41: Compile the code to be tested based on the compilation environment in the target virtual machine, and package the compiled code to be tested into a test software package.

[0073] In this step, we first check if the code to be tested is source code. If it is, we import the code to be tested into the compilation environment of the target virtual machine, that is, upload it to the local machine. Then, we perform a compilation operation on the code to be tested based on the compilation environment, thus obtaining the compiled code to be tested. Furthermore, we can perform a packaging operation on the compiled code to obtain the software package to be tested.

[0074] Step S42: Install the software package to be tested into the target virtual machine, run the software package to be tested in the test environment of the target virtual machine, and take the running result as the test result.

[0075] In this step, the software package to be tested can be installed into the target virtual machine following the package installation process. Furthermore, the software package to be tested can be started in the test environment, creating a corresponding running instance, thus enabling the software package to run in the test environment. If the software package to be tested does not run correctly and errors occur, the error message can be used as the running result. If the software package to be tested runs correctly and no errors occur, the running result can be set to normal.

[0076] In this embodiment of the invention, the code to be tested is compiled and packaged into a test software package using the compilation environment in the target virtual machine. Then, the test software package is run in the test environment of the target virtual machine. Based on the test results, it is possible to determine more accurately whether the code to be tested can run normally on a device with the corresponding operating system, ensuring the accuracy of code testing.

[0077] Optionally, in embodiments of the present invention, after compiling the code to be tested based on the compilation environment in the target virtual machine, the following steps can be performed:

[0078] Step S61: If the code to be tested fails to compile, check if there is a missing first dependency package.

[0079] In this step, if a compilation error occurs after compiling the code to be tested, it can be assumed that the compilation of the code to be tested has failed. Accordingly, based on the package information of the first dependency packages included in the operating system configuration information, it can be checked whether there are any first dependency packages that were omitted during the deployment of the current compilation environment and are therefore not used, thus detecting whether there are any missing first dependency packages. Alternatively, dependency package confirmation information can be returned to the user so that the user can confirm whether the package information of the first dependency packages is missing, that is, whether there are any first dependency packages that are not set in the operating system configuration information.

[0080] Step S62: If a missing first dependency package exists, the missing first dependency package will be added to the compilation environment, and the code to be tested will be recompiled based on the compilation environment in the target virtual machine until the compilation result is normal.

[0081] If an unused first dependency package exists when deploying the current build environment, it can be used as the missing first dependency package. Alternatively, if the user returns package information for a new first dependency package, that package information should be used as the missing first dependency package. Furthermore, the missing first dependency package can be downloaded from a unified codebase (i.e., a pre-defined dependency package database) using a ported version control tool. Based on the missing first dependency package, the previously used first dependency packages and a compatible compiler are used to regenerate the build image, and this build image is then reinstalled, thus adding the missing first dependency package to the build environment.

[0082] In this embodiment of the invention, if the code under test fails to compile, the system checks for missing first dependency packages, adds the missing first dependency packages to the compilation environment, and recompiles the code under test based on the compilation environment in the target virtual machine. This improves the compilation success rate, thereby ensuring that the code under test can be tested normally in subsequent processes.

[0083] Optionally, in another implementation of this invention, the operation of testing the code to be tested based on the target virtual machine to obtain test results may include the following steps:

[0084] Step S51: If the code to be tested is the compiled code corresponding to the image file, then install the image file in the target virtual machine based on the code to be tested.

[0085] In this step, since the code to be tested has already been compiled, it can be installed directly. For example, the code to be tested can be installed following a pre-defined package installation process, thereby installing the image file on the target virtual machine.

[0086] Step S52: Run the image file in the test environment of the target virtual machine, and use the running result as the test result.

[0087] For example, you can start the image file in a test environment, creating a corresponding running instance to run the image file in the test environment. If the image file does not run correctly and errors occur, the error messages can be used as the running result. If the image file runs correctly and no errors occur, the running result can be set to normal.

[0088] In this embodiment of the invention, no compilation and packaging are required. When the code to be tested is the compiled code corresponding to the image file, testing can be achieved by directly installing the image file and running it in the test environment of the target virtual machine. This ensures testing efficiency to a certain extent and guarantees a more accurate determination based on the test results as to whether the code to be tested can run normally on the corresponding operating system device, thus ensuring the accuracy of code detection.

[0089] Optionally, in embodiments of the present invention, after testing the code to be tested based on the target virtual machine and obtaining the test results, the following steps may be performed:

[0090] Step S71: If the test results contain runtime error information, then according to the runtime error information, retrieve the dependency package that matches the runtime error information from the preset dependency package database.

[0091] In this step, the runtime error message can be the specific error information that caused the test to fail. Further, the dependency package causing the error can be identified as the matching dependency package based on the specific error message. For example, if the code to be tested is code for a component implementing network connectivity, and the runtime error message is "network card driver failed, network not connected," then the dependency package matching the runtime error message can be determined as the dependency package for implementing the network card driver. Further, in this embodiment of the invention, if the test result is normal, i.e., if the test result does not contain runtime error messages, the code to be tested can be uploaded to a preset code library. In this way, by uploading the code to be tested that passes the test to the preset code library, it is convenient to manage and use code that improves the operating system. For example, if the code to be tested is a new version of the operating system kernel or a new version of the compiler, then when it is necessary to use that version of the operating system kernel and / or compiler later, that version of the operating system kernel and / or compiler can be directly read.

[0092] Step S72: Add the matching dependency package to the test environment and retest the code to be tested until the test results are normal.

[0093] In this step, the test image can be regenerated based on the matching dependency packages, the previously used second dependency package, and the compatible operating system kernel, and then reinstalled, thereby adding the matching dependency packages to the test environment. Furthermore, testing can be performed again based on the test image. It should be noted that, in this embodiment of the invention, if the code to be tested is the compiled code corresponding to the image file, it can also detect whether the image file is missing dependency packages. If dependency packages are missing, the missing dependency packages can be obtained, the image file can be recreated, and the test can be performed again.

[0094] In this embodiment of the invention, when runtime error messages appear in the test results, the system retrieves the corresponding dependency packages from a preset dependency package database based on the error type. Then, the matching dependency packages are added to the compilation environment, and the code to be tested is retested based on the test environment in the target virtual machine. This avoids the problem of tests failing due to missing dependency packages, thus ensuring the accuracy of the tests to a certain extent.

[0095] It should be noted that, in this embodiment of the invention, if compilation errors are found in the compilation result, a dependency package matching the compilation error is retrieved from a preset dependency package database based on the compilation error. Then, the matching dependency package is added to the compilation environment, and compilation is re-performed until the compilation result is normal.

[0096] Optionally, in this embodiment of the invention, the cloud platform may also perform the following steps to enable modifications in case of operational errors:

[0097] Step S81: If the test results contain runtime error information, then deploy a development environment compatible with the code to be tested in the target virtual machine.

[0098] In this embodiment of the invention, the test configuration information may further include development tool information. The development tool information indicates the development tools used when developing the code to be tested. Accordingly, if the test results contain runtime error messages, the development tool indicated by the development tool information can be retrieved from a preset development tool library. Then, a development image corresponding to the code to be tested can be generated based on the indicated development tool, and the development image can be installed on the target virtual machine to deploy the development environment. The development image can be represented as devimage1.

[0099] Specifically, the cloud platform can pre-store various development tools. Based on the development tool information specified in the configuration, a search can be conducted among these stored tools to retrieve the specified tool. For example, assuming the configuration specifies the development tool name as "XXX," the cloud platform can search for the development tool named "XXX." Furthermore, the dependency packages of the indicated development tool can be obtained, and then the development tool and its dependencies can be combined to obtain a development image. Finally, this development image can be installed into the target virtual machine to deploy the development environment. This approach, by deploying the development environment only when runtime errors occur in the test results, avoids the problem of unused deployed development environments leading to wasted processing resources.

[0100] Of course, in this embodiment of the invention, deployment can also be performed directly in the manner described above. This allows users to easily modify the code to be tested when necessary. Furthermore, the development environment can be stored in the aforementioned preset file for later use. If the code to be tested is the compiled code corresponding to the image file, the image file can also be stored in the preset file; this embodiment of the invention does not limit this.

[0101] Step S82: Send a modification reminder message to the user; the modification reminder message includes the permission interface information of the target virtual machine.

[0102] In this step, a modification reminder message can be returned to the user based on the address of the user's terminal. This address can be one that the user has pre-sent to the cloud platform. By sending the modification reminder message carrying the permission interface information of the target virtual machine, the user can gain access to the target virtual machine based on this information. Correspondingly, the cloud platform can support remote operation. The user can then access the target virtual machine through the permission interface information and modify the code to be tested within it. For example, the user can combine this with runtime operation information to perform modification operations on the code to be tested to correct existing bugs.

[0103] Step S83: Receive the user's modification operation on the code to be tested, and adjust the code to be tested based on the modification operation; the modification operation is based on the permission interface input corresponding to the permission interface information.

[0104] In this step, the modification operation can be an add operation, a delete operation, a move operation, etc. Accordingly, the cloud platform can adjust the content of the code under test based on the user's input modification operation. For example, for an add operation, the content corresponding to the add operation can be added to the position indicated by the add operation in the code under test. For a delete operation, the content corresponding to the delete operation can be deleted. For a move operation, the content corresponding to the move operation can be moved to the position indicated by the move operation, thus achieving the adjustment of the code under test.

[0105] Step S84: Retest the adjusted code to be tested.

[0106] Specifically, the testing method can be implemented according to the description in the aforementioned related steps, and will not be repeated here.

[0107] In this embodiment of the invention, by automatically building a development environment and granting users access to the target virtual machine, users can make modifications directly by accessing the target virtual machine without having to manually create a development environment. This can reduce the cost of code modification and improve the efficiency of code modification to a certain extent.

[0108] In one existing approach, code developers typically manually search for suitable versions of the operating system kernel, compiler, and dependencies needed to create compilation and testing environments on community websites. These developers can be operating system providers, integrators, or open-source code contributors. They then apply to the operating system's version control administrator for these resources. After review, the version control administrator sends the resources to the developers via USB drives, cloud storage, or other media. Finally, the developers create the compilation and testing environments on the appropriate system devices using the obtained versions of the operating system kernel, compiler, and dependencies to test the code. This method involves time-consuming processes such as sending the kernel and compiler via USB drives or cloud storage. Furthermore, internal factors like the completeness of the content sent by the version control administrator, the security of the medium, and the correctness of the versions, as well as external factors like the completeness of dependencies, can lead to resending, resulting in extended processing times and impacting the adaptation progress. For example, after a long wait, the received version may not be the desired one, leading to significant time waste.

[0109] In another existing approach, code developers typically apply for a physical machine with the required kernel and compiler versions, then deploy their own compilation and testing environments for testing. Bugs are then fixed by setting up a development environment. However, this approach is time-consuming in terms of physical machine application, and the physical machine configuration may not meet the requirements for sufficient testing. For example, a single physical machine may not be able to cover all test cases; for instance, if multiple different kernel and compiler versions are needed, it may result in incomplete coverage of all test cases. Furthermore, this approach requires the resources of at least one physical machine. In real-world scenarios, however, not all the resources of a physical machine are typically used. For example, a minimum testing environment usually requires 2 cores, 8GB of memory, and 50GB of storage, leading to significant resource idleness on the physical machine. In this embodiment of the invention, users do not need to apply for a kernel, compiler, or configure the corresponding physical machine. They only need to submit the code to be tested and the test configuration information to the cloud platform. Adaptation can be achieved based on the image created by the cloud platform, thereby reducing time consumption and accelerating the adaptation process. Meanwhile, the cloud platform creates a matching target virtual machine for testing based on the test configuration information, meaning that only the required resources are used, thus avoiding resource waste to some extent. Furthermore, since the cloud platform's virtualization technology, based on the open-source Kernel-based Virtual Machine (KVM) module, enables operations such as compilation, testing, and debugging, and can create and successfully start virtual machines and images, using the cloud platform as the execution entity in this embodiment of the invention can, to a certain extent, ensure the smooth execution of each step of the code processing method.

[0110] Figure 2 This is a schematic diagram of a processing flow provided by an embodiment of the present invention, such as... Figure 2 As shown, the process begins by determining if package compatibility is an issue, specifically whether the code under test is source code. If so, the source code is uploaded to the target virtual machine, where a compilation environment and a testing environment are deployed. Next, the source code is compiled using the compilation environment. If compilation is successful, the code is packaged and installed, followed by verification testing in the testing environment. If compilation fails, missing dependencies are retrieved and the code is recompiled. Further, if no bugs are found after testing (testing is successful), the code under test is submitted to the code repository, ending the process. If bugs are found after testing, a development environment is set up to fix them. After fixing the bugs, the code is repackaged and tested. Specifically, a new testing environment can be set up after modifications to perform bug testing on the modified code. If the bug test passes, the bug is considered fixed.

[0111] Furthermore, if it's not a package compatibility issue—that is, the code to be tested is the compiled code corresponding to the image file—then the image file can be uploaded to the target virtual machine and then installed and run. If no bugs appear, the code to be tested can be submitted to the code repository, ending the process. If bugs appear, it can be determined whether any dependency packages are missing. If not, the package compatibility check can be re-executed to avoid bugs caused by misjudgments. If missing, the missing dependency packages are obtained, the image file is reinstalled based on the missing dependency packages, and the test is repeated. In this embodiment of the invention, automatic adaptation on the cloud platform allows for automated testing according to corresponding processes for different adaptation media, thereby improving adaptation efficiency.

[0112] Figure 3 This is a structural block diagram of a code processing device provided in an embodiment of the present invention. The device can be applied to a cloud platform and may include:

[0113] The first receiving module 301 is used to receive test data sent by the user; the test data includes test code and test configuration information.

[0114] Module 302 is used to create a target virtual machine in the cloud platform according to the hardware configuration information in the test configuration information.

[0115] The first deployment module 303 is used to deploy a test environment in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, when the code to be tested is source code; and to deploy a compilation environment in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information; the cloud platform stores different versions of operating system kernels and different versions of compilers.

[0116] The first test module 304 is used to test the code to be tested based on the target virtual machine and obtain test results.

[0117] Optionally, the first deployment module 303 is specifically used to: obtain an operating system kernel compatible with the operating system kernel version from various versions of operating system kernels pre-stored in the cloud platform; and deploy the test environment in the target virtual machine according to the compatible operating system kernel.

[0118] Obtain a compiler compatible with the specified compiler version from the various compiler versions pre-stored in the cloud platform; deploy the compilation environment in the target virtual machine based on the compatible compiler.

[0119] Optionally, the test configuration information may also include package information of the first dependency package required by the compilation environment and package information of the second dependency package required by the test environment;

[0120] The first deployment module 303 is further specifically configured to: obtain the first dependency package from a preset dependency package database based on the package information of the first dependency package; generate a compilation image corresponding to the code to be tested based on the compatible compiler and the first dependency package; and install the compilation image in the target virtual machine to deploy the compilation environment.

[0121] The first deployment module 303 is further configured to: obtain the second dependency package from the preset dependency package database according to the package information of the second dependency package; generate a test image corresponding to the code to be tested based on the compatible operating system kernel and the second dependency package; and install the test image in the target virtual machine to deploy the test environment.

[0122] Optionally, the device further includes:

[0123] The storage module is used to store the compiled image and the test image into a preset file;

[0124] The determination module is used to, if new test data is received and a compilation image and / or test image that matches the test configuration information of the new test data exists in the preset file, then use the matching compilation image and / or test image as the compilation image and / or test image adapted to the new test data.

[0125] Optionally, the first test module 304 is specifically used for:

[0126] Based on the compilation environment in the target virtual machine, the code to be tested is compiled to obtain the compiled code to be tested.

[0127] The compiled code to be tested is packaged to obtain the test software package;

[0128] The software package to be tested is installed in the target virtual machine, and the software package to be tested is run in the test environment of the target virtual machine. The running result is used as the test result.

[0129] Optionally, the device further includes:

[0130] The detection module is used to detect whether there is a missing first dependency package when the code under test fails to compile.

[0131] The compilation module is used to add the missing first dependency package to the compilation environment if one exists, and then recompile the code to be tested based on the compilation environment in the target virtual machine until the compilation result is normal.

[0132] Optionally, the device further includes:

[0133] The acquisition module is used to, if the test results contain runtime error information, retrieve the dependency package that matches the error type from the preset dependency package database according to the error type of the runtime error information;

[0134] Add a module to add the dependency package to the test environment and retest the code to be tested until the test results are normal.

[0135] Optionally, the device further includes:

[0136] The second deployment module is used to deploy a development environment adapted to the code to be tested in the target virtual machine if the test results contain runtime error information.

[0137] The sending module is used to send modification reminder information to the user; the modification reminder information includes the permission interface information of the target virtual machine;

[0138] The second receiving module is used to receive the user's modification operation on the code to be tested, and adjust the code to be tested based on the modification operation; the modification operation is based on the permission interface input corresponding to the permission interface information;

[0139] The second testing module is used to retest the adjusted code to be tested.

[0140] Optionally, the test configuration information further includes: development tool information; the second deployment module is specifically used for:

[0141] If the test results contain runtime error messages, retrieve the development tool indicated by the development tool information from the preset development tool library;

[0142] The development image corresponding to the code to be tested is generated based on the indicated development tools, and the development image is installed in the target virtual machine to deploy the development environment.

[0143] Optionally, the device further includes:

[0144] The upload module is used to upload the code to be tested to a preset code library when the test result is normal.

[0145] In summary, the code processing device provided in this embodiment of the invention can receive test data sent by a user. The test data includes code to be tested and test configuration information. Based on the hardware configuration information in the test configuration information, a target virtual machine is created in a cloud platform. If the code to be tested is source code, a test environment is deployed in the target virtual machine based on an operating system kernel version compatible with the operating system kernel version in the test configuration information, and a compilation environment is deployed in the target virtual machine based on a compiler version compatible with the compiler version in the test configuration information. The cloud platform stores different versions of operating system kernels and different versions of compilers. The test code is tested based on the target virtual machine to obtain test results. In this invention, the user only needs to provide test configuration information, and the cloud platform will automatically create a target virtual machine that meets the test configuration requirements and automatically perform the test, thereby reducing time consumption and improving efficiency to a certain extent.

[0146] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0147] Preferably, embodiments of the present invention also provide an electronic device, including one or more processors; and one or more machine-readable media thereon storing instructions, which, when executed by the one or more processors, cause the electronic device to perform the code processing method provided in the above embodiments.

[0148] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the code processing method provided in the above embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0149] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0150] It will be readily apparent to those skilled in the art that any combination of the above embodiments is feasible, and therefore any combination of the above embodiments is an implementation scheme of the present invention. However, due to space limitations, this specification will not describe them in detail here.

[0151] The methods provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. Based on the above description, the required structure for constructing a system having the inventive solution is readily apparent. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0152] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0153] Similarly, it should be understood that, in order to simplify the invention and aid in understanding one or more of the various inventive aspects, features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof in the above description of exemplary embodiments of the invention. However, this disclosure should not be construed as reflecting an intention that the claimed invention requires more features than expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in fewer than all features of the single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of the invention.

[0154] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0155] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments can be used in any combination.

[0156] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the head-based image processing method according to embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the present invention can be stored on a computer-readable medium or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0157] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

Claims

1. A code processing method, characterized in that, The method is applied to a cloud platform, and the method includes: Receive test data sent by the user; the test data includes the code to be tested and test configuration information; Based on the hardware configuration information in the test configuration information, create the target virtual machine on the cloud platform; When the code to be tested is source code, a test environment is deployed in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, and a compilation environment is deployed in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information; the cloud platform stores different versions of operating system kernels and different versions of compilers; The code to be tested is tested based on the target virtual machine, and the test results are obtained; If the test results show runtime error messages, a development environment adapted to the code under test will be deployed in the target virtual machine so that the user can modify the code under test.

2. The method according to claim 1, characterized in that, The step of deploying the test environment in the target virtual machine according to the operating system kernel version compatible with the operating system kernel version in the test configuration information includes: obtaining an operating system kernel compatible with the operating system kernel version from various versions of operating system kernels pre-stored in the cloud platform; and deploying the test environment in the target virtual machine according to the compatible operating system kernel. The step of deploying the compilation environment in the target virtual machine according to the compiler version compatible with the compiler version in the test configuration information includes: obtaining a compiler compatible with the compiler version from various versions of compilers pre-stored in the cloud platform; and deploying the compilation environment in the target virtual machine according to the compatible compiler.

3. The method according to claim 2, characterized in that, The test configuration information also includes package information of the first dependency package required by the compilation environment and package information of the second dependency package required by the test environment; The step of deploying the compilation environment in the target virtual machine according to the adapted compiler includes: obtaining the first dependency package from a preset dependency package database according to the package information of the first dependency package; generating a compilation image corresponding to the code to be tested based on the adapted compiler and the first dependency package; and installing the compilation image in the target virtual machine to deploy the compilation environment. The step of deploying the test environment in the target virtual machine according to the compatible operating system kernel includes: obtaining the second dependency package from the preset dependency package database according to the package information of the second dependency package; generating a test image corresponding to the code to be tested based on the compatible operating system kernel and the second dependency package; and installing the test image in the target virtual machine to deploy the test environment.

4. The method according to claim 3, characterized in that, The method further includes: Store the compiled image and the test image in a preset file; If new test data is received and a compilation image and / or test image that matches the test configuration information of the new test data exists in the preset file, then the matching compilation image and / or test image shall be used as the compilation image and / or test image adapted to the new test data.

5. The method according to any one of claims 1-4, characterized in that, The step of testing the code to be tested based on the target virtual machine to obtain test results includes: Based on the compilation environment in the target virtual machine, the code to be tested is compiled to obtain the compiled code to be tested. The compiled code to be tested is packaged to obtain the test software package; The software package to be tested is installed in the target virtual machine, and the software package to be tested is run in the test environment of the target virtual machine. The running result is used as the test result.

6. The method according to claim 5, characterized in that, After compiling the code to be tested based on the compilation environment in the target virtual machine, the method further includes: If the code to be tested fails to compile, check if there is a missing first dependency package; If a missing first dependency package exists, the missing first dependency package will be added to the compilation environment, and the code to be tested will be recompiled based on the compilation environment in the target virtual machine until the compilation result is normal.

7. The method according to any one of claims 1-6, characterized in that, After testing the code to be tested based on the target virtual machine and obtaining the test results, the method further includes: If the test results contain runtime error information, then according to the error type of the runtime error information, retrieve the dependency package that matches the error type from the preset dependency package database; Add the dependency package to the test environment and retest the code to be tested until the test results are normal.

8. The method according to any one of claims 1-7, characterized in that, The method further includes: If the test results show runtime error messages, then deploy a development environment compatible with the code to be tested in the target virtual machine; A modification notification message is sent to the user; the modification notification message includes the permission interface information of the target virtual machine; The system receives modification requests from the user to the code under test and adjusts the code under test based on the modification requests; the modification requests are based on the permission interface input corresponding to the permission interface information. The revised code to be tested was retested.

9. The method according to claim 8, characterized in that, The test configuration information also includes: development tool information; the deployment of a development environment adapted to the code under test in the target virtual machine includes: If the test results contain runtime error messages, retrieve the development tool indicated by the development tool information from the preset development tool library; The development image corresponding to the code to be tested is generated based on the indicated development tools, and the development image is installed in the target virtual machine to deploy the development environment.

10. The method according to claim 1, characterized in that, The method further includes: If the test results are normal, the code to be tested will be uploaded to the preset code library.

11. A code processing device, characterized in that, The device is used in a cloud platform, and the device includes: The first receiving module is used to receive test data sent by the user; the test data includes the code to be tested and test configuration information. A creation module is used to create a target virtual machine on the cloud platform based on the hardware configuration information in the test configuration information; The first deployment module is used to deploy a test environment in the target virtual machine according to an operating system kernel version compatible with the operating system kernel version in the test configuration information, when the code to be tested is source code; and to deploy a compilation environment in the target virtual machine according to a compiler version compatible with the compiler version in the test configuration information; the cloud platform stores different versions of operating system kernels and different versions of compilers. The first testing module is used to test the code to be tested based on the target virtual machine and obtain test results; The device further includes a second deployment module, used to deploy a development environment adapted to the code to be tested in the target virtual machine if the test results contain runtime error information, so that the user can modify the code to be tested.

12. An electronic device, characterized in that, include: One or more processors; The electronic device and one or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the electronic device to perform the code processing method as described in any one of claims 1-10.

13. One or more machine-readable media, characterized in that, It stores instructions that, when executed by one or more processors, cause the processors to perform the code processing method as described in any one of claims 1-10.

Citation Information

Patent Citations

  • Software development integration method and device thereof

    CN105867990A

  • Compatibility test environment deployment platform and method

    CN107943690A