Tool that generates unit test by C/C++ source code, trying to reach all branches and maximize code coverage

Related tags

CLI UTBotCpp
Overview

What is UTBotCpp?

UTBotCpp generates test cases by code, trying to cover maximum statements and execution paths. We treat source code as source of truth assuming that behavior is correct and corresponds to initial user demand. Generated tests are placed in so-called regression suite. Thus, we fixate current behavior by generated test cases. Using UTBotCpp developers obtain full control of their code. No future change can break the code without being noticed once it's covered with tests generated by UTBot. This way, modifications made by developers to an existing code are much safer. Hence, with the help of generated unit tests, UTBot provides dramatic code quality improvement.

How to install and use UTBot

For now, you can only use UTBot under Ubuntu. UTBot has been tested under Ubuntu 14, 16, and 18. Navigate to the Releases GitHub page and download any version of UTBot. UTBot is distrbuted as an archive that contains

  1. A pack utbot_distr.tar.gz that contains UTBot binary and its dependencies;
  2. UTBot plugin for Visual Studio code — utbot_plugin.vsix;
  3. A version version.txt;
  4. A run script unpack_and_run_utbot.sh.

To launch UTBot, unzip the archive and run the chmod +x unpack_and_run_utbot.sh && ./unpack_and_run_utbot.sh command (we recommend doing it in a fresh directory to make UTBot removing easier). To remove UTBot, simply delete this directory.

To install UTBot VSCode plugin, use VSCode Install from VSIX command.

How to contribute to UTBot

See DEVNOTE.md.

Comments
  • [BUG] Bear doesn't work when only python3 is installed

    [BUG] Bear doesn't work when only python3 is installed

    Steps to reproduce the behavior:

    1. Complete instruction with installation Ubuntu 18.04 on WSL - https://github.com/UnitTestBot/UTBotCpp/wiki/docker-free-wsl2.
    2. As result only python3 is installed and python is undefined
    3. Try to run ~/utbotcpp/utbot_distr/bear/bin/bear

    Expected behavior bear executed

    Actual behavior It fails /usr/bin/env: ‘python’: No such file or directory, so later it cannot be used by UTBot

    bug invalid 
    opened by tyuldashev 5
  • Fields on 'Server Setup' page of wizard are misaligned

    Fields on 'Server Setup' page of wizard are misaligned

    To Reproduce Steps to reproduce the behavior:

    1. Start 'Run UTBot: Quickstart` wizard
    2. Proceed to Server setup page

    Actual behavior Fields and labels are misaligned

    image

    Expected behavior

    • Host, GRPC port and SFTP port are start at the same horizontal position. Now it seems that port settings are more to the right than Host
    • Input fields for Host, GRPC port and SFTP port are start at the same horizontal position no matter of the length of label
    • Messages Successfully pinged... are the same vertical position as ports labels, now they are more the top than labels
    bug vscode-plugin verified 
    opened by tyuldashev 4
  • Better structure fields initialization in generated tests

    Better structure fields initialization in generated tests

    We need the option to transform initialization from initialization-list-based way

        {0, 0, 
          {1, 2}, 
          {1, 2, 3}, 
          0, 0, 0, 
          {4,5,{3,3}}}
    

    to struct-field-based:

    structA.x = 0;
    structA.y = 0;
    structA.subStru.m = 1;
    structA.subStru.n = 2;
    ...
    

    Seems like it should be a UI option in the formatting settings.

    enhancement customer 
    opened by alexey-utkin 4
  • Test runner in batch mode failed

    Test runner in batch mode failed

    Steps to reproduce:

    1. Configure project libbacktrace
    2. Generate tests for file elf.c
    3. Run any regression test individually, it must be passed and an icon showed up
    4. Run all tests in file at once, no icons showed
    5. Check logs
    2022-04-11 10:42:20.166 [utbot-64TK      ]        GTestLogger.cpp:10    INFO| Running main() from /utbot_distr/gtest/googletest/src/gtest_main.cc
    Note: Google Test filter = *.elf_zlib_inflate_table_test_1
    [==========] Running 1 test from 1 test suite.
    [----------] Global test environment set-up.
    [----------] 1 test from error
    [ RUN      ] error.elf_zlib_inflate_table_test_1
    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==11372==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x000000000000 sp 0x7fffffffdee0 T0)
    ==11372==Hint: pc points to the zero page.
    ==11372==The signal is caused by a READ memory access.
    ==11372==Hint: address points to the zero page.
        #0 0x0  (<unknown module>)
        #1 0x7ffff7bc697f  (/lib/x86_64-linux-gnu/libpthread.so.0+0x1297f)
    
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV (<unknown module>) 
    ==11372==ABORTING
    /home/utbot/projects/libbacktrace/build/utbot/make/elf.mk:79: recipe for target 'run' failed
    make: *** [run] Error 1
    
    2022-04-11 10:42:20.166 [utbot-64TK      ]         TestRunner.cpp:154      1| All run commands were executed
    2022-04-11 10:42:20.167 [utbot-64TK      ]   LlvmCoverageTool.cpp:69    WARN| All profraw files are empty: /home/utbot/tmp/utbot-64TK/libbacktrace/coverage/lcov/elf_zlib_inflate_table_test_1.profraw
    2022-04-11 10:42:20.167 [utbot-64TK      ]ServerCoverageAndResult:24    INFO| Creating coverage response.
    2022-04-11 10:42:20.167 [utbot-64TK      ]ServerCoverageAndResult:58    INFO| Coverage response generated
    2022-04-11 10:42:20.167 [utbot-64TK      ] TimeExecStatistics.cpp:117      1| Time execution statistic report:
     | __________________________________________________ | ____________ | _______________ | ____________ | 
     |                                           Function | % of overall | Total time (ms) | Times called | 
     | __________________________________________________ | ____________ | _______________ | ____________ | 
     | CoverageAndResultsGenerator.cpp:37        generate |       100.00 |             227 |            1 | 
     | TestRunner.cpp:159                            init |        56.83 |             129 |            1 | 
     | TestRunner.cpp:135                        runTests |        42.73 |              97 |            1 | 
     | LlvmCoverageTool.cpp:54        getCoverageCommands |         0.00 |               0 |            1 | 
     | CoverageAndResultsGenerator.cpp:86 collectCoverage |         0.00 |               0 |            1 | 
     | __________________________________________________ | ____________ | _______________ | ____________ |
    
    bug duplicate need to check 
    opened by operasfantom 4
  • Add interactive mode

    Add interactive mode

    Now interactive mode doesn't work on generation tests for project or folder, but for file all are fine. For file linked-list.cpp generation time equals 52s for 1 parallel process, 36s - for 5 and 20s - for 10. For other files it's impossible to see difference because number of functions in files are small

    opened by sava-cska 4
  • "Couldn't link any file" error when generating tests for project

    Version v1.0.31-alpha Test project

    Steps to reproduce:

    1. Select lib folder
    2. Right click -> UTbot: Generate Tests for Project

    Actual -> FAILED_PRECONDITION: Couldn't link any files LinkError LinkError0 Expected -> Test should be generated

    bug 
    opened by asolqa 4
  • [BUG] Tests run on outdated code

    [BUG] Tests run on outdated code

    Version: 2022.8.233

    Description If user generates tests, runs them and updates code then next running still uses 'old' code.

    To Reproduce Steps to reproduce the behavior:

    1. Write a function like that
    short min_short(short a, short b) {
        if (a < b) {
            return a;
        }
        return b;
    }
    
    1. Generate tests for the file
    2. Run tests with coverage - both passed
    3. Update condition from a < b to a > b and save the file
    4. Run generated tests again - both test passed again. Expected that one test fails.

    I've checked that code is actually updated on the remote server. It doesn't happen if user skips step 3 and run only modified code.

    bug verified 
    opened by tyuldashev 3
  • Tests are generated with misaligned addresses for pointers

    Tests are generated with misaligned addresses for pointers

    Steps to reproduce

    1. Open and configure project coreutils
    2. Choose target libcoreutils.a
    3. Generate tests for file gnulib/lib/di-set.c
    4. See tests

    Test

    TEST(error, di_set_lookup_test_2)
    {
        struct di_set dis = {NULL, NULL, (struct di_ent *) 0xff};
        di_set_lookup(&dis, 0UL, 0UL);
        struct di_set expected_dis = {NULL, NULL, NULL};
    }
    

    Note

    (struct di_ent *) 0xff has a misaligned address but requires 8 byte alignment

    klee top focus 
    opened by operasfantom 3
  • [KLEE] Assertion in lazy instantiation failed

    [KLEE] Assertion in lazy instantiation failed

    Steps to reproduce:

    1. Configure project libbacktrace
    2. Generate tests for function elf_zlib_inflate_table in file dwarf.c
    3. Find errors in logs
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   KLEE: ERROR: elf.c:1268: memory error: out of bound pointer
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   KLEE: NOTE: now ignoring this error at this location
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   utbot: ../lib/Core/Executor.cpp:4880: klee::ObjectPair klee::Executor::lazyInstantiateVariable(klee::ExecutionState &, ref<klee::Expr>, klee::KInstruction *, uint64_t): Assertion `!isa<ConstantExpr>(address)' failed.
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   linux-gnu/libpthread.so.0+0x12980)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #4 0x00007ffff46fae87 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3ee87)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #5 0x00007ffff46fc7f1 abort (/lib/x86_64-linux-gnu/libc.so.6+0x407f1)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #6 0x00007ffff46ec3fa (/lib/x86_64-linux-gnu/libc.so.6+0x303fa)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #7 0x00007ffff46ec472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #8 0x00000000032a5062 klee::Executor::lazyInstantiateVariable(klee::ExecutionState&, klee::ref<klee::Expr>, klee::KInstruction*, unsigned long) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:0:3
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .    #9 0x00000000032968be klee::Executor::executeMemoryOperation(klee::ExecutionState&, klee::Executor::MemoryOperation, klee::ref<klee::Expr>, klee::ref<klee::Expr>, klee::KInstruction*) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:0:0
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #10 0x000000000329911f klee::ref<klee::Expr>::dec() const /home/utbot/UTBotCpp/submodules/klee/build/../include/klee/ADT/Ref.h:98:9
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #11 0x000000000329911f klee::ref<klee::Expr>::~ref() /home/utbot/UTBotCpp/submodules/klee/build/../include/klee/ADT/Ref.h:89:13
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #12 0x000000000329911f klee::Executor::executeInstruction(klee::ExecutionState&, klee::KInstruction*) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:2845:5
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #13 0x00000000032a1d45 klee::Executor::executeStep(klee::ExecutionState&) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:3874:3
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #14 0x00000000032a27db klee::Executor::guidedRun(klee::ExecutionState&) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:4011:13
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #15 0x00000000032a2516 std::enable_if<__and_<std::__not_<std::__is_tuple_like<klee::PTree*> >, std::is_move_constructible<klee::PTree*>, std::is_move_assignable<klee::PTree*> >::value, void>::type std::swap<klee::PTree*>(klee::PTree*&, klee::PTree*&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/move.h:193:19
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #16 0x00000000032a2516 std::unique_ptr<klee::PTree, std::default_delete<klee::PTree> >::reset(klee::PTree*) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unique_ptr.h:400:2
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #17 0x00000000032a2516 std::unique_ptr<klee::PTree, std::default_delete<klee::PTree> >::operator=(std::nullptr_t) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/unique_ptr.h:336:2
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #18 0x00000000032a2516 klee::Executor::runGuided(klee::ExecutionState&, klee::KFunction*) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:3855:15
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #19 0x00000000032a71e9 klee::Executor::runMainAsGuided(llvm::Function*, int, char**, char**) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Core/Executor.cpp:5163:1
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #20 0x000000000327f0b8 __gnu_cxx::__normal_iterator<KTest* const*, std::vector<KTest*, std::allocator<KTest*> > >::__normal_iterator(KTest* const* const&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator.h:804:20
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #21 0x000000000327f0b8 std::vector<KTest*, std::allocator<KTest*> >::begin() const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:818:16
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #22 0x000000000327f0b8 std::vector<KTest*, std::allocator<KTest*> >::empty() const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:1005:16
    2022-04-11 10:30:54.839 [utbot-64TK      ]        RunKleeTask.cpp:66       1| .   .   #23 0x000000000327f0b8 run_klee_on_function(int, char**, char**, std::unique_ptr<KleeHandler, std::default_delete<KleeHandler> >&, std::unique_ptr<klee::Interpreter, std::default_delete<klee::Interpreter> >&, llvm::Module*, std::vector<bool, std::allocator<bool> >&, std::vector<std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >, std::allocator<std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> > > >&) /home/utbot/UTBotCpp/submodules/klee/build/../lib/Runner/run_klee.cpp:1554:19
    
    bug klee 
    opened by operasfantom 3
  • Possible UI/UX improvements of UTBot Wizard #494

    Possible UI/UX improvements of UTBot Wizard #494

    • check presence of SFTP and SARIF plugins
    • configure SFTP by writing sftp.json
    • runs SFTP sync for project with server copy

    Signed-off-by: Alexey Utkin [email protected]

    opened by alexey-utkin 2
  • [BUG] Odd verification for empty string in generated test

    [BUG] Odd verification for empty string in generated test

    Description UTBot creates empty string as input parameter and then checks its not changed during function call by comparing it with not empty char array.

    To Reproduce Generate tests for following code:

    int my_strlen(char *s)
    {
        char *p;
        int k;
        p = s;
        k = 0;
        while (*p != '\0')
        {
            p++;
            k++;
        }
        return k;
    }
    

    Expected behavior For regression passing tests are generated

    Actual behavior One of the tests looks like this:

    
    TEST(regression, my_strlen_test_1)
    {
        char s[] = "";
        int actual = my_strlen(s);
        EXPECT_EQ(0, actual);
        char expected_s[] = {'\0', 'c', 'a', 'c', 'c', 'c', 'c', 'c', 'c', '\0'};
        for (int it_3_0 = 0; it_3_0 < 10; it_3_0 ++) {
            EXPECT_EQ(expected_s[it_3_0], s[it_3_0]);
        }
    }
    

    Note that it initially creates empty string char s[] = "" but then expects char expected_s[] = {'\0', 'c', 'a', 'c', 'c', 'c', 'c', 'c', 'c', '\0'}; which obviously fails.

    bug good first issue wrong generation 
    opened by tyuldashev 2
  • Changes for using UTBotCPP on scalapack project.

    Changes for using UTBotCPP on scalapack project.

    This PR fixes several problems that appeared on the project scalapack:

    1. Avoid .f and .f.o files as source files.
    2. Use definition parameters (cause due to "extern func();" declaration function`s parameters were lost)
    3. Fix wrong test header and wrapper printing due to old style function definition.
    opened by kichunya 0
  • `curl` project configuration failure

    `curl` project configuration failure

    Description When trying to use UTBot for testing curl project it fails during configuration phase. It seems that it's result of conflict between utbot distribution libraries and system libraries.

    To Reproduce Steps to reproduce the behavior:

    1. Ping me to get preconfigured project or
    2. Clone https://github.com/curl/curl
    3. Run buildconf
    4. Run configure --without-ssl to simplify project configuration
    5. Try to start UTBot test generation for any of C-files.

    Expected behavior Tests are supposed to be generated.

    Actual behavior Configuration fails, logs contains following errors:

    [email protected]:~/remote/curl/build$ cat /home/utbot/distr/2022.11.307/utbot_distr/logs/t00814305-RZT7/curl/2022-12-01T13-12-27360.log | grep error
    /home/utbot/remote/curl/lib/easy_lock.h:80:9: error: address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(int) *' invalid)
    /home/utbot/remote/curl/lib/easy_lock.h:80:8: error: invalid argument type 'typeof (*__atomic_exchange_ptr)' (aka '_Atomic(int)') to unary expression
    /home/utbot/remote/curl/lib/easy_lock.h:83:11: error: address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(int) *' invalid)
    /home/utbot/remote/curl/lib/easy_lock.h:83:5: error: statement requires expression of scalar type ('typeof (*__atomic_load_ptr)' (aka '_Atomic(int)') invalid)
    /home/utbot/remote/curl/lib/easy_lock.h:98:3: error: address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(int) *' invalid)
    /home/utbot/remote/curl/lib/easy_lock.h:80:9: error: address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(int) *' invalid)
    /home/utbot/remote/curl/lib/easy_lock.h:80:8: error: invalid argument type 'typeof (*__atomic_exchange_ptr)' (aka '_Atomic(int)') to unary expression
    /home/utbot/remote/curl/lib/easy_lock.h:83:11: error: address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(int) *' invalid)
    /home/utbot/remote/curl/lib/easy_lock.h:83:5: error: statement requires expression of scalar type ('typeof (*__atomic_load_ptr)' (aka '_Atomic(int)') invalid)
    :In file included from  /home/utbot/distr/2022.11.307/utbot_distr/debs-install/usr/lib/gcc/x86_64-linux-gnu/9/include/limits.herror:: 34address argument to atomic operation must be a pointer to a trivially-copyable type ('_Atomic(int) *' invalid):
    

    I assume that's result of the mix of libraries and header files of utbot-distribution and system.

    Additional context

    • There is no any problems when I invoke cmake manualy
    • configure --with-openssl results in the same errors
    bug 
    opened by tyuldashev 0
  • UTBot auto target fails

    UTBot auto target fails

    Description When trying to generate tests with UTBot auto target, generation fails.

    To Reproduce Steps to reproduce the behavior:

    1. Configure and run UTBot.
    2. Try to generate test for file UTBotCpp/server/test/suites/stub/lib/literals/foo.c inside project UTBotCpp/server/test/suites/stub with auto target enabled.
    3. See error message:
    compile_commands.json doesn't contain a command for source file /home/utbot/UTBotCpp-deploy/server/test/suites/stub/lib/literals/foo.c
    
    1. Then choose exe target.
    2. Run generation again.
    3. See successfully generated tests.

    Expected behavior Tests are supposed to be generated with auto target enabled.

    Actual behavior Tests are not generated with auto target enabled.

    Environment UTBot main branch (commit)

    bug 
    opened by Lana243 0
  • `ferror` confuses UTBot so it creates failing regression test

    `ferror` confuses UTBot so it creates failing regression test

    Description In case there is ferror check in user code then UTBot may generate regression test which fails

    To Reproduce Generate and run tests for following code:

    #include <stdio.h>
    
    int help(FILE *file)
    {
        fputs("help text", file);
        if (ferror(file))
            return -1;
        return 0;
    }
    

    Expected behavior Test are generated. Regression tests pass.

    Actual behavior One regression test is generated, which fails during execution:

    TEST(regression, help_test_1)
    {
        struct _IO_FILE * file = (UTBot::FILE *) fopen("../../../tests/src/A", "w");
    
        int actual = help(file);
        EXPECT_EQ(-1, actual);
    }
    

    In case ferror check is removed then proper test is generated and passes.

    bug wrong generation 
    opened by tyuldashev 0
  • When file is opened inside tested function many generated regression tests fail

    When file is opened inside tested function many generated regression tests fail

    Description If user code accepts file name as parameter then opens and read it, then UTBot generates improper file names and tests fail with errors.

    To Reproduce Generate and run tests for following code (extracted from #507):

    int read_first_char(char * name) {
        FILE *file = fopen(name, "r");
        if (file == NULL) return -1;
        int c = fgetc(file);
        // fclose(file);
    
        if (c == 'Y') return 'Y';
        if (c == 'Z') return 'Z';
        return '0';
    }
    

    Expected behavior Regression tests pass

    Actual behavior Many regression tests fail. Below is one of such tests.

    TEST(regression, read_first_char_test_1)
    {
        write_to_file("../../../tests/src/A", "Y");
    
        char name[] = {'A', '\0', 'c', 'c', 'c', 'a', 'c', 'c', 'c', '\0'};
        int actual = read_first_char(name);
        EXPECT_EQ(89, actual);
        char expected_name[] = {'A', '\0', 'c', 'c', 'c', 'a', 'c', 'c', 'c', '\0'};
        for (int it_17_0 = 0; it_17_0 < 10; it_17_0 ++) {
            EXPECT_EQ(expected_name[it_17_0], name[it_17_0]);
        }
    }
    

    Note that file name initialized with:

    char name[] = {'A', '\0', 'c', 'c', 'c', 'a', 'c', 'c', 'c', '\0'};
    

    Should it contain actual path to the file, then EXPECT_EQ(89, actual) would pass:

    char name[] = "../../../tests/src/A";
    
    bug wrong generation 
    opened by tyuldashev 0
  • STDIN redirect disappeared from the tests

    STDIN redirect disappeared from the tests

    Description During test generation UTBot used to substitute stdin with own construction, now it does not anymore, so tests with user input fail.

    To Reproduce Steps to reproduce the behavior:

    1. Open c-examples from UTBotCPP project
    2. Generate tests for int simple_getc() function in file input_output.c

    Expected behavior Previously tests looked like this:

    TEST(regression, simple_getc_test_1)
    {
        char stdin_buf[] = "\"""";
        int utbot_redirect_stdin_status = 0;
        utbot_redirect_stdin(stdin_buf, utbot_redirect_stdin_status);
        if (utbot_redirect_stdin_status != 0) {
            FAIL() << "Unable to redirect stdin.";
        }
        int actual = simple_getc();
        EXPECT_EQ(-1, actual);
    }
    

    Actual behavior Now utbot_redirect_stdin initialization part disappeared and test looks like this:

    TEST(regression, simple_getc_test_1)
    {
        int actual = simple_getc();
        EXPECT_EQ(9, actual);
    }
    
    bug regression wrong generation 
    opened by tyuldashev 1
Releases(2022.10.8)
  • 2022.10.6(Nov 5, 2022)

  • 2022.10.5(Oct 11, 2022)

  • 2022.10.4(Oct 10, 2022)

    What's Changed

    • Unnecessary "utbot_abs_error" constant added to the test #405 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/431
    • Added math header for lazy instantiated objects if required. Increased time limit for bcov by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/433
    • Unnamed bit fields fix by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/435
    • Fixed test generation for 32 bits projects #442 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/445
    • Added regression test for pointers. Updated KLEE by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/446
    • Implemented support for custom build script inside CI Action on Github #451 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/455
    • Fixed initialization of anonymous unions 'from_bytes' for some cases #447 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/467
    • Update KLEE, fix small bugs by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/466
    • Reformat build structure by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/457
    • Little UI improvements: combined logs and targets tool windows into one, removed verbose widget by @vol0n in https://github.com/UnitTestBot/UTBotCpp/pull/456
    • UTBot don't decorate struct field [BUG] #465 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/470
    • Filed Segmentation Fault in user project #473 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/474
    • Minor version of plugin and server is not properly set #471 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/480
    • Fix generation for coreutils #487 by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/487

    New Contributors

    • @getN1ght made their first contribution in https://github.com/UnitTestBot/UTBotCpp/pull/433

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/2022.9.0...2022.10.4

    Source code(tar.gz)
    Source code(zip)
    utbot-release-2022.10.4.zip(499.05 MB)
  • 2022.10.3(Oct 2, 2022)

    What's Changed

    • Unnecessary "utbot_abs_error" constant added to the test #405 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/431
    • Added math header for lazy instantiated objects if required. Increased time limit for bcov by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/433
    • Unnamed bit fields fix by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/435
    • Fixed test generation for 32 bits projects #442 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/445
    • Added regression test for pointers. Updated KLEE by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/446
    • Implemented support for custom build script inside CI Action on Github #451 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/455
    • Fixed initialization of anonymous unions 'from_bytes' for some cases #447 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/467
    • Update KLEE, fix small bugs by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/466
    • Reformat build structure by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/457
    • Little UI improvements: combined logs and targets tool windows into one, removed verbose widget by @vol0n in https://github.com/UnitTestBot/UTBotCpp/pull/456
    • UTBot don't decorate struct field [BUG] #465 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/470
    • Filed Segmentation Fault in user project #473 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/474
    • Minor version of plugin and server is not properly set #471 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/480

    New Contributors

    • @getN1ght made their first contribution in https://github.com/UnitTestBot/UTBotCpp/pull/433

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/2022.9.0...2022.10.3

    Source code(tar.gz)
    Source code(zip)
    utbot-release-2022.10.3.zip(498.81 MB)
  • 2022.10.0(Sep 28, 2022)

    What's Changed

    • Unnecessary "utbot_abs_error" constant added to the test #405 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/431
    • Added math header for lazy instantiated objects if required. Increased time limit for bcov by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/433
    • Unnamed bit fields fix by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/435
    • Fixed test generation for 32 bits projects #442 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/445
    • Added regression test for pointers. Updated KLEE by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/446
    • Implemented support for custom build script inside CI Action on Github #451 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/455
    • Fixed initialization of anonymous unions 'from_bytes' for some cases #447 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/467
    • Update KLEE, fix small bugs by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/466
    • Reformat build structure by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/457
    • Little UI improvements: combined logs and targets tool windows into one, removed verbose widget by @vol0n in https://github.com/UnitTestBot/UTBotCpp/pull/456
    • UTBot don't decorate struct field [BUG] #465 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/470
    • Filed Segmentation Fault in user project #473 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/474

    New Contributors

    • @getN1ght made their first contribution in https://github.com/UnitTestBot/UTBotCpp/pull/433

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/2022.9.0...2022.10.0

    Source code(tar.gz)
    Source code(zip)
    utbot-release-2022.10.0.zip(498.80 MB)
  • 2022.9.1(Sep 20, 2022)

    What's Changed

    • [BUG] Unnecessary "utbot_abs_error" constant added to the test #405 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/431
    • Added math header for lazy instantiated objects if required. Increased time limit for bcov by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/433
    • unnamed bit fields fix by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/435
    • [BUG] Cannot run generated test for 32 bits projects #442 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/445
    • Added regression test for pointers. Updated KLEE by @getN1ght in https://github.com/UnitTestBot/UTBotCpp/pull/446
    • Implement support for custom build script inside CI Action on Github #451 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/455
    • Implement support for custom build script inside CI Action on Github Part 2 (Command line) #458 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/459
    • Disable auto add issue to project management by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/460
    • fetcher & tests minor fixes by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/454
    • [BUG] Anonymous union initialized using 'from_bytes' in some cases #447 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/467
    • Fail run test for function sumSignArray [BUG] #464 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/468
    • Update KLEE, fix small bugs by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/466

    New Contributors

    • @getN1ght made their first contribution in https://github.com/UnitTestBot/UTBotCpp/pull/433

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/2022.9.0...2022.9.1

    Source code(tar.gz)
    Source code(zip)
    utbot-release-2022.9.1.zip(498.75 MB)
  • 2022.9.0(Sep 2, 2022)

    What's Changed

    • Portable tests by @antipeon in https://github.com/UnitTestBot/UTBotCpp/pull/158
    • Add support symbolic input/output for C by @sava-cska in https://github.com/UnitTestBot/UTBotCpp/pull/315
    • #332 Use UTBotCpp as static analyzer and report results in SARIF by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/333
    • [BUG] CLI_Test.Generate_Project_Tests fails on some PCs #347 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/348
    • Add generation statistics report by @Lana243 in https://github.com/UnitTestBot/UTBotCpp/pull/329
    • supported examples added by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/339
    • vscode plugin shortcuts, comments missing whitespace fix by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/356
    • #216 UTBotCpp does not support test generation for 32bit projects by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/373
    • [BUG] Bad path entry in unittestbot.paths.sourceDirectories parameter on Windows OS #376 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/377
    • Clion plugin for UTBot (#369) by @vol0n in https://github.com/UnitTestBot/UTBotCpp/pull/369
    • Switch to klee 2.3 by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/392
    • Not support anonymous union in struct #317 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/391
    • Fixing generations for files that included in two targets by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/258
    • bit-fields support added by @belous-dp in https://github.com/UnitTestBot/UTBotCpp/pull/383

    New Contributors

    • @belous-dp made their first contribution in https://github.com/UnitTestBot/UTBotCpp/pull/339
    • @pavponn made their first contribution in https://github.com/UnitTestBot/UTBotCpp/pull/411

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/2022.7.0...2022.9.0

    Source code(tar.gz)
    Source code(zip)
    utbot-release-2022.9.0.zip(498.66 MB)
  • 2022.7.3(Jul 27, 2022)

  • 2022.7.2(Jul 26, 2022)

    What's Changed

    • [BUG] SARIF report is not generated for server on local host #340 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/344
    • [BUG] CLI_Test.Generate_Project_Tests fails on some PCs #347 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/348

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/2022.7.1...2022.7.2

    Source code(tar.gz)
    Source code(zip)
    utbot-release-2022.7.2.zip(475.93 MB)
  • 2022.7.1(Jul 21, 2022)

    What's Changed

    • Portable tests by @antipeon in https://github.com/UnitTestBot/UTBotCpp/pull/158
    • Add support symbolic input/output for C by @sava-cska in https://github.com/UnitTestBot/UTBotCpp/pull/315
    • Use UTBotCpp as static analyzer and report results in SARIF by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/333

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/2022.7.0...2022.7.1

    Source code(tar.gz)
    Source code(zip)
  • 2022.7.0(Jul 4, 2022)

    work on ubuntu 18.04, 20.04

    What's Changed

    • UTBotCpp-253 Better structure fields initialization in generated tests #253 by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/263
    • Use klee_assume(s[N - 1] == '\0') call for the last element of string by @operasfantom in https://github.com/UnitTestBot/UTBotCpp/pull/279
    • #246 Support (or ignore) gcc-specific switches while analyzing in clang toolchain by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/282
    • Build ByteCode by make instead of shellExec by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/285
    • Don't print empty test files by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/288
    • Fix disable stubs by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/289
    • Add coverage and results statistics report by @Lana243 in https://github.com/UnitTestBot/UTBotCpp/pull/261
    • #284 Optimization of VC UTBot Quickstart wizard by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/302
    • #231 Compile database may content response files by @alexey-utkin in https://github.com/UnitTestBot/UTBotCpp/pull/305
    • Version unification for docker, server and plugin by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/306
    • Fix generate for folder by @ladisgin in https://github.com/UnitTestBot/UTBotCpp/pull/307

    New Contributors

    • @victoriafomina made their first contribution in https://github.com/UnitTestBot/UTBotCpp/pull/296

    Full Changelog: https://github.com/UnitTestBot/UTBotCpp/compare/v1.0.167...2022.7.0

    Source code(tar.gz)
    Source code(zip)
    utbot-release-2022.7.0.zip(474.73 MB)
  • v1.0.167(May 20, 2022)

  • v1.0.93(Feb 10, 2022)

Owner
null
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.

Boiler plate for C++ projects This is a boiler plate for C++ projects. What you get: Sources, headers and mains separated in distinct folders Use of m

Bendik Samseth 515 Dec 3, 2022
A command-line tool to generate Linux manual pages from C source code.

mangen A command-line tool to generate Linux manual pages from C source code. Description mangen is, as said above, a program to generate Linux manual

null 2 Nov 15, 2021
This is the massive repository for all code for the class CIS3250 Fall Semester.

========================================== Transforming Shapes Through Matrix Multiplication ========================================== Description o

null 4 Nov 25, 2021
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Microsoft 86.2k Nov 28, 2022
nicegraf-shaderc is a command-line tool that transforms HLSL code into shaders for various graphics APIs.

User Manual Table of Contents Introduction Project Status Obtaining the Source Code and Building Running Defining Techniques Generated Header File Pip

nicebyte 95 Oct 24, 2022
Toybox: all-in-one Linux command line.

Toybox: all-in-one Linux command line.

Rob Landley 1.8k Nov 27, 2022
CodeCompactor is an open source program designed for reducing the size of your code!

CodeCompacter An exciting, new and open source program for reducing the length of your code! Usage: ./CodeCompacter {ARGUMENTS} Arguments: -L {languag

Henry Dewsnap 1 Nov 28, 2021
This repository contains the source code of the project(StereoCraft) that we have developed for the Mixed Reality Hackathon organized by Microsoft using StereoKit SDK

StereoCraft - A block-building like experience built using StereoKit This repository contains the source code of the project that we have developed fo

G Bhanuteja 2 Dec 23, 2021
Bootloader recovery and updater tool for StarFive JH17x0 SoCs.

JH71xx-tools Bootloader recovery and updater tool for StarFive JH7100 SoCs.

Kali Prasad 12 May 1, 2022
A command line tool for numerically computing Out-of-time-ordered correlations for N=4 supersymmetric Yang-Mills theory and Beta deformed N=4 SYM.

A command line tool to compute OTOC for N=4 supersymmetric Yang–Mills theory This is a command line tool to numerically compute Out-of-time-ordered co

Gaoli Chen 1 Oct 16, 2021
CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language

CfgManipulator is a fast and powerful tool for working with configuration files for the C++ language. It can read, create strings and sections, change the value of a string and much more.

Sanya 2 Jan 28, 2022
FastReport.Cloud console tool for Linux and perhaps some other OSes

FastReport Cloud console shell This is a simple console shell to FastReport Cloud service. Prerequests GNU packages for build shell: curl-development

Aleksey Mandrykin 2 Feb 10, 2022
Real time crypto monitoring tool

Real-time Crypto Currency Monitor This monitor is a command line dashboard, it uses ncurses, in combination with the Binance API where it fetches all

Edgar Hernandez 38 Oct 8, 2022
pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material.

pbr2gltf2 is a command line tool for converting PBR images to a glTF 2.0 material. The tool is detecting depending on the filename, which PBR information is stored. It swizzles the images and does reassign the channels to a glTF 2.0 image. The tool stores the images plus a minimal, valid glTF 2.0 file containing the required material, textures and images.

UX3D GmbH 23 Jul 31, 2022
A command-line tool to display colorful distro information.

sjfetch A command-line tool to display colorful distro information.

Fikret Musk 6 Apr 6, 2022
Fegeya Freud, CLI FPaper renderer, based on Totem (`less`-like tool without `--help`)

Fegeya Freud, CLI FPaper renderer, based on Totem (`less`-like tool without `--help`)

Ferhat Geçdoğan 3 Jun 11, 2021
Simple command line tool that processes image files using the FidelityFX Super Resolution (FSR) or Contrast Adaptive Sharpening (CAS) shader systems.

Simple command line tool that processes image files using the FidelityFX Super Resolution (FSR) or Contrast Adaptive Sharpening (CAS) shader systems.

GPUOpen Effects 188 Nov 20, 2022
A command line tool with no external dependencies to print information about an X server instance.

xinfo A command line tool with no external dependencies to print information about an X server instance. Building and running To build the code in thi

Jean-Michel Gorius 6 Jan 13, 2022
A C++ console tool to tracker baby actions.

BabyTracker This is a C++ console tool to tracker baby actions. Currently it supports adding Sleep Sessions Breast Feed Sessions Bottle Feed Sessions

YuchenPersonal 1 Oct 17, 2021