UnitTestBot / UTBotCpp

Tool that generates unit test by C/C++ source code, trying to reach all branches and maximize code coverage
Apache License 2.0
158 stars 27 forks source link

[coreutils] Running tests for 'gnulib/lib/exclude.c' failed #166

Open operasfantom opened 2 years ago

operasfantom commented 2 years ago

Steps to reproduce

  1. Open and configure project coreutils
  2. Choose target libcoreutils.a
  3. Generate tests for file gnulib/lib/exclude.c
  4. Run tests
  5. See logs

Initialisation of unnamed union (should be filtered out?)

Logs

/home/utbot/projects/coreutils/utbot_tests/gnulib/lib/exclude_test.cpp:446:97: error: expected unqualified-id
    struct exclude_segment utbotInnerVar1 = {NULL, exclude_hash, 0, from_bytes<exclude_segment::>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};

Code

TEST(error, free_exclude_test_1)
{
    struct exclude ex = {NULL, (struct pattern_buffer *) 18446744073709551615};
    struct exclude_segment utbotInnerVar1 = {NULL, exclude_hash, 0, from_bytes<exclude_segment::>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};
    ex.head = &utbotInnerVar1;
    free_exclude(&ex);
    struct exclude expected_ex = {NULL, NULL};
}

Wrong name of enum

Logs

/home/utbot/projects/coreutils/utbot_tests/gnulib/lib/exclude_test.cpp:504:118: error: no enum named 'exclude_type' in 'UTBot::exclude_segment'
    struct exclude_segment utbotInnerVar1 = {(struct exclude_segment *) 16717361816799281152, (enum exclude_segment::exclude_type)(-232335864), 0, from_bytes<exclude_segment::>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};

Code

TEST(error, excluded_file_name_test_3)
{
    struct exclude ex = {NULL, (struct pattern_buffer *) 18446744073709551615};
    char f[] = "ccabcccccc";
    struct exclude_segment utbotInnerVar1 = {(struct exclude_segment *) 16717361816799281152, (enum exclude_segment::exclude_type)(-232335864), 0, from_bytes<exclude_segment::>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};
    ex.head = &utbotInnerVar1;
    excluded_file_name(&ex, f);
}
ladisgin commented 2 years ago

Looks like a problem @sava-cska is working on

antipeon commented 2 years ago

Union error


Logs

/home/utbot/coreutils/tests/gnulib/lib/exclude_dot_c_test.cpp:684:59: error: expected unqualified-id
        .v = from_bytes<exclude_segment::exclude_segment::(anonymous union at ../lib/exclude.c:106:5)>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};
                                                          ^
/home/utbot/coreutils/tests/gnulib/lib/exclude_dot_c_test.cpp:684:60: error: use of undeclared identifier 'anonymous'
        .v = from_bytes<exclude_segment::exclude_segment::(anonymous union at ../lib/exclude.c:106:5)>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};

Code

TEST(error, excluded_file_name_test_7)
{
    struct exclude ex = {
        .head = NULL,
        .patbuf = (struct pattern_buffer*) 0xffffffff};
    char f[] = "cccccccac";
    struct exclude ex = {
        .head = NULL,
        .patbuf = (struct pattern_buffer*) 0xffffffff};
    struct exclude_segment utbotInnerVar1 = {
        .next = NULL,
        .type = (enum exclude_type)(2001152744),
        .options = 0,
        .v = from_bytes<exclude_segment::exclude_segment::(anonymous union at ../lib/exclude.c:106:5)>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};
    ex.head = (struct exclude_segment*) &utbotInnerVar1;
    excluded_file_name(&ex, f);
}
antipeon commented 2 years ago

Struct redefinition error


Logs

/home/utbot/coreutils/tests/gnulib/lib/exclude_dot_c_test.cpp:677:20: error: redefinition of 'ex'
    struct exclude ex = {
                   ^
/home/utbot/coreutils/tests/gnulib/lib/exclude_dot_c_test.cpp:673:20: note: previous definition is here
    struct exclude ex = {
                   ^

Code

TEST(error, excluded_file_name_test_7)
{
    struct exclude ex = {
        .head = NULL,
        .patbuf = (struct pattern_buffer*) 0xffffffff};
    char f[] = "cccccccac";
    struct exclude ex = {
        .head = NULL,
        .patbuf = (struct pattern_buffer*) 0xffffffff};
    struct exclude_segment utbotInnerVar1 = {
        .next = NULL,
        .type = (enum exclude_type)(2001152744),
        .options = 0,
        .v = from_bytes<exclude_segment::exclude_segment::(anonymous union at ../lib/exclude.c:106:5)>({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})};
    ex.head = (struct exclude_segment*) &utbotInnerVar1;
    excluded_file_name(&ex, f);
}