forked from UnitTestBot/unittestbot.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---src-docs-advanced-utbot-inside-md-463b67dcfffe247f7a46.js.map
1 lines (1 loc) · 16.8 KB
/
component---src-docs-advanced-utbot-inside-md-463b67dcfffe247f7a46.js.map
1
{"version":3,"file":"component---src-docs-advanced-utbot-inside-md-463b67dcfffe247f7a46.js","mappings":"8RAQaA,EAAe,Q,yOAC5B,IAAMC,EAAc,CAClBD,aAAAA,GAEIE,EAAYC,EAAAA,EACH,SAASC,EAAT,GAGZ,IAFDC,EAEC,EAFDA,WACGC,GACF,YACD,OAAO,QAACJ,GAAD,UAAeD,EAAiBK,EAAhC,CAAuCD,WAAYA,EAAYE,QAAQ,eAG5E,cACE,GAAM,mBADR,oBAGA,kdAGmF,aAAGC,WAAW,IAC7F,KAAQ,OADuE,WAHnF,wQAQG,aAAGA,WAAW,IACb,KAAQ,qBADT,aARH,uDAWA,8DAAgD,aAAGA,WAAW,IAC1D,KAAQ,6DADoC,iBAAhD,+fAOyB,aAAGA,WAAW,IACnC,KAAQ,8BADa,aAPzB,gZAaA,gIACM,aAAGA,WAAW,IAChB,KAAQ,mBADN,aADN,sPAKoC,aAAGA,WAAW,IAC9C,KAAQ,SADwB,SALpC,MAQA,oLACuC,aAAGA,WAAW,IACjD,KAAQ,YAD2B,YADvC,MAG2B,aAAGA,WAAW,IACrC,KAAQ,cADe,cAH3B,0CAMG,aAAGA,WAAW,IACb,KAAQ,wCADT,cANH,0KAUI,aAAGA,WAAW,IACd,KAAQ,gCADR,aAVJ,2HAa+C,aAAGA,WAAW,IACzD,KAAQ,kBADmC,aAb/C,6DAiBA,kBAAG,eAAKC,IAAI,oBAAoBC,IAAI,yGACpC,wFACA,cACE,GAAM,oBADR,qBAGA,mBACE,cAAIF,WAAW,OAAK,aAAGA,WAAW,KAC9B,KAAQ,yBADQ,UAApB,2BAE8C,aAAGA,WAAW,KACxD,KAAQ,oBADkC,SAF9C,UAKD,aAAGA,WAAW,K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AW,MAAvB,SANX,8CAOA,cAAIA,WAAW,MAAf,aAAiC,aAAGA,WAAW,KAC3C,KAAQ,kBADqB,UAAjC,oC,gOAQNJ,EAAWO,gBAAiB","sources":["webpack://unittestbot-web/./src/docs/advanced/utbot-inside.md"],"sourcesContent":["import * as React from 'react'\n /* @jsx mdx */\nimport { mdx } from '@mdx-js/react';\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\n\nimport DefaultLayout from \"/home/user/Github/utbot-new-wiki/node_modules/gatsby-theme-docz/src/base/Layout.js\";\nexport const _frontmatter = {};\nconst layoutProps = {\n _frontmatter\n};\nconst MDXLayout = DefaultLayout;\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n\n\n <h1 {...{\n \"id\": \"how-utbot-works\"\n }}>{`How UTBot Works`}</h1>\n <p>{`UTBot uses KLEE symbolic execution engine to obtain information about program branches. C/C++ projects usually consist\nof source files and headers, which are compiled and linked into libraries and executable files (while libraries can also\nbe linked to one another or other executables, forming a directed acyclic graph of project linkage). Executables and\nlibraries can be considered as the artifacts of project building. KLEE operates with `}<a parentName=\"p\" {...{\n \"href\": \"???\"\n }}>{`LLVM IR`}</a>{` so, to symbolically\nexecute code from a given product, UTBot needs the information about how the project is compiled and linked in order to\nbe able to recompile it into LLVM IR. UTBot is able to get this information from project build system via Bear\ntool `}<a parentName=\"p\" {...{\n \"href\": \"compile-databasse\"\n }}>{`more info`}</a>{`. UTBot supports CMake and Makefile build systems.`}</p>\n <p>{`Then, UTBot analyses given sources using `}<a parentName=\"p\" {...{\n \"href\": \"https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html\"\n }}>{`clang-tooling`}</a>{` to\nobtain C/C++ AST of files under test. Note that clang-tooling requires a compilation database to work. Essentially, a\ncompilation database is a structural representation of compile commands used to obtain C/C++ object files from project\nsources, and it is also retrieved from the build system by UTBot. UTBot treats functions as structural units of the\nproject and generates tests for them. In order to achieve this, UTBot creates symbolic wrappers called KLEE files for\nevery project source file, `}<a parentName=\"p\" {...{\n \"href\": \"preparing-sources-for-klee\"\n }}>{`more info`}</a>{`, that use symbolic variables concept for symbolic\nexecution. Symbolic variables can be treated as logical constraints for variables, which are transformed into concrete\nvalues as the result of symbolic execution. Symbolic variables are the core of symbolic execution approach to software\nverification, and they are used in many successful tools for software verification and test generation.`}</p>\n <p>{`Then, UTBot uses information about project compilation and linkage to rebuild the project in LLVM\nbitcode `}<a parentName=\"p\" {...{\n \"href\": \"linking-bitcode\"\n }}>{`more info`}</a>{`. This is done to pass the linkage result (.bc file) to KLEE. If a function calls\nother functions from the project, UTBot can provide KLEE with their bitcode as well, or, depending on user preferences,\nuse generated symbolic stubs for them `}<a parentName=\"p\" {...{\n \"href\": \"stubs\"\n }}>{`stubs`}</a>{`.`}</p>\n <p>{`KLEE produces files that represent test cases for a given function, and UTBot parses and transforms them to C++ test\nfiles (For supported C/C++ features, see `}<a parentName=\"p\" {...{\n \"href\": \"c-syntax\"\n }}>{`c syntax`}</a>{`, `}<a parentName=\"p\" {...{\n \"href\": \"cpp-syntax\"\n }}>{`c++ syntax`}</a>{`), which present the test cases\nwith `}<a parentName=\"p\" {...{\n \"href\": \"https://google.github.io/googletest/\"\n }}>{`GoogleTest`}</a>{` framework. UTBot also provides its users with a build system for\ngenerated tests, automatically compiling and linking them with project files. Users can run\ntests `}<a parentName=\"p\" {...{\n \"href\": \"generating-and-running-tests\"\n }}>{`more info`}</a>{` with a single click and see the results and coverage information in\nVSCode Panel. UTBot uses Makefiles for test runs `}<a parentName=\"p\" {...{\n \"href\": \"incrementality\"\n }}>{`more info`}</a>{`, so UTBot tests can be used in continuous\nintegration.`}</p>\n <p><img alt=\"UTBotCpp pipeline\" src=\"https://github.com/UnitTestBot/unittestbot.github.io/raw/source/resources/images/pipelineUtbot.png\" /></p>\n <p>{`The most important things are described below in sequential order.`}</p>\n <h2 {...{\n \"id\": \"tests-generation\"\n }}>{`Tests Generation`}</h2>\n <ol>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"install-vscode-plugin\"\n }}>{`Client`}</a>{` sends request (one of `}<a parentName=\"li\" {...{\n \"href\": \"generating-tests\"\n }}>{`types`}</a>{`)\nto `}<a parentName=\"li\" {...{\n \"href\": \"install-server\"\n }}>{`server`}</a>{`.\nThe `}<a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/testgens\"\n }}>{`corresponding`}</a>{` object aggregates\nrequests' information.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/blob/main/server/src/fetchers/Fetcher.cpp\"\n }}>{`Fetcher`}</a>{` fetches types, methods,\nglobal variable usages, array usages, includes for all files in request. It\nuses `}<a parentName=\"li\" {...{\n \"href\": \"https://clang.llvm.org/docs/LibTooling.html\"\n }}>{`LibTooling`}</a>{` for parsing source code, traversing types, etc.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/clang-utils/SourceToHeaderRewriter.cpp\"\n }}>{`SourceToHeaderRewriter`}</a>{`\ngenerates headers (.h files) based on source (.c files).`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/FeaturesFilter.cpp\"\n }}>{`FeaturesFilter`}</a>{` filters out all\nmethods except the ones listed in `}<a parentName=\"li\" {...{\n \"href\": \"c-syntax\"\n }}>{`supported syntax`}</a>{`.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/Synchronizer.cpp\"\n }}>{`Synchronizer`}</a>{`\nsynchronizes `}<a parentName=\"li\" {...{\n \"href\": \"stubs\"\n }}>{`stubs`}</a>{` and wrappers for all files\nin `}<a parentName=\"li\" {...{\n \"href\": \"https://clang.llvm.org/docs/JSONCompilationDatabase.html\"\n }}>{`compile_commands.json`}</a>{`.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/KleeGenerator.cpp\"\n }}>{`KleeGenerator`}</a>{` generates klee files\nas well as source files, also builds them in `}<a parentName=\"li\" {...{\n \"href\": \"https://llvm.org/docs/BitCodeFormat.html\"\n }}>{`bitcode`}</a>{` files.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/building/Linker.cpp\"\n }}>{`Linker`}</a>{` links bitcode files\ntogether into module.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/building/Linker.cpp\"\n }}>{`Linker`}</a>{`\nwrites `}<a parentName=\"li\" {...{\n \"href\": \"makefiles\"\n }}>{`Makefiles`}</a>{`.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/KleeRunner.cpp\"\n }}>{`KleeRunner`}</a>{`\nruns `}<a parentName=\"li\" {...{\n \"href\": \"https://klee.github.io/\"\n }}>{`KLEE`}</a>{` on module consecutively for each method from request.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/KleeGenerator.cpp\"\n }}>{`KleeGenerator`}</a>{` parses output of\nKLEE and writes files of `}<a parentName=\"li\" {...{\n \"href\": \"https://github.com/google/googletest\"\n }}>{`GoogleTest`}</a>{`.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"install-server\"\n }}>{`Server`}</a>{` sends final response to client and also transfers generated files for remote scenario.`}</li>\n </ol>\n <h2 {...{\n \"id\": \"tests-running\"\n }}>{`Tests Running`}</h2>\n <p>{`When user runs the tests, server performs various operations that might depend on the compiler used by the project.`}</p>\n <ol>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"install-vscode-plugin\"\n }}>{`Client`}</a>{` sends request to `}<a parentName=\"li\" {...{\n \"href\": \"install-server\"\n }}>{`server`}</a>{`.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/TestRunner.cpp\"\n }}>{`TestRunner`}</a>{` chooses coverage\ntool based on the compiler used by the project. It\nis `}<a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/GcovCoverageTool.cpp\"\n }}>{`GcovCoverageTool`}</a>{` in\ncase of `}<a parentName=\"li\" {...{\n \"href\": \"https://gcc.gnu.org/\"\n }}>{`gcc`}</a>{`\nand `}<a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/LlvmCoverageTool.cpp\"\n }}>{`LlvmCoverageTool`}</a>{`\nin case of `}<a parentName=\"li\" {...{\n \"href\": \"https://clang.llvm.org/\"\n }}>{`clang`}</a>{`.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/TestRunner.cpp\"\n }}>{`TestRunner`}</a>{` collects list of\ntuples (file path, suite name, test name) based on the information from the `}<a parentName=\"li\" {...{\n \"href\": \"install-vscode-plugin\"\n }}>{`client`}</a>{`.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/TestRunner.cpp\"\n }}>{`TestRunner`}</a>{` incrementally\nbuilds tests with instrumented options (coverage and sanitizer). To achieve this `}<a parentName=\"li\" {...{\n \"href\": \"makefiles\"\n }}>{`Makefiles`}</a>{` are used.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/TestRunner.cpp\"\n }}>{`TestRunner`}</a>{` runs tests by\ncalling `}<a parentName=\"li\" {...{\n \"href\": \"https://www.gnu.org/software/make/manual/make.html\"\n }}>{`make`}</a>{` on makefiles that correspond to the given sources.`}</li>\n <li parentName=\"ol\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/blob/main/server/src/coverage/CoverageAndResultsGenerator.cpp\"\n }}>{`CoverageAndResultsGenerator`}</a>{`\ncollects coverage information using previously chosen tool.`}\n <ul parentName=\"li\">\n <li parentName=\"ul\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/GcovCoverageTool.cpp\"\n }}>{`GcovCoverageTool`}</a>{`\nruns `}<a parentName=\"li\" {...{\n \"href\": \"https://gcc.gnu.org/onlinedocs/gcc/Gcov.html\"\n }}>{`gcov`}</a>{`\non `}<a parentName=\"li\" {...{\n \"href\": \"https://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html\"\n }}>{`.gcno and .gcda`}</a>{` files. It provides a report\nin `}<inlineCode parentName=\"li\">{`.json`}</inlineCode>{` format.`}</li>\n <li parentName=\"ul\"><a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/LlvmCoverageTool.cpp\"\n }}>{`LlvmCoverageTool`}</a>{`\nruns `}<a parentName=\"li\" {...{\n \"href\": \"https://llvm.org/docs/CommandGuide/llvm-profdata.html\"\n }}>{`llvm-profdata`}</a>{` to merge several .profraw files into\none. It provides a report in `}<inlineCode parentName=\"li\">{`.json`}</inlineCode>{` format using `}<a parentName=\"li\" {...{\n \"href\": \"https://llvm.org/docs/CommandGuide/llvm-cov.html\"\n }}>{`llvm-cov`}</a>{`.`}</li>\n </ul>\n </li>\n <li parentName=\"ol\">{`Both `}<a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/GcovCoverageTool.cpp\"\n }}>{`GcovCoverageTool`}</a>{`\nand `}<a parentName=\"li\" {...{\n \"href\": \"https://github.com/UnitTestBot/UTBotCpp/tree/main/server/src/coverage/LlvmCoverageTool.cpp\"\n }}>{`LlvmCoverageTool`}</a>{`\nread generated `}<inlineCode parentName=\"li\">{`.json`}</inlineCode>{` file and determine set of covered lines.`}</li>\n <li parentName=\"ol\">{`Finally, `}<a parentName=\"li\" {...{\n \"href\": \"install-server\"\n }}>{`Server`}</a>{` sends response to the client.`}</li>\n </ol>\n\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;\n "],"names":["_frontmatter","layoutProps","MDXLayout","DefaultLayout","MDXContent","components","props","mdxType","parentName","alt","src","isMDXComponent"],"sourceRoot":""}